Simple Counter on PSOC 4 | Cypress Semiconductor
Simple Counter on PSOC 4
Hello - trying to count the number of button pushes on the -042 pioneer kit. What I want to do is simply count the number of times a user pushes the button (I've implemented debouncing) and the Basic Counter seems like it will work - however, it does not have an API.
What is the correct device to use? The Counter [v2.40] should work but its implementation is not clear as the UDB is shaded in PSOC 4 and reading through the datasheet it is UDB implementation on PSOC 4.
The simplest way would be to use a 20Hz clock and then when the button (SW2) is momentarily pressed, the counter would increment on the edge of the clock - it can be free-running and automatically roll over as I'm only interested in two states of the button pushed. When I implement this and single step through the f/w the Counter_ReadCounter() register does not decrement.
I have been stuck here for a bit and while I don't want somebody to debug my code, I am afraid I am missing a key piece of information.
Any insight is appreciated on implementing this.