May 30, 2017
08:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 30, 2017
08:51 AM
1 Reply
May 30, 2017
09:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
May 30, 2017
09:15 AM
Hope this is of some use to someone else.
1. Add a pin and configure as a digital input with hardware connection.
2. Set drive mode to be resistive pull up.
3. Using the off-chip component catalog, add an SPST switch from the electro-mechanical section and a ground from the power section of the same.
4. Wire the pin to one side of the switch, the ground to the other.
5. Make sure that your 'pin_1' uses P2.2 in the pins tab for the project if you are using the PSOC5LP stick.
6. Generate the application and then you can test the switch is pressed by calling
uint8_t sw_status = SW1_Read();
That's it. You probably want to debounce but that is an exercise for the reader.