2019-07-18 12:28发布
武力戡乱 发表于 2015-2-13 09:24 volatile unsigned char Timer_Flag = 0; unsigned char Timer_Count = 0; #define Timer_N20MS 1
gu709108631 发表于 2015-2-13 13:04 好的,谢谢你,我懂了
最多设置5个标签!
volatile unsigned char Timer_Flag = 0;
unsigned char Timer_Count = 0;
#define Timer_N20MS 1
void T0_time() interrupt 1
{
TH0=0xf8; //重装初始值(65535-2000)=63535=0xf82f
TL0=0x2f; Timer_Count ++;
if(Timer_Count == Timer_N20MS ) {
Timer_Flag = 1;
Timer_Count = 0;
}
}
通过改不同的 Timer_N20MS 值,到达不同20ms的倍数。
好的,谢谢你,我懂了
客气
一周热门 更多>