使用N76E003接收DMX512的信号,用的是串口0模式3,定时器1,波特率是250K,时钟是系统默认的16M,接收到的包都是错误的0XC0,下面是初始化代码,请教下解决方法:
void hwUart_Uart0Init(void)
{
P05_PushPull_Mode;
P06_Quasi_Mode;
P07_Quasi_Mode;
SCON = 0xD0; // Special setting the mode 3 and
TMOD |= 0x20; //Timer1 Mode1
set_SMOD; //UART0 Double Rate Enable
set_T1M;
clr_BRCK; //Serial port 0 baud rate clock source = Timer1
TH1 = 256 - (1000000/u32Baudrate+1); /*16 MHz */
set_TR1;
set_RB8; //This bit is for setting the stop bit 2 high/low status,
clr_TI;
set_ES; //enable UART interrupt
set_EA; //enable global interrupt
P05=0;
} |