;FILENAME:   STLAB021.ASM
;DATE:       March 16, 1996
;TITLE:      DC motor starting and stopping control
;HARDWARE:   MLAB-121

; JAZZ-31 utilities subroutines
SCANK   EQU     0099H    ;scan display & KB 1 LOOP
; Pin Interface
DCM_CTL EQU     P1.7     ;DC motor control
SENSOR   EQU     P3.2     ;sensor status
; Variable
DISBUF    EQU     032H    ;display buffer

;Program 1:  Basic on/off DC motor control

        ORG     8100H
START:
        LCALL   INIT_DISPLAY    ;initial display buffer
LOOP1:
        LCALL   SCANK
        CJNE    A,#0FH,LOOP2    ;key F
        CLR     DCM_CTL         ;start motor
        SJMP    LOOP1
LOOP2:  CJNE    A,#0BH,LOOP1    ;key B
        SETB    DCM_CTL         ;stop motor
        SJMP    LOOP1
;
; Initial display buffer
;
INIT_DISPLAY:
        MOV     DISBUF+0,#5EH   ;d
        MOV     DISBUF+1,#58H   ;c
        MOV     DISBUF+2,#00H
        MOV     DISBUF+3,#08H   ;_
        MOV     DISBUF+4,#00H
        MOV     DISBUF+5,#00H
        MOV     DISBUF+6,#00H
        MOV     DISBUF+7,#00H
        RET
;
        END

