|
請問為什么我的程序不能實(shí)現(xiàn)T2定時閃爍功能,如果我加上T2MOD=0的話會報(bào)錯;求大佬指點(diǎn)
#include<reg52.h>
#define led P2
typedef unsigned char uchar;
typedef unsigned int uint;
uint count;
void Timer2Init(void) //50??@12.000MHz
{
//T2MOD = 0; //????????
T2CON = 0; //????????
TL2 = 0xB0; //??????
TH2 = 0x3C; //??????
RCAP2L = 0xB0; //???????
RCAP2H = 0x3C; //???????
EA=1;
ET2=1;
TR2 = 1; //???2????
}
void init() interrupt 5
{
count++;
if(count==20)
{
count=0;
led=~led;
}
}
void main()
{
Timer2Init();
while(1);
}
|
|