#ifndef __MY1UART_H__ #define __MY1UART_H__ /* note: this is NOT compatible with keil's printf */ void uart_init(void) { SCON = 0x50; TMOD &= 0x0F; TMOD |= 0x20; TH1 = 253; TR1 = 1; } void uart_send(unsigned char sdat) { SBUF = sdat; while (TI==0); TI = 0; } unsigned char uart_read(void) { unsigned char rdat; while (RI==0); rdat = SBUF; RI = 0; return rdat; } void uart_puts(char* text) { while (*text) { uart_send(*text); text++; } } #endif /* __MY1UART_H__ */