Controlling the traffic lights on the intersection of N Dixie Ave. and E 1st St.
ID: 3704703 • Letter: C
Question
Controlling the traffic lights on the intersection of N Dixie Ave. and E 1st St. [25 Marks] For each direction of these two streets, three lights (green, yellow, and red) are used to control the traffic. Assume that the RGB-LED on the DragonBoard is used to represent the traffic lights on N Dixie Ave., while the LEDs connected to pins 0, 1, and 2 of PORTB are used to represent the green, yellow, and red light on E 1st St., respectively. Based on traffic occurrence, we need to be able to change the duration of the green phases on the intersection. Therefore, your program should read a binary value 'n' from the DIP-switches connected to PTH0~2, and use n as a multiplier for the delays of the green phases, if n is 0, consider it as n 1. Write an assembly program to control the traffic lights on this intersection based on the aforementioned description. Your program should have 6 states and each state should have a different delay as shown in the table. State N Dixie Ave E 1st St. Delay [sec.] 1 Green (RGB green Red (PB2) 2 Yellow (RGB blue) 4 3n Red (RGB red) Red Red Red Red Red Green (PB0) Yellow (PB1) Red 3n The following figure shows an example of the first state in the table where the two directions of N Dixie Ave. are GREEN while the two directions of E 1st St. are REDExplanation / Answer
Please find the below assembly language written in 8086 microprocessor
#start=Traffic.exe#
name "traffic"
mov ax,all_read
out 4,ax
move si,offset situation
next:
mov ax,[si]
out 4,ax
;wait for 5 seconds
mov cx,4Ch
mov dx,4B40h
mov ah,86h
int 15h
add si,2; next situation
cmp si,sit_end
jb next
mov si,offset situation
jmp next
; FEDC-BA98-7654-3210
situation dw 0000_0011_0000_1100b
s1 dw 0000-0110-1001-1010b
s2 dw 0000-1000-0110-0001b
s3 dw 0000-1000-0110-0001b
s4 dw 0000-0100-0100-1001b
sit_end=$
all_red equ 0000_0010_0100_1001b
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.