char uart_rd;
// LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB6_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 TRISB6_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections
void main()
{
trisb=0b00000000;
trisc=0b11111000;
portc=0;
portb=0;
UART1_Init(1200); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
//start:
while (1)
{ // Endless loop
if (UART1_Data_Ready())
{
uart_rd = UART1_Read(); // read the received data,
delay_us(100);
{
if(uart_rd=='x')
{
delay_ms(10);
portc.f0=!portc.f0;
// Lcd_Out(1,2,uart_rd);
Lcd_Chr_Cp(uart_rd); //jekhane cursor ase sekhan thk lekha
delay_ms(2000);
}
if(uart_rd=='a')
{
delay_ms(10);
portc.f1=!portc.f1;
// Lcd_Out(1,2,uart_rd);
Lcd_Chr_Cp(uart_rd); //jekhane cursor ase sekhan thk lekha
delay_ms(2000);
}
if(uart_rd=='1')
{
delay_ms(10);
portc.f2=!portc.f2;
// Lcd_Out(1,2,uart_rd);
Lcd_Chr_Cp(uart_rd); //jekhane cursor ase sekhan thk lekha
delay_ms(2000);
}
}
}
}
}