Can someone help me with this program

Thread Starter

Sap9

Joined Oct 8, 2020
3
I am trying to display 1 through 9 while rotating on win8051 what am i missing here:

Code:
; Initialize number to display
MOV R1, #0
; Main Loop
LOOP:
; Display R1 on the 7-Segment
CALL GETDIGIT
CALL DISPLAY
; Wait one second
CALL DELAY
; Increment R1
CALL INCREASE
; Repeat the Loop
JMP LOOP
; Delay Function
DELAY: MOV R2, #20h
DELAY1: MOV R3, #0FFh
DELAY2: MOV R4, #0FFh
DELAY3: DJNZ R4,DELAY3
DJNZ R3, DELAY2
DJNZ R2, DELAY1
RET
; Increase Function
INCREASE:
INC R1
MOV A, R1
SUBB A, #10
JNZ SKIP
MOV R1, #0
SKIP:
RET
Moderator Edit: [code] [/code] tags added
 

JohnInTX

Joined Jun 26, 2012
4,344
Welcome to AAC!
Yes. every time I try to run the program I keep getting error
May we know what the error(s) are?
You did not post the code for GETDIGIT or DISPLAY. Is that your error?

EDIT:
I would guess that GETDIGIT looks up a segment pattern from a table stored in ROM using the 'DB' directive. R1 is the index into the table. DISPLAY puts the pattern to one of the 8 bit output ports.
 
Last edited:
Top