Monostable type output

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
技术社区计划将于12月21日至1月5日期间进行升级,升级期间暂时无法发布新问题。

Monostable type output

4,018 次查看
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 回复数

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

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