Hi,
I am trying to transmit data using the transmit ISR, however I notice am missing some characters. I use a delay function however am trying to avoid using it. Is there a condition I can use to only run the ISR when a character has fully been sent.
#pragma vector=USCI_A1_VECTOR
__interrupt extern void USCI_A1_ISR(void)
{
switch (__even_in_range(UCA1IV, USCI_UART_UCTXCPTIFG))
{
case USCI_NONE:
break;
case USCI_UART_UCRXIFG:
if (coordinator.gpsManager.buffer.overFlow) // if write buffer is behind read buffer, break to prevent overwriting data that has not been read
{
break;
}
else
{
char byte = UCA1RXBUF;
coordinator.gpsManager.buffer.push(byte);
}
break;
case USCI_UART_UCTXIFG:
coordinator.gpsManager.sendNextByte();
break;
case USCI_UART_UCSTTIFG:
break;
case USCI_UART_UCTXCPTIFG:
break;
}
}
void Manager::sendNextByte()
{
if (transmit.mWrite == transmit.mRead) // if the mWrite == mRead, we don't have any data
{
deviceBusy = false;
return;
}
UCA1TXBUF= transmit.pop();
// __delay_cycles(16000);
}