- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I have a problem getting the TCPWM quadrature detector to work. it's not counting !
I have used a quadrature detector in the past, UDB based and the app worked without any problems, only after replacing it with a more resource-smart alternative I cannot seem to make it work.
The automatically generated API within psoc creator does look different, but I only require the Start() and readCounter() calls...
1. the TCPWM based solution does not count, the read results always in 0... what am I doing wrong?
2. Asuming I can make it work with other (more) API calls....Why does a simple replacement of the detector implementation
requires me to change the API anyway.... apart from the namechange of the readCounter method (GetCounter()) it simple
should work, that's the promise of a good API, right?
the attachment shows the schematic, inputs (p1[0], p1[1]) -> glitch filter (4us) -> TCPWM QD (x1, A+B=level, no interrupt)
QuadDec_2_Start();
CyGlobalIntEnable;
for(;;)
{
sprintf(uart_tx_buffer, "%d", (uint16) QuadDec_2_ReadCounter() );
txstring(uart_tx_buffer);
txchar('\r');
txchar('\n');
CyDelay(100);
}
After changing back to the UDB implementation it works as expected, but consumes a lot of valuable resources on my PSoC4 (4245). I'm using latest version of PSoC creator, all updates ok etc...
Anybody run into this issue before? any help very welcome !
// and yes it i'm using the UDB implementation the glitch filter could be moved inside... but i require glitch-free signals from A-input for other parts (not shown) of the design... 😉
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
new testbench, doesn't require a rotary encoder...
I have used to clocks to create some activity on A/B inputs of the quadrature encoders,
so the decoder is now slowly counting up.
in software it's now a very small routine to test results over uart.
int main()
{
char uart_tx_buffer[12];
UART_Start();
QuadDec_1_Start();
QuadDec_2_Start();
for(;;)
{
sprintf(uart_tx_buffer, "%d", (uint16) QuadDec_1_ReadCounter());
txstring(uart_tx_buffer);
txchar(':');
sprintf(uart_tx_buffer, "%d", (uint16) QuadDec_2_GetCounter());
txstring(uart_tx_buffer);
txchar('\r'); txchar('\n');
CyDelay(100);
}
}
results from uart terminal:
...
0:103
0:104
0:105
0:106
0:107
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Looking on your screenshots, de-glitching filter is not required, and clock frequency can be reduced from 250kHz to 200Hz.
Tke a look at this video tutorial:
odissey1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
thanks for the link odissey1, helpful.
but it does not solve why the QD (TCPWM) is not counting and the QD (UDB) just seems to work,
latest test bench is even without any rotary encoder, so the input signals are glitch-free 😉
still hoping somebody tries to make it work, currently I just don't understand what i'm doing wrong...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content