Hello, im using a c8051f330 microcontroller and im multiplexing a 4 digit seven segment display. Its common cathode setup. ok i got my code counting from 0 to 9 but all four digits are counting at the same time. I want to count from 0000 to 9999. I got the the seven segments common cathode and here is the code. Can some one help. Please i dont have the schematics just the code in assembly.
$NOMOD51
$include (c8051f330.inc) ; Include register definition file.
display1 equ P0.0
display2 equ P0.1
display3 equ P0.2
display4 equ P0.3
ORG 00H ; starting code memory location
SJMP MAIN ; execute main code
ORG 1BH ; start cord
MAIN: ANL PCA0MD, #NOT(040h) ; disable the WDT
MOV XBR1, #40H ; enable Crossbar
ORL P1MDOUT, #0FFh ; make port 1 output push-pull
MOV P1,#00H
LOOP:
MOV P1, #0BFH ; count 0 to 9
ACALL DELAYS
MOV P1,#86H
ACALL DELAYS
MOV P1, #0DBh
ACALL DELAYS
MOV P1,#0CFH
ACALL DELAYS
MOV P1,#0E6H
ACALL DELAYS
MOV P1, #0EDH
ACALL DELAYS
MOV P1,#0FDH
ACALL DELAYS
MOV P1, #007H
ACALL DELAYS
MOV P1,#0FFH
ACALL DELAYS
MOV P1, #0EFH
ACALL DELAYS
AJMP LOOP
DELAYS: ;1s DELAY
MOV R5,#10
D1:
CALL DELAY
DJNZ R5,D1
RET
DELAY: ;100ms DELAY
MOV R7,#200
D2:
MOV R6,#100
D3:
NOP
NOP
NOP
DJNZ R6,D3
DJNZ R7,D2
RET
END
$NOMOD51
$include (c8051f330.inc) ; Include register definition file.
display1 equ P0.0
display2 equ P0.1
display3 equ P0.2
display4 equ P0.3
ORG 00H ; starting code memory location
SJMP MAIN ; execute main code
ORG 1BH ; start cord
MAIN: ANL PCA0MD, #NOT(040h) ; disable the WDT
MOV XBR1, #40H ; enable Crossbar
ORL P1MDOUT, #0FFh ; make port 1 output push-pull
MOV P1,#00H
LOOP:
MOV P1, #0BFH ; count 0 to 9
ACALL DELAYS
MOV P1,#86H
ACALL DELAYS
MOV P1, #0DBh
ACALL DELAYS
MOV P1,#0CFH
ACALL DELAYS
MOV P1,#0E6H
ACALL DELAYS
MOV P1, #0EDH
ACALL DELAYS
MOV P1,#0FDH
ACALL DELAYS
MOV P1, #007H
ACALL DELAYS
MOV P1,#0FFH
ACALL DELAYS
MOV P1, #0EFH
ACALL DELAYS
AJMP LOOP
DELAYS: ;1s DELAY
MOV R5,#10
D1:
CALL DELAY
DJNZ R5,D1
RET
DELAY: ;100ms DELAY
MOV R7,#200
D2:
MOV R6,#100
D3:
NOP
NOP
NOP
DJNZ R6,D3
DJNZ R7,D2
RET
END