Make north-south light green and east-west light red for 10


Question: It is desired to implement a traffic light controller using the PIC18F4321 as follows:

Step 1: Make North-South light Green and East-West light Red for 10 seconds. Check to see if any waiting car is trying to go from east to west and vice versa. If there is a waiting car, go to step 2; otherwise, repeat this step.

Step 2: Make North-South light Yellow and East-West light Red for 2 seconds, and go to Step 3

Step 3: Make North-South light Red and East-West light Green for 5 seconds, and then go to Step 4.

Step 4: Make North-South light Red, and East-West light Yellow for 2 seconds, and then go to Step 1.

Also, include provision for an emergency input. When this input is asserted, a flashing RED light in both directions will be activated.

Write a C program for the above state machine using Timer0 in 16-bit mode. Draw an ASM chart showing all inputs and outputs.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Make north-south light green and east-west light red for 10
Reference No:- TGS02271463

Expected delivery within 24 Hours