针对STC89C52RC 单片机的一些程序 基本串口通信程序: #include #define uint unsigned int #define uchar unsigned char #define SEND 0 #define RECEIVE 1 uchar flag_Serial = SEND; uchar Rx_Buf; sbit SMG = P1^7; //0 1 2 3 4 5 6 7 8 9 a b c d e f uchar code Show[16]={0x03,0x9f,0x25,0x0d,0x99,0x49, 0x41,0x1f,0x01,0x19,0x11, 0xc1,0x63,0x85,0x61,0x71}; void Serial_Init(); void Serial_send(); void Display(); void Delay_1ms(uchar z); /****************************************************/ //main function // /****************************************************/ void main() { Serial_Init(); while(1) { switch(flag_Serial) { case SEND: flag_Serial = RECEIVE; Serial_send(); break; case RECEIVE: Display(); break; } } } /****************************************************/ //serial initial // /**********************************