Come to class as there may be corrections, changes and additions. Substantial accumulating late penalty.
- Create an assembly project using emu8086
- Name the file Traffic.asm
- Hand in file only to D2L by deadline
- See tutorial
Interface to the following devices:
traffic lights stepper motor led[optional]
This code will "start" devices (put once at the top of your code)
#start=traffic_lights.exe# port 4
#start=stepper_motor.exe# port 7
#start=led_display.exe# port 199
'in' & 'out' instructions communicate with devices on their assigned ports
Make your code procedural. Create procedures for operations. Procedures can call procedures.
PLAN your architecture.
NtoS PROC StepperCW PROC Led PROC
; code ; code ; code
ret ; return to caller ret ret
NtoS ENDP StepperCW ENDP Led ENDP
Only let ONE direction of traffic through at a time. (There are 4 directions)
Change direction after 1 full rotation of the stepper motor
Traffic lights should change in a clockwise fashion (green to red to green)
BONUS: Add a short (1/2 turn) amber to each cycle
There are 12 lights numbered 0-B: 4 red, 4 amber, 4 green: 1 turns specified light on, 0 off.
Make motor turn clockwise 1 rotation as the traffic passes from north to south
Make motor turn counter-clockwise 1 rotation as the traffic passes from east to west
Make motor turn clockwise 1 rotation as the traffic passes from south to north
Make motor turn counter-clockwise 1 rotation as the traffic passes from west to east
Must wait for stepper to SET bit 7 before it can receive command.
The ONEs attract the magnet, so 1 attracts the closest cog,
but 1 1 makes the cog stop between. See documentation.
Clockwise rotation: (use an array and pointer) |
clockwise db 0000_0110b
oneEighth = $ ; (11.25 degrees x 4 = 45 = 1/8) x 8 = one full rotation
Count and display the number of clockwise rotations of the stepper motor.