C Programming for Embedded Systems
Assignments
Spring 2010
Write a program to implement a "click counter". The program should count the number of times that you press the pushbutton on your PICKit board and display that number in binary using the LEDs on the board.
The system should initially display a 0 on the LEDs by switching all LEDs off. You enter new numbers by clicking the pushbutton. The system detects that you are starting to enter a new number when you first press the pushbutton and it detects that you are done entering a number when you have not pressed the push button for at least one second. One you are done entering a number, the system should display the new number in binary on the LEDs. The number should remain on the LEDs until you have completed entering a new number using the pushbutton.
If it makes your implementation simpler, you can assume that no number greater than 10 will ever be entered.
Demonstrate the assignment for me in class and submit your code to me through email at harris@ics.uci.edu.
Make a program which flashes LED D0 at a rate which is controlled by the potentiometer on your board. When the potentiometer knob is turned all the way to the right, the LED should flash at its slowest rate, approximately 1 second on and 1 second off. When the knob is turned all the way to the left, the LED should flash at its highest rate. At the highest flash rate, the flashing should not be visible to the human eye.
Demonstrate the assignment for me in class and submit your code to me through email at harris@ics.uci.edu.
Rewrite the "click counter" program from homework 1, but implement it so that it invokes an interrupt each time the button is clicked.
Demonstrate the assignment for me in class and submit your code to me through email at harris@ics.uci.edu.