求sh79f084 串口demo,sh79f084 串口用T2定时器,没成功。哪里不对?
void Init_Timer2(void)
{
EA=0;
//Enter_Bank1;
T2CON = Bin(00110000);
TL2 = (65536-16600000/32/2400) & 0x00ff;
TH2 = ((65536-16600000/32/2400)>>8)&0x00ff;
TF2 = 0; //
TR2 = 1; // 开启定时器2
//IEN0 |= Bin(00010000); //EUART
//IEN1 = Bin(00000000);
//Enter_Bank0;
ET2 = 0;
EA = 1; //开启全中断
}
void EUART_Init(void)
{
EA=0;
//Enter_Bank0;
PCON =Bin(00000000);
SCON = Bin(01010000); // 方式1
RI=0;
TI=0;
REN=1; //打开串口0接收中断
ES0 =1; //使能UART0中断
EA = 1;
} |