Question
Write a simple C program to do a true LED toggle using the built-in LED and switch on your PSOC5 dev board. Your program should
Write a simple C program to do a true LED toggle using the built-in LED and switch on your PSOC5 dev board. Your program should poll for the switch to be pressed, and when it is, you should turn the LED on if it was off and vice versa, one toggle per button press, which is going to require some debouncing. To learn how low-level microcontroller programming goes, you will use only memory mapped registers to do so.
-
Connect the circuit as shown in Part 3 - Hitachi LCDs
-
Find the correct addresses for Port3s Drive Mode and Pin State registers in the PSoC5 Registers TRM
-
Your program should configure Port 2[1] to be in drive mode Strong Drive like in the introduction above. Port 3[4] should be configured to be in Resistive Pull-Up or High Impedance Digital mode in a similar fashion, depending on if you have the external resistor or not. Do this using the registers + memory-mapping, NOT THROUGH THE SCHEMATIC WINDOW
-
You program should then poll for the switch on P3[4] of the CY8CKIT-059 (Your dev board) to be pressed
-
When the switch is pressed, you are to toggle the LED on Port 2[1] on if it was off, or off it was on.
-
Your code should be debounced properly so that the LED only toggles once per press
-
If you get confused, you can always go digging in the automatically generated C API to see the code PSoC Creator generates to do the Pin_Write() and Pin_Read() functions.
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