echo.c - Inputs chararacters from UART RX1, echos back chars+1.¶
The echo program which waits for UART1 RX character and echos it back +1. Use the echo program to test your UART connection.
 
#include "pic24_all.h"
int main(void) {
  uint8_t u8_c;
  configClock();
  configHeartbeat();
  configDefaultUART(DEFAULT_BAUDRATE);
  printResetCause();       //print statement about what caused reset
  outString(HELLO_MSG);
 
Echo character + 1.
  while (1) {
    u8_c = inChar();  //get character
    u8_c++;           //increment the character
    outChar(u8_c);    //echo the character
  } // end while (1)
}