Está en la página 1de 3

USFQ Miguel Armas, Carlos Garzn, Paul Frutos Cdigo sbit LCD_RS at RB4_bit; sbit LCD_EN at RB5_bit; sbit

LCD_D4 at RB0_bit; sbit LCD_D5 at RB1_bit; sbit LCD_D6 at RB2_bit; sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit; sbit LCD_EN_Direction at TRISB5_bit; sbit LCD_D4_Direction at TRISB0_bit; sbit LCD_D5_Direction at TRISB1_bit; sbit LCD_D6_Direction at TRISB2_bit; sbit LCD_D7_Direction at TRISB3_bit; // Fin de declaracin de variables de conexin. char uart_rd, contador=0;

void main(){ Lcd_Init(); Lcd_Cmd(_LCD_CLEAR); //Borra el display.

Lcd_Cmd(_LCD_CURSOR_OFF); //Apaga el cursor.

UART1_Init(9600); Delay_ms(1000); while (1){

// USART a 9600 bps.

if (UART1_Data_Ready()){ //Si se recibe un dato, uart_rd = UART1_Read(); //lee el dato recibido, Lcd_Chr_CP(uart_rd+1); UART1_Write(uart_rd+1); //lo presenta en el LCD, //y lo enva a travs del USART.

contador++; if(contador==15){ contador=0; Delay_1sec(); //Detecta el ingreso de 16 caracteres, //reinicia el contador, //espera 1 segundo, //y borra el LCD.

Lcd_Cmd(_LCD_CLEAR); } } } }

Simulacin

También podría gustarte