Você está na página 1de 1

EC280 Digital System Design

LAB VII
Sequential circuit design
Traffic light controller for NITK
Model a traffic light controller for NITK using
VHDL and implement on FPGA. The National
highway NH66 is intersected by the NITK
road as shown in Figure. Detectors are
placed along the NITK road to raise the signal
C
C as long as a vehicle is waiting to cross the
highway. The traffic light controller should
operate as follows: as long as no vehicle is
detected on the NITK road the lights should
C
remain green in the highway direction. If a
vehicle is detected on the NITK road, the
highway lights should change from green to
yellow to red, allowing the NITK road lights
to become green. The NITK road lights stay
green only as long as a vehicle is detected on the NITK road and never longer than a set
interval to allow the traffic to flow on the highway. If these conditions are met the NITK road
lights change from green to yellow to red, allowing the highway lights to return to green.
Even if vehicles are waiting to cross the highway, the highway lights should remain green for
a set interval. You may assume that there is an external timer that, once set via the control
signal ST (set timer) will assert the signal TS after a short time interval has expired (used for
timing yellow lights), TLH and TLF after a longer time interval (for green lights, highway and
NITK road respectively). The timer is automatically reset when ST is asserted. Use the two
tricolor LEDS on the Nexys4 kit as the traffic lights.
Debounce pushbuttons
Using mechanical switches for a user interface is a ubiquitous practice. However, when
these switches are actuated, the contacts often rebound, or bounce, off one another before
settling into a stable state and this produces unexpected behaviour in digital circuits.
Several methods exist to deal with this temporary ambiguity, using either hardware or
software. A sample vhdl code for a switch debounce circuit for the button switches is given
debounce.vhd.
Tricolor LEDs
The Nexys4 board has two tricolor LEDs each of which has three internal LEDs red, green and blue.
Read Section 9.2 of Nexys4 FPGA Board reference manual first. Note that to turn ON internal LED you
need to put logic 1. If R=B=1 and G=0 the LED emits purple color. It is recommended to use a Pulse
width modulation (PWM when driving the tricolor LEDs. A sample vhdl code for PWM is given
pwm.vhd

Dept. of E&C, NITK Surathkal

16

Você também pode gostar