ECE473 Lab4: Purpose: *Using interrupts with counter/timer 0 *Learn how to use SPI. *Learn how to read the incremental encoders. Overview: The SPI interface will be used to capture and then shift the state of the digital encoders serially to the uC while also providing data to the bar graph display and LEDs. Project Specifications: *The quadrature encoder and bar graph boards will be connected to the uC board. *The buttons we used before will not be used this time but will be left connected. *After reset, turning either encoder will increment or decrement, by one, a count displayed on the LED display. Turning either encoder clockwise will increase the count. With either encoder turned counterclockwise, the count will decrease. *The count will roll over at 256 but if decremented beyond zero, the next count will be 255. *Use the bar graph display to graphically show how large the count is by use of a thermometer code. For example, for increasing values, for every 32 steps upwards, the bar graph will illuminate one bar. The same behavior will follow for decrementing values. Before Lab: *Determine the correct connection for the SPI interface for reading the encoder and displaying to the bar graph. You will need to become familiar with the operation of both the 74HC165 and 74HC595 to use them correctly. Draw that part of your schematic out _before_ you wire things up. *Connection information will be given in the skeleton code. Software: *Write out pseudocode of your software (suggested). *Reuse code from previous labs as appropriate. Testing: *Make sure the encoder increments and decrements as expected. It should be able to respond to a reasonably rapid rotation of the encoder shaft. *There should be no skipping or jumping of the count. *Bar graph should indicate up and down changes at counts of 1,2,4,8,16,32,64,128,256. Turn into COE TEACH: A single file submitted with the linux tar command that contains: (1) a _COPY_ of your high-quality schematic diagram (.pdf) AND (2) a copy of your lab4.c code Reminder: tar -cvfz lab4.tar.gz schematic.pdf lab4.c Will create a single file "lab4.tar.gz" from the files after compression by gzip. In addition, you will demonstrate board functionality and code either in person in the lab. Grading: *Circuit function +80% (demo system in lab) -performs as expected,switches debouncing cleanly -if count "jumps" -deduct 10% -dim display/flickers -deduct 5% -other abnormality -deduct 5% (for each distinct problem) *Documentation +20% -complete, neat, correct -code well written, commented -incomplete/wrong schematic -deduct 15% -sloppy documentation -deduct 15% -poorly commented code -deduct 15% Lab weighting = 0.15