{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

commonproject - Physics 335 Spring Quarter 2011 The Common...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Physics 335, Spring Quarter 2011 The Common Project for the lab 17-19 May A 2-Person Count-Down Game INTRODUCTION Once you can communicate with and program a microcontroller, you are only limited by your time and imagination. Simple controllers like the PIC are limited by their spare instruction set, small program and data memory and restricted range of peripherals. However, even this small PIC controller is very useful. It is used, for example, for lighting controls, relay drivers, motor controllers, and consumer electronics. This lab is meant to demonstrate some capabilities of the PIC processor and get you more used to PIC programming. In this lab, youʼll assemble the hardware and develop a computer program that performs the following task: A “COUNT-DOWN” 2-PERSON GAME You have a job: Youʼre the chief engineer for a game show. The host wants you to design and build a quiz reaction timer that works as follows. The game has two players. Each player has a button and an LED. After the host resets the game, the two playersʼ LEDs are off and a 9second countdown shows on a 7-segment LED display. After the last count, thereʼs a final 1-second delay. At the end of the final delay, the first player to push their button has their LED solidly lit, and the other playerʼs LED remains unlit. You could also have something displayed on the 7-segment display to flag the winner. Obviously, a second player pushing their button after the first wonʼt win and the lights wonʼt change. Now, if a player pushes their button before the count is over, then that playerʼs LED flashes to indicate a fault, and the other playerʼs LED is solidly on—a win by default. There are many ways to realize this game with our microcontroller hardware and software. You might want to use the following parts from your parts-bin to build this game. PIC microcontroller Resistors 7-segment LED display (no BDC-t0-7-segment decoder) LEDs Switches Here is how your software may could be organized: Arrange hardware and software for the game reset/start Have a counter in the PIC count down from 9 Turn that counter value into LED segments. If thereʼs a fault (cheat), indicate this on the LEDs. Otherwise, wait to see whoʼs first and indicate this on the LEDs. POTENTIALLY USEFUL TIDBITS Be sure to initialize all registers, counters, variables, ports, etc. Youʼll need to convert the PIC counter to a LED segment display. Keep in mind that you can represent a segment as on or off by a binary 1 or 0. Hence the 7 LED segments can be represented by 7 binary ones or zeros. For example, if you want all segments lit or off, you send Hʼ00ʼ or HʼFFʼ to the output port. The conversion of the counter value to the 7-segment output is a look-up table; as I mentioned in class, you might therefore find the DT assembly directive or RETLW instructions of use. HOW THIS IS GRADED You and your lab partner need to demonstrate operability of your common project to your TA. Youʼll likely need to consult data sheets for the processor and perhaps the assembler as well. You are responsible for debugging your code, so code carefully and have a code-development plan. You and your lab partner submit a common lab writeup. For your writeup, include a circuit diagram and brief description of how your circuit and software works. Also include a printout of your assembly code. The TA will quickly look at this printout and see if itʼs a mess, or understandable on its own. The TA may grant an incentive of 10% for particularly tidy and readable code, or subtract 10% for particularly obscure and unreadable code. Full credit is given only to fully functional circuits. Finally, you should have the circuit drawn and the software blocked out before you come into lab. Otherwise, youʼre unlikely to finish. [ver 10may11 11:45] ...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online