;FILENAME:   STLAB051.ASM
;DATE:       March 16, 1996
;TITLE:      Characters display on 7 segment LED
;HARDWARE:   MLAB-121

; Pin Interface
DISCON1  EQU    P1.0    ;DIGIT0
DISCON2  EQU    P1.1    ;DIGIT1
PA_8255  EQU    0FA00H  ;8255 port A (SEGMENT)
PC_8255  EQU    0FA02H  ;8255 port c (pc0-pc3 = KEYIN)
CTL_8255 EQU    0FA03H  ;8255 control port
; Variables
DISBUF   EQU    32H     ;LED display buffer
HEXBUF   EQU    3AH     ;HEX buffer
SCANPF   EQU    60H     ;SCAN  - PRESS FLAG

;Program 1: One Segment rotation

        ORG     8100H
MAIN:
        LCALL   INIT_8255       ;set 8255 mode
SEGKEY:
        MOV     A,#01H          ;init pattern
        MOV     R1,#08          ;8 loop
SEGKEY2:
        PUSH    ACC             ;save data
        MOV     DISBUF+0,A      ;store data in display buffer
        MOV     DISBUF+1,A
        MOV     DISBUF+2,A
        MOV     DISBUF+3,A
        MOV     R2,#20          ;delay
        LCALL   SCAN_AND_DELAY
        POP     ACC             ;restore data
        RL      A               ;and rotate to next pattern
        DJNZ    R1,SEGKEY2
        LJMP    0036H
;
        $INCLUDE "STLAB05H.ASM"
;
        END
