Final Project/FinalProject.X/FinalProjectMain.c
// <editor-fold defaultstate="collapsed" desc="sendData()">
/******************************************************************************
 * sendData interrupt service routine.
 *
 * Sends the next byte of data
 ******************************************************************************/

sendData interrupt service routine.

Sends the next byte of data
sendData interrupt service routine . Sends the next byte of data
void sendData() {
    if(keypress == 1)
    {
        TXREG1 = byteToSend;
        PIE1bits.TX1IE = 1;
        keypress = 0;
    }
    else if(rpgDir != 0)
    {
        switch(rpgDir)
        {
            case 1: 
                TXREG1 = 0xA9;
                PIE1bits.TX1IE = 1;
                rpgDir = 0;
                break;
            case -1:
                TXREG1 = 0xAA;
                PIE1bits.TX1IE = 1;
                rpgDir = 0;
                break;
        }
    }
    else
    {
        PIE1bits.TX1IE = 0;
        readyToSend = 0;
    }
}
void sendData ( ) { if ( keypress == 1 ) { TXREG1 = byteToSend ; PIE1bits . TX1IE = 1 ; keypress = 0 ; } else if ( rpgDir != 0 ) { switch ( rpgDir ) { case 1 : TXREG1 = 0xA9 ; PIE1bits . TX1IE = 1 ; rpgDir = 0 ; break ; case -1 : TXREG1 = 0xAA ; PIE1bits . TX1IE = 1 ; rpgDir = 0 ; break ; } } else { PIE1bits . TX1IE = 0 ; readyToSend = 0 ; } }
<editor-fold defaultstate="collapsed" desc="sendData()">
 sendData interrupt service routine.
<editor - fold defaultstate = " collapsed " desc = " sendData () " > sendData interrupt service routine .