Sale!

Lab 2 – Traffic Light Controller (Simple)

Original price was: $35.00.Current price is: $30.00.

Category:
Rate this product

CECS 346 Lab 2 – Traffic Light Controller (Simple)
Preparation:
You will need a LaunchPad, two push buttons or switches, two 10kΩ resistors, three color LEDs:
(ideally) red, yellow, and green, and three resistors for the LEDs (between 330Ω to 1kΩ).
Book Reading: Textbook Sections 2.7, 4.2
Starter project: CECS346_Lab2-TrafficLightSimple (or start from Labware/Lab10_TrafficLight if
there are issues)
Purpose:
Lab 2 is our first lab requiring you to build circuits on the breadboard and connect them to the
LaunchPad. The purpose of this lab is to learn how to interface a switch and an LED. You will
perform explicit measurements on the circuits to verify they are operational and to improve
your understanding of how they work.
System Requirements:
In this lab, you will build two switch interface that implement positive logic, and you will build
three LED interface that implement positive logic. You will attach this switch and LED to your
breadboard, and interface them to your TM4C123.
Configuration:
• Port A will be used for the two switches labeled west (PA2) and south (PA3),
representing the sensors in the street detecting traffic traveling west and south
respectively.
• Port E will be used to control 3 LEDs: red (PE2), yellow (PE1), green (PE0) representing
the traffic light for north/south traffic.
• The three LEDs should be aligned in the following order: red, green, and yellow.
Functionality:
The system implements a traffic light for traffic flowing one way in an intersection.
1) The system starts with the red LED on, the other two LEDs off, allowing traffic to flow north
to south.
2) Wait about 1 second in main loop (using a delay for loop in a function like in the last lab)
3) Check if any of the following conditions are true in a way that only checks one condition per
loop (eg if…else if…):
a. If south is enabled and red LED is on, then red LED turns off and green LED turns on.
b. If west is enabled and green LED is on, then green LED turns off and yellow LED turns on.
c. C
4) Repeat steps 2 to 3.
Based on the above logic, the lights should continuously cycle red, green, yellow if both
switches are enabled.
The starter project Labware/Lab10_TrafficLight provides the following simulation interface to
two sets of color LEDs and three switches. See Figure 1. We only need three color LEDs and two
push buttons in this lab. To use the simulation interface provided in the starter lab, you use the
LEDs connected to port E and two switches connected to port A to as described in System
Requirements above.
Figure 1. Starter project Labware/Lab10_TrafficLight simulation interface.
Note: when Debug your program in the starter project, you may get the following error
messages. You can ignore these messages. They won’t affect your simulation and running
code on your board.
Error: attempt to change CR while locked. You should unlock first
Error: attempt to change CR while locked. You should unlock first
Procedure:
1. Design and implement your software, simulate it with Keil uVision.
2. Download your program to Launchpad and test it on board.
Deliverable:
1) Demonstrate your lab
a. in simulator
b. on board
2) Submit a lab report (eg Word Document) to the Beachboard Dropbox containing:
a. Class name, lab number and name, your name
b. A picture of your hardware system
c. Software source code: The .c file

Reviews

There are no reviews yet.

Be the first to review “Lab 2 – Traffic Light Controller (Simple)”

Your email address will not be published. Required fields are marked *

Scroll to Top