Monostable type output

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Monostable type output

3,524 Views
ernestsnaith
Contributor I
I would like to make an output high for X ms, and dont want to have a loop which wastes X amount of time as i need to do plenty within this time.
 
Is the best way to do this to have a timer interupt or is there a better way?
 
Thanks
Labels (1)
0 Kudos
Reply
2 Replies

828 Views
rocco
Senior Contributor II
Hi, ernestsnaith

It's pretty subjective on what 'a better way' is. Within my simplistic mind, interrupts are always the better way.

But for your application, there is a simpler way.

You can do both ends of a one-shot with the timer, in one routine, without any delays.

You would use a timer channel, and set the output high directly in that routine. You would then program the output-compare function to set the output low at some point in the future, and you're done.
0 Kudos
Reply

828 Views
ernestsnaith
Contributor I
Im finding the manual a little hard work is it roughtly as follows?
 
put X into output compare reg
reset timer count reg
make ouput high
Then timer toggle on overflow reg changes state once X is reached.
 
Thanks
 
 
0 Kudos
Reply