Вы находитесь на странице: 1из 2

ORG 8000H Button EQU 0FF28H ; address for button LED EQU 0FF38H ; address for LEDs FND

EQU 0FF2CH ; address for seven segment display MOV DPTR, ______ ; fill in suitable value D0: MOV A, #9AH HERE: ADD A, #99H ; Minus one in BCD DA A MOVX @DPTR, A ACALL Delay JNZ ______ ; complete this line SJMP D0 Delay: MOV R2, #190 ; (1 mc) D2: MOV R1, #______ ; fill in suitable number to get 1s delay (1 mc) D1: MOV R0, #______ ; fill in suitable number to get 1s delay (1 mc) DJNZ R0, $ ; (2 mc) DJNZ R1, D1 ; (2 mc) DJNZ R2, D2 ; (2 mc) RET ; (2 mc) END BUTTON EQU 0FF28H FND EQU 0FF2CH DOT_A EQU 0FF30H DOT_B EQU 0FF31H DOT_C EQU 0FF32H DOT_CWR EQU 0FF33H NUMBER EQU 1500 REFRESH EQU 20 ORG 8000H LOOP: MOV R6, #REFRESH ; Refresh counter CHAR2: MOV R7, #0 ; Counter for Column position MOV A, R7 ; Load column position into A D_D2: MOV DPTR, #Red2 ; Go to Red2 Table MOVC A, @A+DPTR ; Load data into A MOV R0, A ; store in R0 MOV A, R7 ; restore column position into A MOV DPTR, #Green ; Go to Green Table MOVC A, @A+DPTR ; Load data into A MOV R1, A ; store in R1 MOV DPTR, #DOT_A ; RED light MOV A, R0 ; recall RED data MOVX @DPTR, A ; output to RED light MOV DPTR, #DOT_B ; GREEN light MOV A, R1 ; recall GREEN light MOVX @DPTR, A ; output to GREEN light MOV DPTR, #DOT_C ; Controlling the column MOV A, R7 ; restore column position into A MOVX @DPTR, A ; output to Column control CALL DELAY2MS INC A ; Increment column MOV R7, A ; Save to column counting register CJNE A, #8, D_D2 ; Continue with next column DJNZ R6, CHAR2 ; refresh the character after all columns are displayed LJMP LOOP ; repeat again DELAY2MS: MOV TMOD, #01H MOV TH0, #HIGH(-NUMBER) MOV TL0, #LOW(-NUMBER) SETB TR0 JNB TF0, $

CLR TF0 RET Green: DB 0FFH, 0FFH, 01H, 01H, 01H, 01H, 01H, 0FFH ; Green table Red2: DB 00H, 00H, 84H, 0C2H, 0A2H, 92H, 8CH, 00H ; Red2 table Red0: DB 00H, 00H, 7CH, 0A2H, 92H, 8AH, 7CH, 00H ; Red0 table ; fill in Red3 table ; fill in Red6 table END

Вам также может понравиться