- Parent Category: Programming Assignments' Solutions
We Helped With This C++ Programming Assignment: Have A Similar One?
|More Info||C++ Homework Help|
EE/CPE 3280 Assignment 4 – Beat Meter
Program: 100 Points
The Beat Meter program tests your ability to keep a beat!
The Beat Meter sets up a light to flash once per second, while the user tries to match the beat using a joystick button. The meter reports how close the user’s button press is to the beginning on the flash in two ways:
(1) A display of the number of milliseconds ahead (-) or behind (+) the user’s button press is.
(2) A graphical display of this value using a “speedometer” type display
1. LED. An LED shall flash with a period of 1000 ms and a duty cycle of 10%. The “on” time of the duty cycle shall occur at the beginning of the period.
2. Button response. The Beat Meter shall measure the time between the beginning of the LED’s on time and the time that the user presses the chosen joystick button. The measurement shall range between -500 ms and +500 ms.
3. Time display. The Beat Meter shall display the time measurement described in (2) on the LCD screen.
4. Graphical display. The Beat Meter shall display the current measurement by drawing a line from a central point at an angle corresponding linearly to the measurement. 0ms shall be shown by a line straight up, -500 ms by a line straight left, and +500 ms by a line straight right.
5. Flicker. The display shall not appear to flicker.
The Beat meter must be created using timer/counter/PWM modules. Specifically:
1. A PWM that creates the 1 second pulses. The start/end of the cycle will trigger an interrupt that resets to zero a timer (below).
2. A Timer that begins counting when the light is turned on, and captures the time of the button press. A timer ISR will update the beat measurement when the button is pressed.
3. A main program that displays the current measurement, both numerically and graphically.
1. Check the datasheets in PSoC creator for the APIs for the TCPWMs. You’ll need to call functions that read or change the timer/counter/compare values.
2. The timer/PWM interrupts have a separate function to clear the interrupt. This function must be called during the ISR for each one (or possibly in main) or no more interrupts will occur. The syntax is as follows (replace <TimerName> with the name of the appropriate TCPWM):
Terminal Count Interrupts: <TimerName>_ClearInterrupt(<TimerName>_INTR_MASK_TC);
For Capture/Compare Interrupts: <TimerName>_ClearInterrupt(<TimerName>_INTR_MASK_CC_MATCH);
3. To compute the negative times (button pressed before the light) consider this: An early button press is really just an especially late button press on the previous cycle. That is, any capture measurements that come in later than halfway through the LED flash cycle should be considered early on the next one.
TO TURN IN Through Canvas
1. main.c, all ISR .c files and any additional c files that you modified
2. Top-level schematic in PDF format (use print to PDF).
3. Demonstrate your program to the instructor at the beginning of class on the due date.