Documente Academic
Documente Profesional
Documente Cultură
CONTENTS
PAGE NO
1.0 Introduction 2
3.0 Installation 5
1.0 INTRODUCTION
Electro Systems Associates Private Limited (ESA) manufactures trainers for most of the popular
microcomputers viz 8085, Z-80, 6502, 8086/8088 and 68000. ESA offers a variety of modules
which can be interfaced to these trainers. These modules can be effectively used for
teaching/training in the laboratories.
The present manual describes one such interface module traffic lights interface. The interface
simulates the control and operation of traffic lights at a junction of four roads. The interface provides
a set of 6 LED indicators at each of the four corners. Each of these LEDs can be controlled by a port
line.
Thus the interface allows the user to simulate a variety of traffic situations using appropriate
software routines. The sample programs provided in section 4 of this manual simulate some
interesting traffic movement sequences.
This interface can be connected to any of ESA trainers viz., MPS 85-3, ESA 85-2, ESA 80, ESA 65,
ESA 68K, ESA 86/88-2, ESA 31, ESA 51, ESA 86/88-3 & ESA 51E.
The organization of these LEDs is identical at each of the four corners. Hence, for simplicity, the
organization is described below with reference to the LEDs at SOUTH-WEST corner only.
RED
A
R S L
DL PEDESTRIANS DL
SOUTH
Of these , the first five LEDs will be ON or OFF depending on the state of the corresponding port line
(LED is ON if the port line is Logic HIGH and LED is OFF if the port line is Logic LOW). The last
one marked as DL is a set of two dual-colour LEDs and they both will be either RED or GREEN
depending on the state of the corresponding port line (RED if the port line is Logic HIGH and
GREEN if the port line is Logic LOW).
There are four such sets of LEDs and these are controlled by 24 port lines. Each port line is inverted
and buffered using 7406 (open collector inverter buffers) and is used to control an LED. Dual-colour
LEDs are controlled by a port line and its complement.
The 24 LEDs and their corresponding port lines are summarized below
STRAIGHT PC0
RIGHT PB5
PEDESTRIAN PC5
User can assign any meaningful interpretation to these LEDs and then develop software accordingly.
Usually, the interpretation would be as follows:
Vehicles coming from one direction are controlled by the LEDs at the opposite corner.
For example, vehicles coming from NORTH are controlled by the set of LEDs at the SOUTH WEST
corner, as shown below:
Vehicles coming from NORTH can
go left (i.e to EAST) if SOUTH LEFT LED is ON
go right (i.e to WEST) if SOUTH RIGHT LED is ON
go straight (i.e to SOUTH) if SOUTH STRAIGHT LED is ON
Further, the above movements are followed only if SOUTH RED LED is OFF. If SOUTH RED LED
is ON , no movement is allowed for vehicles from north. Pedestrian crossing on SOUTH is allowed
when SOUTH PEDESTRIAN is green and disallowed when it is red. It is obvious that, logically
some combinations can not be allowed. For example, SOUTH RED = OFF, SOUTH STRAIGHT =
ON and SOUTH PEDESTRIAN = GREEN is not allowed (vehicles are allowed to go from NORTH
to SOUTH and pedestrians are allowed to cross on SOUTH). SOUTH AMBER can be ON to indicate
that SOUTH RED is about to change its status from OFF to ON.
The movement of vehicles and pedestrians on the roads can be controlled in a similar way.
As already noted, user can assign a different interpretation if desired. However, the sample programs
presented in the next section are based on the above simple interpretation.
EXAMPLE:
Determine port values for the following traffic situation:
Vehicles from WEST are allowed to go NORTH or EAST.
Vehicles from EAST are allowed to go WEST.
Pedestrian crossing is allowed on SOUTH.
No other vehicle movement /pedestrian crossings are allowed.
Now, as per the above interpretation, the status of the LEDs should be as shown below:
From the correspondence already between the port lines and LEDs, we can now determine the logic
values for each port line. For example, PA0 should be Logic LOW as SOUTH LEFT RED is OFF.
Determining the values of the other port lines in similar fashion, we can arrive at the following port
values:
PA=18H PB=08H PC=B5H
User can work out the port values for other situations in a similar way.
3.0 INSTALLATION
The interface is housed in a plastic enclosure which has a locking mechanism. To open the cover,
push in the locking mechanism with a finger and lift the cover to open.
The interface module has a 26-pin connector at one edge of the card. This is used for connecting the
interface to the trainer with a flat cable connector set. The +5V DC power required by this
interface is drawn from the trainer via the flat cable connector set.
Table 3-1 shows the connector on various trainers to which this interface can be connected. Some
trainers have two connectors and either may be used for connecting this interface. The
demonstration programs presented in this manual assumes that the interface is connected to
connectors shown in column A. If the connector shown in column B is used, then user has to
change the port addresses appropriately. User may refer to the component layout diagrams of
respective ESA trainers to locate the connectors mentioned here.
TABLE-3.1
MICROPROCESSOR A B
TRAINER
MPS85-3 J2 J1
ESA85-2 J2 J1
ESA-80 J2 J1
ESA-65 P4
ESA-68K P3 P4
ESA 68K-2 J2 J1
ESA 68-2 J1 J6
ESA 196 J1 J2
ESA-31 J2 J1
ESA-51 J10 J7
ESA-51E J5 J3
ESA-86/88-2 J4 J5
ESA-86/88-3 J8 J9
ESA-86/88E J4 J6
Example 1:
(Movements other than those listed are not allowed in a given situation)
Vehicles from SOUTH can go NORTH, EAST and WEST.
Vehicles from WEST can go NORTH,SOUTH and EAST.
Vehicles from NORTH can go SOUTH, WEST and EAST.
Vehicles from EAST can go WEST, NORTH and SOUTH.
Pedestrians can cross on all roads.
The system stays in one state until user types a specific key as explained in the example programs.
Then it moves into the next state. After the last state, the system again moves to the first state.
AMBER LED is set ON and then OFF (after suitable delay), at the appropriate direction when the
corresponding red LED changes from OFF to ON state.
Example 2:
(Movements other than those listed are not allowed in a given situation)
Vehicles from SOUTH can go NORTH, EAST and WEST
Vehicles from WEST can go NORTH
Vehicles from NORTH can go SOUTH
Pedestrians can cross on EAST.
No vehicle movement
Pedestrians can cross on all four roads
The system moves from one state to another state after fixed time delay. The state transition is
indicated by turning ON all the AMBER LEDs and all pedestrian red LEDs for a fixed duration. The
sequence of the above states are repeated again and again. Hence you must press the RESET key to
allow the monitor program to regain control from this program.
1039 68 PLA
103A AA TAX ;Restore count
103B B9 72 10 LDA PORTS,Y ;Sequence for turning
;ON AMBER
103E 8D 40 A0 STA 0A040H
1041 C8 INY
1042 B9 72 10 LDA PORTS,Y
1045 8D 41 A0 STA 0A041H
1048 C8 INY
1049 B9 72 10 LDA PORTS,Y
104C 8D 42 A0 STA 0A042H
104F C8 INY
1050 20 59 10 JSR DELAY ;AMBER ON period
1053 CA DEX ;All states over?
1054 D0 B3 BNE NEXTST ;No. Next state
1056 4C 05 10 JMP AGAIN ;Repeat the whole
;sequence
1059 A9 FF DELAY:LDA #0FFH
105B 8D 70 10 STA FLAG1
105E A9 00 DLY5: LDA #00H
1060 8D 71 10 STA FLAG2
1063 EA DLY10: NOP
1064 EA NOP
1065 CE 71 10 DEC FLAG2
1068 D0 F9 BNE DLY10 ;Inner loop
106A CE 70 10 DEC FLAG1
106D D0 EF BNE DLY5 ;Outer loop
106F 60 RTS
1070 FLAG1:DS 1
1071 FLAG2:DS 1
1072 88 83 F2 PORTS: DB 88H,83H,0F2H ;State 1
1075 88 87 F2 DB 88H,87H,0F2H ;AMBER ON
1078 38 88 F4 DB 38H,88H,0F4H ;State 2
107B 78 88 F4 DB 78H,88H,0F4H ;AMBER ON
107E 83 88 F8 DB 83H,88H,0F8H ;State 3
1081 87 88 F8 DB 87H,88H,0F8H ;AMBER ON
1084 88 38 F1 DB 88H,38H,0F1H ;State 4
1087 88 78 F1 DB 88H,78H,0F1H ;AMBER ON
108A 88 88 00 DB 88H,88H,00H ;State 5
108D 88 88 00 DB 88H,88H,00H ;DUMMY
ORG 8000H
PORT_A EQU E800H
PORT_B EQU E801H
PORT_C EQU E802H
CWR EQU E803H
ENTER THE DATA MENTIONED BELOW FROM 0000 TO 001E IN DATA MEMORY.
;state.
8036 E7 CF FF LJMP AGAIN ;Repeat the
;entire
;sequence.
8039 A1 0A 00 62 DELAY: LD REG6,#0AH
803D A1 FF FF 60 DEL50: LD REG5,#0FFFFH ;Delay
8041 05 60 DEL10: DEC REG5 ;routine.
8043 89 00 00 60 CMP REG5,#00H
8047 D7 F8 JNE DEL10
8049 05 62 DEC REG6
804B 89 00 00 62 CMP REG6,#00H
804F D7 EC JNE DEL50
8051 F0 RET
8052 10 81 7A PORTS: DCB 10h,81h,07Ah ; State 1.
8055 44 44 F0 DCB 44H,44H,0F0H ; All Ambers ON.
8058 08 11 E5 DCB 08H,11H,0E5H ; State 2.
805B 44 44 F0 DCB 44H,44H,0F0H ; All Ambers ON.
805E 81 10 DA DCB 81H,10H,0DAH ; State 3.
8061 44 44 F0 DCB 44H,44H,0F0H ; All Ambers ON.
8064 11 08 B5 DCB 11H,08H,0B5H ; State 4.
8067 44 44 F0 DCB 44H,44H,0F0H ; All Ambers ON.
806A 88 88 00 DCB 88H,88H,00H ; State 5.
806D 44 44 F0 DCB 44H,44H,0F0H ; Dummy.
8070 00 TEND: DCB 00H
ORG 400400H
PORTA EQU 800011H
PORTB EQU 800013H
PORTC EQU 800019H
PA_CT EQU 80000DH
PA_DI EQU 800005H
PB_CT EQU 80000FH
PB_DI EQU 800007H
PC_DI EQU 800009H
0013
40043E 1219 MOVE.B (A1)+,D1
400440 13C1 0080 MOVE.B D1,PORTC ;Port C value
0019
400446 610A BSR.S DELAY
400448 B3FC 0040 CMPA.L #TEND,A1 ;End of PORT
0490 ;values?
40044E 66DE BNE.S NEXTST ;No, Next state.
400450 60D6 BRA.S AGAIN ;Repeat the
;whole sequence.
400452 3A3C FFFF DELAY:MOVE.W #$FFFFH,D5 ;Delay Routine.
400456 4E71 DLY10:NOP
400458 4E71 NOP
40045A 4E71 NOP
40045C 4E71 NOP
40045E 4E71 NOP
400460 4E71 NOP
400462 4E71 NOP
400464 4E71 NOP
400466 4E71 NOP
400468 4E71 NOP
40046A 4E71 NOP
40046C 51CD FFE8 DBF D5,DLY10
400470 4E75 RTS
400472 10 81 7A PORTS:DB 10H,81H,7AH ;State1
400475 44 44 F0 DB 44H,44H,F0H ;Ambers ON
400478 08 11 E5 DB 08H,11H,E5H ;State2
40047B 44 44 F0 DB 44H,44H,F0H ;Amber ON
40047E 81 10 DA DB 81H,10H,DAH ;State3
400481 44 44 F0 DB 44H,44H,F0H ;Amber ON
400484 11 08 B5 DB 11H,08H,B5H ;State4
400487 44 44 F0 DB 44H,44H,F0H ;Amber ON
40048A 88 88 00 DB 88H,88H,00H ;State 5
40048D 44 44 F0 DB 44H,44H,F0H ;Amber ON
400490 00 TEND:DB 00H ;Dummy.
8047 1C DEC R4
8048 BC 00 F6 CJNE R4,#00,LOOP2
804B 1A DEC R2
804C BA 00 F0 CJNE R2,#00,LOOP3
804F 22 RET
ENTER THE BELOW GIVEN DATA FROM 0000 TO 001E AT DATA MEMORY
ENTER THE BELOW GIVEN DATA FROM 0000 TO 001E AT DATA MEMORY