Here is my version of the quadrature decoder with a button switch custom component (QudDec_SW), which was designed for interfacing of rotary shaft encoders to PSoC4 and PSoC5. It has been created out of necessity to save hardware resources in projects with limited or exhausted UDB/PLD space. The stock PSoC5 QuadDec component with hardware debouncer are consuming three Datapath cells per single encoder, which is too much for a device which remains idle for most of the time.
The QuadDec_SW component is implemented entirely in software, without using any UDB resources. It is sufficient for hand-operated rotary shaft encoders for non-critical operations such as scrolling menu or updating parameters.
The QuadDec_SW component has several options
Returns position and direction of rotation.
Optional 8-bit, 16-bit, 32-bit, single or double position range.
Optional button switch with debouncing.
Optional increment step size.
Optional range limits.
Uses interrupt or polling technique.
Attached archive contains component library, several demo projects for PSoC5 and PSoC4, a component datasheet, Application Note and algorithm description paper. Please read installation instructions in the readme.txt. Since the Community Components forum is no longer exists, it is being posted here, PSoC5 forum, as the most relevant place to be.
The component provided as-is, no liabilities. It is free to use and modify.
YouTube demo: using QuadDec_SW with DDS24 signal generator
YouTube demo: using QuadDec_SW for PLL tune-up
P.S. In case if only buttons events (w/debouncing) are needed, another simple component is available (ButtonSw32)
Message was edited by: odissey1 Scroll down for v0.1 of the component.