Electrical Help
ELNC-6007 Intersection Traffic Controller (ITC) Embedded Systems
Intersection Traffic Controller (ITC) Page 1 of 2
Hardware: Use the ITC Schematic posted on Fanshawe Online along with these instructions to create an Intersection Traffic Controller system on your breadboard.
Follow Class conventions. The conventions document is posted for your review and is not a suggestion. All work will conform to the class conventions. Non-conforming work will not be graded nor receive any consideration.
Create a new MPLab project using the C18 tool suite. Name the project ELNC6007(your initials)Lab1, without the brackets.
Create a new source code using the template posted on Fanshawe Online. Download and save the pragmas.h file, posted on Fanshawe Online, to your new project directory.
Lab 1
Two separate Traffic Lights control the flow through an intersection. One set controls North and South traffic while the other controls East and West traffic. Each Traffic Light consists of three LEDs, one red, green and yellow. The Traffic Lights are defined in the schematic as North- South & East-West.
Each direction also has a pedestrian crossing with walk and stop indicators and a cross request pushbutton. The system schematic defines these as NS-Walk, EW-Walk, NS-Stop, EW-Stop, NS & EW. NS is short for North-South, EW is short for East-West.
Operational Characteristics:
1. Initialize the PIC18F45K22
Oscillator to operate at 4 MHz
Port Configuration for the appropriate connections, defined on the schematic
Serial Port 1, on, TX & RX enabled, 9600 baud
Timer0, on, appropriate pre-scaler and pre-set count for a 1 second rollover. o Be prepared to show calculations and define the process of how to set the
count for Timer0.
2. Create a small system variable within main, name this variable “mode”. This variable will contain a mode value that indicates which of the Traffic Lights is active and which state that light is currently executing.
After initialization the program will enter an indefinite loop where the following will execute:
ELNC-6007 Intersection Traffic Controller (ITC) Embedded Systems
Intersection Traffic Controller (ITC) Page 2 of 2
The system will activate each LED in the following sequence based on the current mode value. The table below defines the operation of the system according to the mode value. There are no other mode values, additions or modifications are not permitted.
Mode Traffic Lights Walk Indicators Timing (sec)
North-South East-West NS EW
0 Red Red Stop Stop 5
1 Green Red Walk Stop 10
2 Yellow Red Stop Stop 5
3 Red Red Stop Stop 5
4 Red Green Stop Walk 10
5 Red Yellow Stop Stop 5
3. A scheme for automatic operation of the system based on the mode variable must be determined by each individual student. Use your knowledge of program control and PLAN the program before attempting to develop a solution. Use an array to handle the seconds counting limits. Any other method that yields a functional result will be acceptable as well.
Single Execution Multiple Execution
Known switch for
Unknown if while
4. If a cross request button is pushed, currently active Traffic Light’s Stop (Walk / Stop) Indicator will flash for the remainder of that mode time at an interval of ON for 1 second OFF for 1 second ( 0.5 Hz ), then the mode will switch to the next value.
Example: If mode is at 1 and a cross request is pressed, NS Walk will turn OFF, NS Stop will flash and the next mode value will be 2.
Demonstrate your completed, Tested and Functional system to your Lab Instructor.
The completed exercise is due the week of: Jan 21st, 2019.
Demonstrate the functional operation of your system to your Lab Instructor. Be prepared to offer
rational or answers in response to questions. Failure to answer questions or provide rational will void
demonstration.
Your own original program must be uploaded to the FoL submission box as a .txt file.