Final Project/FinalProject.X/FinalProjectMain.c
// <editor-fold defaultstate="collapsed" desc="Initial()">
/******************************************************************************
 * Initial()
 *
 * This subroutine performs all initializations of variables and registers.  This
 * is a modified version of the one found in "Watkins_William_Lab6_Part2.c" from
 * my Lab 6 code.
 ******************************************************************************/

Initial()

This subroutine performs all initializations of variables and registers.  This
is a modified version of the one found in "Watkins_William_Lab6_Part2.c" from
my Lab 6 code.
Initial () This subroutine performs all initializations of variables and registers . This is a modified version of the one found in " Watkins_William_Lab6_Part2 . c " from my Lab 6 code .
void Initial() {
    TRISA   = 0b00101001;
    LATA    = 0;
    TRISD   = 0b11111111;
    LATD    = 0;
    TRISC   = 0b10010011;
    LATC    = 0;
    TRISE   = 0b00000000;
    LATEbits.LATE0    = 1;
    TXSTA1 = 0b00100000;            
    RCSTA1 = 0b00010000;            
    BAUDCON1 = 0b01000000;          
    SPBRG1 = 12;                    
    RCONbits.IPEN = 1;              
    INTCONbits.GIEL = 1;            
    INTCONbits.GIEH = 1;            
    IPR1bits.TMR1IP = 0;            
    PIE1bits.TMR1IE = 1;            
    PIR1bits.TMR1IF = 0;            
    IPR3bits.CCP1IP = 0;            
    PIE3bits.CCP1IE = 1;            
    PIR3bits.CCP1IF = 0;            
    IPR1bits.TX1IP = 1;             
    PIE1bits.TX1IE = 0;             
    RCSTA1bits.SPEN = 1;        
}
void Initial ( ) { TRISA = 0b00101001 ; LATA = 0 ; TRISD = 0b11111111 ; LATD = 0 ; TRISC = 0b10010011 ; LATC = 0 ; TRISE = 0b00000000 ; LATEbits . LATE0 = 1 ; TXSTA1 = 0b00100000 ; RCSTA1 = 0b00010000 ; BAUDCON1 = 0b01000000 ; SPBRG1 = 12 ; RCONbits . IPEN = 1 ; INTCONbits . GIEL = 1 ; INTCONbits . GIEH = 1 ; IPR1bits . TMR1IP = 0 ; PIE1bits . TMR1IE = 1 ; PIR1bits . TMR1IF = 0 ; IPR3bits . CCP1IP = 0 ; PIE3bits . CCP1IE = 1 ; PIR3bits . CCP1IF = 0 ; IPR1bits . TX1IP = 1 ; PIE1bits . TX1IE = 0 ; RCSTA1bits . SPEN = 1 ; }
<editor-fold defaultstate="collapsed" desc="Initial()">
 Initial()
<editor - fold defaultstate = " collapsed " desc = " Initial () " > Initial ()
// <editor-fold defaultstate="collapsed" desc="IO Port Config"> // Configure the IO ports // </editor-fold> // <editor-fold defaultstate="collapsed" desc="EUSART 1 Config"> // Async, 8N1, 19200 baud, 16MHz, Transmit enable // Async, 8N1, Receive enable // 8-bit mode // Load value of 12 into baud reg - Gives 19230.8 baud // </editor-fold> // <editor-fold defaultstate="collapsed" desc="Interrupt Config"> // Configuring Interrupts // Enable priority levels // Enable low-priority interrupts to CPU // Enable all interrupts // Timer 1 // Assign low priority to TMR1 interrupts // Enable TMR1 interrupts // Clear the interrupt flag // CCP 1 // Assign low priority to CCP1 interrupts // Enable CCP1 interrupts // Clear interrupt flag // EUSART 1 // Assign high priority to tx interrupts // Disable EUSART 1 Transmit interrupts (for now) // </editor-fold> // <editor-fold defaultstate="collapsed" desc="Final Config to Start"> // EUSART Comms // Enable Serial port // Turn on Timers //    T1CONbits.TMR1ON = 1; // for copying to  // </editor-fold>