Wednesday, 18 March 2020

Traffic Light Interface





Program
2.TRAFFIC  LIGHTS

; TRAFFIC LIGHT CONTROLLER INTERFACE
; The interface is connected over J4 of of trainer
; Traffic system moves from one state to other after a fixed delay
; This program starts at 2000H location






   OUTPUT  2500AD

        ORG     2000H
START:  MOV     AL,80H                 ; Initialisation of 8255 Mode 0
        MOV     DX,0FFE6H
        OUT     DX,AL                  ; All ports as o/p ports
AGAIN:  MOV     SI,2038H               ; Table of port values
NEXTST: MOV     AL,[SI]
        MOV     DX,0FFE0H
        OUT     DX,AL                  ; PortA value
        INC     SI
        ADD     DX,2
        MOV     AL,[SI]
        OUT     DX,AL                  ; PortB value
        INC     SI
        ADD     DX,2
        MOV     AL,[SI]
        OUT     DX,AL                  ; PortC value
        INC     SI
        CALL    DELAY                  ; Calling Delay routine
        CMP     SI,2044H               ; Checking for the end of the data values
        JNZ     NEXTST
        JMP     AGAIN
DELAY:  MOV     CX,0FFH                ; Delay routine
DLY5:   PUSH    CX
        MOV     CX,03FFH
DLY10:  NOP
        LOOP    DLY10
        POP     CX
        LOOP    DLY5
        RET



        ORG     2038H
        PORTVALUES:     DB      88H,83H,F2H               
                                      DB      38H,88H,F4H             
                                      DB      83H,88H,F8H              
                                      DB      88H,38H,F1H                
                                      DB      00H             
                     

No comments:

Post a Comment