i need a little help

Discussion in 'General Electronics Chat' started by meriland, Jun 15, 2012.

  1. meriland

    Thread Starter New Member

    Jan 3, 2012
    5
    0
    I made a digital counter with 89C51 that can count till 5 but it's not working here is its program with assembley can you help me to figure out what can I do to fix it?
    org 00h
    first:
    mov r6,#0
    jnb p0.0,up_foul
    jnb p1.0,low_foul
    mov dptr,#ROWS
    jmp first
    up_foul:
    call delay
    jnb p0.0,up_foul
    inc r6
    cjne r6,#5,first
    dec r6
    jmp first
    low_foul:
    call delay
    jnb p0.1,low_foul
    dec r6
    cjne r6,#0ffh,first
    inc r6
    jmp first
    mov p2,00h
    clr a
    mov a,r6
    movc a,@a+dptr
    mov p2,a
    inc dptr
    jmp first
    delay:
    mov r4,#50
    back2: mov r5,250
    back1: djnz r5,back1
    djnz r4,back2
    ret
    ROWS:
    DB 6,91,79,102,109
    end
     
Loading...