Toll-Free Customer Support 24/7

Pic Uart Code

 

/*
 * Project name:
    PIC Development Board
 * Copyright
     (c) Researchdesignlab.com
 * Test configuration:
     MCU:             PIC16F877A
     Dev.Board:       PIC
     Oscillator:      20.0 MHz
     Software:  mikroC PRO for PIC v 4.6

*/


char uart_rd;
void main() {
  UART1_Init(9600);               // Initialize UART module at 9600 bps
  Delay_ms(100);                  // Wait for UART module to stabilize

  UART1_Write_Text("Research design Lab");
  UART1_Write(10);
  UART1_Write(13);

  while (1) {                     // Endless loop
    if (UART1_Data_Ready()) {     // If data is received,
      uart_rd = UART1_Read();     // read the received data,
      UART1_Write(uart_rd);       // and send data via UART
    }
  }
}

Back to top