Monostable type output

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Monostable type output

3,536 次查看
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
标签 (1)
0 项奖励
回复
2 回复数

840 次查看
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 项奖励
回复

840 次查看
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 项奖励
回复