Hello all,
I have an ISR configured for SCI-A receive that needs to execute some logic. Currently this is what it does:
//ProcessHeartBeat(); // some reason the rx_buffer is cleared uint16_t i; for (i = 0; i < TXMSGLEN; i++) { tx_buffer[i] = rx_buffer[i]; rx_buffer[i] = RXUNINITIALIZED; } tx_send = 1; rx_bytes_buffered = -1;
The contents of the commented out function call to ProcessHeartBeat() is 100% identical to the code below it. All mentioned variables are global. Basically it's echoing what I give it via software buffers. This works perfectly fine in the current configuration, but if I try to replace the code with a function call for readability the rx_buffer variable seems to empty itself as soon as the debugger reaches the beginning of the call. There are no doubly-defined warnings and I've manually checked scope to make sure that there is only ever one rx_buffer. Is there something related to ISRs that would disallow access to functions? rx_buffer is declared as:
static volatile uint16_t rx_buffer[RXBUFSIZE]; // RXBUFSIZE = 10 but this is pretty irrelevant for the question
Anybody know why the raw code works, but wrapped in a function it doesn't? Thanks!