Sie sind auf Seite 1von 1

char uart_rd; // LCD module connections sbit LCD_RS at P2.B0; sbit LCD_EN at P2.B1; sbit LCD_D7 at P2.

B5; sbit LCD_D6 at P2.B4; sbit LCD_D5 at P2.B3; sbit LCD_D4 at P2.B2; // End LCD module connections void main() { Uart_init(4800); // Initialize UART module at 4800 bps Delay_ms(100); Lcd_Init(); // Initialize LCD Lcd_Cmd(LCD_CLEAR); // Clear display Lcd_Cmd(LCD_CURSOR_OFF); // Cursor off LCD_OUT(1,1,"DISPLAY UNIT"); p0=0x00; while(1) { if (Uart_Data_Ready()) { // Check if UART module has received data uart_rd = Uart_Read(); Uart_Write(uart_rd); // Read data

if(uart_rd=='q') { Lcd_out(2,1,"ADVERTISMENT 2"); } else if(uart_rd=='r') { Lcd_out(2,1,"ADVERTISMENT 1"); } else { Lcd_out(2,1,"NO DISPLAY "); } }

Das könnte Ihnen auch gefallen