如果想在程序中利用Timer0中断进行LED的控制。即设定计时时间,每次进入Timer0中断时,点亮LED,相关的Timer0中断程序如何写呢?
另外TIMPRD与TIMCNT分别是什么作用呢?
Shine:
中断程序中toggle一个标志位,点灯函数中判断这个标志位,如为0,LED灯暗,如为1,驱动LED灯亮。TIMPRD, TIMCNT是周期寄存器和计数寄存器,具体定义见下面的timer手册。
When the timer is set to start the contents of the TIMPRDn register is loaded into the TIMCNTregister and begins to count down
http://www.ti.com/lit/ug/sprufo2/sprufo2.pdf