Introduction - If you have any usage issues, please Google them yourself
PC and single-chip two-way communication smart temperature control procedures# Include <AT89X51.H># Include <intrins.h># Define Key_UP P1_0# Define Key_DOWN P1_1# Define Key_SET P1_2# Define RelayOutPort P2_0# Define LEDPort P0# define DELPort P2_1# define LEDTwoC P3_6# define LEDThreeC P3_7# define TMPort P2_7# define INBUF_LEN 5// data length unsigned char inbuf1 [INBUF_LEN] = (0, 0, 0, 0, 0)// Send buffer unsigned char inbuf2 [50]// receive buffer unsigned char count3 void init_serialcomm (void) (SCON = 0x50// SCON: serail mode 1, 8-bit UART, enable ucvrTMOD | = 0x20// TMOD: timer 1 , mode 2, 8-bit reloadPCON | = 0x80// SMOD = 1 TH1 = 0xFA// Baud: 4800 fosc = 11.0592MHzIE | = 0x90// Enable Serial InterruptTR1 = 1// timer 1 run)// to the serial port to send a character void send_char_com (unsigned char ch) (SBUF = ch while (TI == 0) TI = 0