Do you have an itchy trigger finger?

 

web PSoC 4 Timer 2.5 Trigger.bmp


Continuing on the Timer Component theme, this article discusses how to commence the countdown of a timer from an external event.

Based on my experience, if you don't use a trigger option you can commence the countdown of a timer using the Timer_Start() API but if you want to defer the timer countdown until a specific event occurs a trigger can be used.

The Timer component has several trigger options:

  • None
  • Rising Edge
  • Falling Edge
  • Either Edge
  • Software controlled

By default it is None and thus the pin is not present on the schematic.

This means that the Timer immediately commences its countdown upon calling the Timer_Start() API.

When either of the Edge options are selected the Trigger pin is present on the schematic and the timer can be started with a digital input.

 

The trigger works independently of the Run Mode of the timer.

If the Run Mode is set to continuous and the timer reset input is connected to logic '0' then the trigger can only be used once - that is to start the countdown of timer. From that point on the timer keeps on going and going.

If the Run Mode is set to any One Shot option and you have a timer reset input connected to a digital input, the trigger can only be used once per One Shot but you have the opportunity to reset and rearm the timer for repeated usage via the reset input.