新唐N79e8132A单片机串口与定时器0共用,同时开启定时器0和串口后,相互影响,串口和定时器不能工作,跟官方的配置一样,为啥我的就是不成呢?以下是配置
void usart_Init()
{
AUXR1 |= 0x00;
SCON = 0x52;
TMOD |= 0x21;
TH1 = 0xFD;
TL1 = TH1;
TR1 = 1;
ES = 1;
//TMOD &= 0xF0; // Timer 0 mode 1 with hardware gate
//TMOD |= 0x01; // GATE0=0; C/T0#=0; M10=0; M00=1;
TH0 = (65526-100)/256; // Initial values
TL0 = (65536-100)%256;
ET0 = 1; // Enable timer0 interrupt
TR0 = 1; // Timer0 run
} |
|