Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

At the intersection, Highway 120 is situated North and South while Miller Parkwa

ID: 665594 • Letter: A

Question

At the intersection, Highway 120 is situated North and South while Miller Parkway is
situated East and West. There is a sensor which detects the total number of vehicles
at both sides of Miller Parkway headed East or Westbound. There are also two
similar sensors for left turn lanes, one for West-North traffic & East-South traffic, and
one for South-West traffic & North-East traffic. In addition, there is a train rail-line at
the intersection which travels in parallel to Hwy 120 on the intersection’s West side.
• The default condition for the traffic light system is for the North-South
traffic on Highway 120 to have a green light that lasts at least 10 seconds while
both of its Left Lanes are not green. Also, the East-West traffic light is to
default Red. Highway 120’s North and South light remains green until a
sufficient number of vehicles forces a light change as described in the priority
order scheme described below in detail. Also no trains will be initially present.
• After a total of 2 or more cars approach any opposing left lane, they have
first priority to turn with a green light for 10 seconds iff any opposing
traffic has had their respective green light for its minimum 10 seconds.
Otherwise, the 2 or more cars in left lanes must wait until the 10 seconds have
expired. Be sure to take necessary precautions of correctly setting other lights
to prevent wrecks! Also, remember to be careful with the train situation.
• After a total of 4 or more cars approach either side of Miller Parkway, they
are allowed to proceed with a green light for at least 10 seconds but no more
than 24 seconds if and only if any opposing traffic (including the left lanes if
necessary) has already had their respective green light for its minimum 10
seconds. Otherwise, the 4 or more cars on either side of Miller Parkway must
wait until the 10 seconds have expired. Again, be sure to take necessary
precautions of correctly setting lights to prevent collisions!
• During any green light to red light transition, a respective yellow caution
light should be activated immediately after the green light is turned off and just
before the red light is on. The yellow light is to last for only three (2) seconds.
• Priority review of the light sequence: Highest priority is given to the
default state which is Green for Highway 120 & Red for Miller Parkway with
all Left lanes not green. The next most priority is given to the Miller Parkway
Left Turn lanes followed by a Green light for traffic traveling straight on
Miller Parkway. Before returning to the default state, the Left Lanes for
Highway 120 have priority if a sufficient number of vehicles are waiting to
turn (ie. 2 or more). This priority characterization is quite normal for T-lights.

Inputs: Highway 120 Left Lane Pushbutton Switch (effectively post-debounced)
simulates detecting a vehicle waiting to turn left from Highway 120
disabled and count is reset when t he Hwy 120 left turn light is green
Miller Parkway Left Lane Pushbutton Switch (effectively post-debounced)
simulates detecting a vehicle waiting to turn left from Miller Parkway
disabled and count is reset when the Miller Pwy left turn light is green
Miller Parkway Pushbutton switch (effectively post-debounced)
simulates detecting a vehicle waiting on either side of Miller Parkway
count is reset both when the Miller Parkway light is green and yellow
- Train Toggle switch
simulates a train arriving when in the ON position. While a train is in
the intersection, 2 red LEDs should alternately blink at 1 Hz. (± 10%)


Outputs: - Count Display for the total number of vehicles waiting in Hwy 120 left lanes
- Count Display for the total number of vehicles waiting in Miller Pkwy left lanes
- Count Display for the total number of vehicles at either side of Miller Parkway
- Red, Yellow, and Green LEDs to indicate the East-West Miller Parkway status
- Red, Yellow, and Green LEDs to indicate the North-South Highway 120 status
- Yellow and Green LEDs to indicate the Left Turn Lane status for both Highways

- 2 Red LEDs that are off when no train is present and otherwise blink at 2 Hz


Technology: SSI, MSI, and LSI circuits using solderless prototyping breadboard with PLDs (use
at least one (UnoR3 with arduino coding) and one( GAL22v10 or more complex PLD with vhdl coding).

Explanation / Answer

public static void LightStripSpi()
{
var spi = new SPI(new SPI.Configuration(Cpu.Pin.GPIO_NONE,
false, 0, 0, false, true, 10000, SPI.SPI_module.SPI1));
var colors = new byte[3 * 32];
var zeros = new byte[3 * ((32 + 63) / 64)];

while (true)
{
// all pixels off
for (int i = 0; i < colors.Length; ++i) colors[i] = (byte)(0x80 | 0);
// a progressive yellow/red blend
for (byte i = 0; i < 32; ++i)
{
colors[i * 3 + 1] = 0x80 | 32;
colors[i * 3 + 0] = (byte)(0x80 | (32 - i));
spi.Write(colors);
spi.Write(zeros);
Thread.Sleep(1000 / 32); // march at 32 pixels per second
}
}
}