WEST VIRGINIA UNIVERSITY Department of Computer Science and Electrical Engineering MICROPROCESSOR SYSTEMS LABORATORY FINAL PROJECT CPE 311 Fall 2001 Coliseum intersection Introduction: The purpose of this project is to build a model of an intersection similar to the intersection beside the Coliseum. Red, yellow, and green LED's will be used to represent the traffic lights. The keyboard will be used to simulate car detector sensors. DIP switches will be used to choose such modes of operation as normal and emergency. Additionally, an LCD must be interfaced with the controller system, which will display status messages and state of the car detector sensors. You will use the Octagon SBC and write an assembly language program to control the "intersection" and interact with the inputs and outputs of the system. This project will require that you design the both the software and the hardware for the Octagon to control all of the traffic lights from the limited number of input/output pins available. Project details: The attached figure shows the general description of the traffic light. There are 8 traffic lanes: North-South (NS), South-North (SN), East-West (EW), West-East (WE), North-South Left Turn (NSL), South-North Left Turn (SNL), East-West Left Turn (EWL) and West-East Left Turn (WEL). Each lane has its own traffic sensor (a device that detects presence of a car). You should use the keyboard to represent the binary output from the sensors (1 – there is a car, 0 – no car). Each sensor should be assigned its own key, the state of the sensor should be toggled by pressing that key. You must also include a set of DIP switches that will specify the mode of operations. DIP switch 1 sets the normal mode of operation. DIP switch 2 sets emergency NS mode of operation (flashing yellow on N and S lanes, flashing red on E and W lanes). DIP switch 3 sets emergency EW mode of operation (flashing yellow on E and W lanes, flashing red on N and S lanes). Any invalid combination of the switches should turn on the fail-safe mode (all lights blinking red). In the normal mode, the operation of the traffic light is very straightforward, you may use your observations of the real intersection and make reasonable modifications in the design (confirm with your instructor before making any change and document the changes in the report!). The goal is to optimize traffic flow through the intersection: - You may open either NS and SN lanes or EW and WE lanes together - You may open either NSL and SNL or EWL and WEL lanes together - Decisions about opening the lanes should be based on the values from the traffic sensors - You may open NS and NSL lanes together if SN and SNL have no cars (the same is true for the rest of the directions) - The minimum time a light can be on is 10sec (except yellow – 5sec) Finally, you have to reflect the status of the intersection on the LCD. The top line of the LCD should contain the status: normal, emergency NS/EW or fail-safe. The bottom line should show the open lanes by the abbreviations. Design problems: - - - The SBC has 24 input/output lines. You must interface 8 lines to the LCD, 3 lines for the DIP switches and 20 LEDs for the traffic lights. You will need to design additional hardware that will let you operate only with the available lines. Modularization of the program. Implementing a large project in just one routine is very complex. You should split the project into a set of subroutines that can be independently designed and debugged. Control algorithm. Before the control program can be written, you must have a clear understanding of how it will work. Keeping track of time. Report: After successful demonstration of your final project your lab report should contain: - General description of your program - Block-diagram of the control algorithm - Circuit diagram - Fully commented source code Grading: Each part of the assignment has its weight, based on the progress in the design: 1. 2. 3. 4. 5. 6. Hardware interfacing (10pts) Working dumb traffic light in normal mode (no sensors, switches, etc.) (20pts) Working traffic sensors (smart traffic light) (20pts) Working emergency modes switches including fail-safe (20pts) Working LCD output (20pts) User interface (10pts) The credit is given only for the parts of the project that work and properly interact with other parts. The assignment will be graded based on the following criteria, applied individually to each part of the assignment: Grading table for parts 1-6 (each part is graded separately). Weight 35% A Excellent Comments on the source code 35% Documentation and Report 30% Clear comments explaining logic structure of the program and meaning of each important instruction. Clear, excellent organization, well documented, and neat. , Clearly explains the algorithms and implementation details. Hardware and circuit diagram or source code Correct circuit diagram with all necessary calculations. Correct source code with no hidden errors. C Average D Fair F Poor Incomplete but correct circuit diagram. Minor errors in the code (that appear only under certain conditions, without creating a dangerous situation of the intersection) Good comments but not always clear B Good No more that one major error in the circuit diagram or assembly code. (The project must work, but the functionality is different from the one specified in the assigment. The error must not create a dangerous situation on the intersection) Misleading comments. Comments that do not explain how the program functions. More that one major error. An error that creates a safety hazard. Not working. Comments do exist in the code. No comments or excessively poor comments Good organization but not always clear that writer understands the solution. Minor details are missing. OK organization, documentation somewhat confused. Gaps in description of algorithms and implementation. Poorly organized, hand written, poorly put together. Poor, patchy descriptions. No organization. No descriptions. User interface grading table (part 8) User interface A The hardware assembly is neat and easy to observe and understand. The software interface is clear and understandable, with proper instructions displayed on the screen. B Not so clear, partially missing operating instructions or somewhat troublesome hardware. C The user have to guess what this LED shows or what that button does (but it works). D Partially working user interface. F Nothing to show. N S G Y R S GY R Y G S W GY S S G Y R S GY S S R G R G GY S S Traffic light (Red, Yellow or Green) Traffic Sensor Pedestrian crossing switch Figure 1. The intersection R Y G S E