单片机C语言定时器如何调用
单片机C语言定时器如何调用
日期:2017-09-24 23:12:43 人气:1
单片机中通过中断的方式来调用定时器。
具体的调用方式可以参考通过如下程序:
程序功能:利用定时器进行定时,实现每秒中led闪烁一次
#includesbit led = P0^0;unsigned int num;void main(void){ TMOD = 0x00; // 工作方式0 TH0 = (8192 - 5000) / 32; // 12M晶振下定时5ms TL0 = (8192 - 5000) % 32; EA = 1; /&