Run a "continuous" Timer Counter for x times without using an interrupt

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

cross mob
Level 2
Level 2
5 replies posted 10 questions asked 25 sign-ins

I would like a timer to run 3 (or x) times relaunching it about 50 us apart.

I know I can manually trigger it in one-shot mode or stop it in continuous mode by using the interrupt or any other software intervention. However, 50 us separated interrupts seem to be not favorable as they tend to block the main thread.

This is why I'm searching for a hardware-only solution. Something like a 3x self-triggering counter that restarts 3 counts based on a hardware trigger.


Which hardware components to use to realize that?

1 Reply
250 solutions authored 250 sign-ins 5 comments on KBA

You might need to use two TCPWM to do so. One to count the X, and the other to run the 50 us.

The connections between them can be some thing like this:


Both counters are set to run continuously. Every time you want to have the X triggers, start the second counter. Eventually it will stop, then you need to start in firmware to get the X triggers again.

The first counter sets the period to (X-1). The second counter sets the period to a value to achieve the 50 us (in the example above, 50000).