Question: Project Name: - _ . SW _ Count _ Up _ Down Description: - This program should increment a binary counter count if pushbutton PB

Project Name:-_. SW_Count_Up_Down
Description:- This program should increment a binary counter "count" if pushbutton PB0 is pressed and decrement the counter if pushbutton PB1 is pressed while SW0 is in the ON position. The value of the binary counter is displayed on PORTB Leds. When SW0 is in the "OFF" position the binary counter is reset (i.e all LEDs on PORTB are turned off) and pushbuttons PB0 and PB1 have no effect (i.e. counter does not increment or decrement). Pushbutton PB0 should also use the debounce function (i.e. get_PB00) used in the previous exercise when reading it's state. You should create a new debounce function for PB1 called "get_PB10".
Instructions:-
1. Create a macro name for the switch SW0:-
E.g.\#define SW0 RA0
2. Create a macro name for ON and \(\mathrm{OFF}:-\)
E.g.\#define ON 1
\#define OFF 0
3. Use the macros listed above in your program.
4. Reuse and incorporate the "get_PB0()" function from the previous exercise. You will also need to incorporate a debounce function for PB1 aswell called "get_PB1()".
5. Create a variable "count" which is incremented everytime pushbutton PB0 is pressed and decremented while PB1 is pressed while SW0 is "ON". The value of count is displayed by the LEDs on PORTB and is reset when SW0 is off. When SW0 is "OFF", pushbutton PB0 and PB1 have no effect on variable "count".
6. Add comments to your code (marks lost for no comments).
7. Ensure all code is properly indented (i.e. marks lost for no indentation).
Inputs:-3(i.e. RA0, RA2, RA3)
Outputs:-8(i.e RB0- RB7)
Project Name: - _ . SW _ Count _ Up _ Down

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!