PIC16F877A – MIKRO C – UART

Photo of author

By Jackson Taylor

UART COMMUNICATION

void main()
{
    int a;
    trisb=0x0;
    lcd_cmd(lcd_clear);
    lcd_init(portd);
    usart_init(9600);
    while(1)
    {
        while (usart_data_ready ())   //checks whether the data is available
        {
            a=usart_read();   //reads the data
        }
        usart_write(a); //sends the date
        if(a=='n' )        //if recived letter is small letter n , then all led in PORTB will high
        {
            portb=0xff;
        }
        else
        {
            portb=0x00;
        }
    }
}
See also
MICROWAVE OVEN TRANSFORMER CONVERTED TO WELDING / CUTTER TRANSFORMER BY EMERGING TECHNOLOGIES