Program to implement BCD counter to count from 0-99


24. Program to implement BCD counter to count from 0-99 :

here:mov a,#0h ;move 0 to a
up:mov p0,a ;move data fr
acall delay ;call delay program
inc a ;increment a
da a ;decimal adjust accumulator after addition
cjne a,#100,up ;compare a with 100, if not equal, jump to location up
sjmp here ;jump to location here
delay routine
delay:mov r1,#0ffh ;move 0ffh to r1
l3:mov r2,#0ffh ;move 0ffh to r2
l2:mov r3,#0ffh ;move 0ffh to r3
l1:djnz r1,l1 ;decrement r1, repeat till r1=0
djnz r3,l2 ;decrement r3,repeat l2 till r3=0
djnz r2,l3 ;decrement r2, repeat l3 till r2=0
ret ;return
end


Web Statistics