Instructions

There is only one deliverable for this assignment. For full credit, complete the assignment using only assembly. For half credit on the entire assignment, use C. It may be wise to implement in C first, then rewrite in assembly.

Deliverable

Connect two buttons, a red LED and a green LED to your Pico. If you do not have these colors, substitute two different colors or borrow from the instructor or the stock room.

One button (counter) is used to set the number of times the green LED should blink, the other (record) is to enter record mode. When the record button is pressed, the red LED should turn on. The Pico should count the number of times the counter button is pressed until the record button is pressed again. The red LED should be turned off when not in record mode. When not in record mode, the pico should be in blink mode: the green LED should blink (suggestion: 100ms on, 100ms off) the number of times counted in the most recent record mode, pause for one second, then repeat the count. When in blink mode, the system should check for a record button press when possible but does not have to respond instantaneously. It should respond within one blink cycle. There does not need to be an interrupt for the record button, although using an interrupt would provide a more elegant solution.

Example sequence:

  1. Starts in blink mode.
  2. Count initializes to 0, so no blinks.
  3. Record button pressed. Enters record mode.
  4. Red LED turns on.
  5. Counter button pressed 5 times.
  6. Record button pressed. Enters blink mode.
  7. Red LED turns off.
  8. Green LED blinks 5 times.
  9. 1 second pause.
  10. Green LED blinks 5 times.
  11. Record button pressed. Enters record mode.
  12. Red LED turns on.
  13. …and so on

Turn in to Blackboard

  • A zip file with the deliverable code.

Rubric

Code

  • Solution turned in using C or assembly (5 points)
  • Only assembly used in solution (5 points)

Demo (HALF CREDIT FOR C IMPLEMENTATION)

  • Pico controls two LEDs (4 points)
  • Pico takes input from two buttons (4 points)
  • Pico counts button presses (2 points)
  • Red LED on while counting button presses (2 points)
  • Green LED blinks after counting finished (4 points)
  • Green LED blinks the number of times button is pressed (4 points)