

Code: #include #include // by default frequency is 500KHz #define Baudrate 1200 //bps #define OneBitDelay (125000/Baudrate) #define DataBitCount 8 // no parity, no flow control #define UART_RX LATAbits.LATA1 //PORTAbits.RA1 // UART RX pin #define UART_TX LATAbits.LATA0 //PORTAbits.RA0 // UART TX pin #define UART_RX_DIR TRISA1 // UART RX pin direction register #define UART_TX_DIR TRISA0 // UART TX pin direction register //Function Declarations void InitSoftUART(void) void UART_Transmit(unsigned char) // CONFIG1 #pragma config FOSC = INTOSC // Oscillator Selection Bits (INTOSC oscillator: I/O function on CLKIN pin) #pragma config WDTE = OFF // Watchdog Timer Enable (WDT disabled) #pragma config PWRTE = OFF // Power-up Timer Enable (PWRT disabled) #pragma config MCLRE = ON // MCLR Pin Function Select (MCLR/VPP pin function is MCLR) #pragma config CP = OFF // Flash Program Memory Code Protection (Program memory code protection is disabled) #pragma config BOREN = OFF // Brown-out Reset Enable (Brown-out Reset disabled) #pragma config CLKOUTEN = OFF // Clock Out Enable (CLKOUT function is disabled.
