Question
Switch handling (push button) Version with Microcontroller (1MHz) The following programs has to be done in C languaje Objectives. - read/write in an input/output port
Switch handling (push button) Version with Microcontroller (1MHz)
The following programs has to be done in C languaje Objectives. - read/write in an input/output port on a real micro. Bounce handling via software You have the following hardware:
Program 1.- make a program that turns on the led on PB1 when the switch connected to PB0 is pressed. The led it should be off when the switch is not pressed. Important: program the pull-up on PB0 to guarantee a Logic 1 when the switch is not pressed. It is recommended to use an if/else accessing the ports at the bit level.
Program 2.- make a program that blinked the led on PB1 at 4 Hz (0.125 sec on and 0.125 sec off) when the switch connected to PB0 is pressed. The led should be off when the switch is not pressed. Important: Program the pull-up on PB0 to ensure a logic 1 when the switch is not depressed. I know recommends blinking the led inside a while() and turning it off outside of this while. Remember that for the retarded you need to include delay.h and the project has to be at 1MHz.
Program 3.- Make a program that uses the switch connected to PB0 to control the on/off of the led. Initially it will be off. If the switch is pressed and released, the LED should turn on and stay that way. if it were to pressing and releasing the led should turn off and stay that way. The switch should be handled properly.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started