SharMcN
Newbie level 3
Hi,
I am currently working on a project that requires an 8051 to increment/decrement a 7 seg display. I have built the circuit and tested it all. But i am having real problems when using ASM to display the right numbers on the display.
I am using a BCD (CD4511) chip connected to my display and when i checked it the numbers display 0-9 correctly. however when i tried the same thing using code i hit a 'wall'. Below is the code i have used to run through numbers 0-9:
I do not understand where i am making a mistake, and would appreciate any help that may be available.
Shar
I am currently working on a project that requires an 8051 to increment/decrement a 7 seg display. I have built the circuit and tested it all. But i am having real problems when using ASM to display the right numbers on the display.
I am using a BCD (CD4511) chip connected to my display and when i checked it the numbers display 0-9 correctly. however when i tried the same thing using code i hit a 'wall'. Below is the code i have used to run through numbers 0-9:
Code:
org 0000h
main: mov r0,#08h
mov a,#00000001b ;test all segments of disp
up: rr a
mov P2,a
acall delay
djnz r0,up
again: mov P2,#0000 ;'0'
acall delay
mov P2,#0001 ;'1'
acall delay
mov P2,#0010 ;'2'
acall delay
mov P2,#0011 ;'3'
acall delay
mov P2,#0100 ;'4'
acall delay
mov P2,#0101 ;'5'
acall delay
mov P2,#0110 ;'6'
acall delay
mov P2,#0111 ;'7'
acall delay
mov P2,#1000 ;'8'
acall delay
mov P2,#1001 ;'9'
acall delay
sjmp again
delay: mov r2,#100 ;delay subroutine
up3: mov r4,#100
up2: mov r3,#100
up1: djnz r3,up1
djnz r4,up2
djnz r2,up3
ret
Shar