/*程序里面也有发送,但是没有调用到,不写*/#include //11.0592Mtypedef unsigned char uchar;void Uart_init(void){TMOD=0X20;//波特率19200TH1=0XFD;PCON=0X80;//倍速才能在11.0592M晶振下波特率0误差。TR1=1;}void mian(){uchar i;Uart_init();while(1){if(RI){RI=0;i=SBUF; switch (i)//用P0口点亮二极管,低电平有效 { case 0x31: P0=0XFE;break;//PORTC |= 0x01; break;//第1个二极管亮 case 0x32: P0=0XFF;break;//PORTC &= 0xfe; break;//第1个二极管灭 case 0x33: P0=0XFD;break;//PORTC |= 0x02; break;//第2个二极管亮 case 0x34: P0=0XFF;break;//PORTC &= 0xfd; break;/哗销/第2个二极管灭 case 0x35: P0=0XFB;break;//PORTC |= 0x04; break;//第3个二做宴极管亮 case 0x36: P0=0XFF;break;//PORTC &= 0xfb; break;//第3个二极管灭 case 0x37: P0=0XF7;break;//PORTC |= 0x08; break;//第4个二极管亮 case 0x38: P0=0XFF;break;//PORTC &= 0xf7; break;//第4个纯芦银二极管灭 default: break; }}}}