Using four digit LED display
In this example all four displays, instead of two, are active so that it is possible to write numbers from 0 to 9999. Here, the number 1 234 is displayed. After initialization, the program remains in the loop LOOP where digital multiplexing is performed. The subroutine Disp is used to convert binary numbers into corresponding combinations of bits for the purpose of activating display lighting segments.;************************************************************************ ;* PROGRAM NAME : 7Seg5.ASM ;* DESCRIPTION : Program displays number"1234" on 7-segment LED display ;************************************************************************ ;BASIC DIRECTIVES $MOD53 $TITLE(7SEG5.ASM) $PAGEWIDTH(132) $DEBUG $OBJECT $NOPAGING ;STACK DSEG AT 03FH STACK_START: DS 040H ;RESET VECTORS CSEG AT 0 JMP XRESET ; Reset vector ORG 100H XRESET: MOV SP,#STACK_START ; Define Stack pointer LOOP: MOV P1,#0 ; Turn off all display segments MOV P3,#20h ; Activate display D4 MOV A,#04 ; Write digit 4 on display D4 LCALL Disp ; Find mask for that digit MOV P1,A ; Put the mask on the port MOV P1,#0 ; Turn off all display segments MOV P3,#10h ; Activate display D3 MOV A,#03 ; Write digit 3 on display D3 LCALL Disp ; Find mask for that digit MOV P1,A ; Put the mask on the port MOV P1,#0 ; Turn off all display segments MOV P3,#08h ; Activate display D2 MOV A,#02 ; Write digit 2 on display D2 LCALL Disp ; Find mask for that digit MOV P1,A ; Put the mask on the port MOV P1,#0 ; Turn off all display segments MOV P3,#04h ; Activate display D1 MOV A,#01 ; Write digit 1 on display D1 LCALL Disp ; Find mask for that digit MOV P1,A ; Put the mask on the port SJMP LOOP ; Return to the lable LOOP Disp: ; Subroutine for writing digits INC A MOVC A,@A+PC RET DB 3FH ; Digit 0 mask DB 06H ; Digit 1 mask DB 5BH ; Digit 2 mask DB 4FH ; Digit 3 mask DB 66H ; Digit 4 mask DB 6DH ; Digit 5 mask DB 7DH ; Digit 6 mask DB 07H ; Digit 7 mask DB 7FH ; Digit 8 mask DB 6FH ; Digit 9 mask END ; End of program