I need to be able to create a down counter without interrupts

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
KeDa_1385231
Level 1
Level 1

I'm at my wit's end.  I'm trying to debug some equipment and want to simulate the problem with a PSoC5 dev board.  I want to be able to send Quadrature Encoder signals.  More specifically, I only want so many edges.   So, I put 20 into a counter, and I get 20 edges, and then it stops.  Seems simple.  I've tried using the counter as a Fixed-Function down counter, UDB counter, etc, etc.. The problem is I never  get the TC pulse.  Unfortunately, every single example I've seen either runs in Continuous mode or uses Interrupts.

The clock, the QUADGEN_CLK is always running and never turned off, so SYNC RESET, or ASYNC RESET, shouldn't matter.

This should be a simple -- count down and set a flag.

I added a SR Flip-flop to hold the TC high, should it ever happen (which does not seem to be the case).

pastedImage_1.png

pastedImage_2.pngpastedImage_3.png

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.
Ekta_N
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hello KeDa_1385231 ,

For a UDB counter in Down Counter  or Up Counter clock mode the edge detect logic detects the rising edge of the count input synchronous to the clock input. Depending on whether the Counter is configured as an up counter or down counter, the edge detect event on the count input increments or decrements the Counter, respectively

The terminal count condition is met in case of down counter when counter value is equal to zero.

Thus you need should not provide logic high to the count input of the counter

Use the following method to provide input to the count terminal:

pastedImage_1.png

I am attaching a project with one shot counter implementation as mentioned by you, please try it on the development board.

You will notice LED blink when the terminal count is reached.

Regards

Ekta

View solution in original post

0 Likes
3 Replies