初始化如下 PCON=0x80;
RCLK=1; TCLK = 1; S1STAT = 0x20 ;
S1CON = 0x00 ; REN_1 = 1 ;
SM0_1 = 0 ; SM1_1 = 1 ; SM0_0 = 0 ; SM1_0 = 1 ;
BRGCON = 0X00 ; BRGR1=0x04; // 11.0592*1000000/9600-16 BRGR0=0x70; BRGCON = 0X03 ;
ES1R = 1; EA = 1 ; TI_1 = 1 ; TI_0 =1;
串口发送如下 void Uart1SendCrt( unsigned char ch ) { S1BUF = ch ; while(!TI_1) ; TI_1 = 0 ; }
void Uart0SendCrt(unsigned char ch) {
S0BUF=ch; while(TI_0==0); TI_0=0; }
问题是当单个串口发送数据能成功 while(1) { Uart1SendCrt(0x22);//发送字符 }
两个串口一起就不行了 而且接收不到数据
while(1) { Uart1SendCrt(0x22);//发送字符 Str = S1BUF; RI_1 = 0; Uart0SendCrt(Str ); }
请问是我程序哪有问题? 还是哪边设置不正确?? |