I was looking at this some more and found the following
The value of sd3 inside the function void SendSerialData3(struct sciData *sd3) is reported as sd3=NULL by the Codewarrior IDE.
Whereas the value of sd3 in the function void out_serial3(struct sciData *sd3) (Shown Below) points to the correct struct sci3Dat defined back in main().
INSIDE THE FUNCTION CALLED BY THE ISR:
/* Send data routine. Called by sci interrupt handler */
void out_serial3(struct sciData *sd3){
if(sd3->SentBytes > sd3->OutBytes){ // if last character transmitted
INTR_OFF(); // turn off transmitter interrupts
SCI3CR2 = 0x24; // Also turns off transmitter when last char is sent
sd3->TRANSMIT = 0; // notify main program that tranmission is complete
INTR_ON();
}
else
SCI3DRL = sd3->txBuf[sd3->SentBytes++]; // stuff character in sci transmit buffer
}
ISR SHOWING CALL TO out_serial3
/* interrupt handler for all SCI3 communications interrupts */
void interrupt com3(void){
uint8_t scitest = SCI3SR1;
if(scitest&BM_RDRF){ // if receive buffer full interrupt, call data receive routine
in_serial3(&sci3Dat);
}
else{
if(scitest&(BM_TDRE|BM_TC)){ // if transmit buffer empty or transmit complete interrupt,
out_serial3(&sci3Dat); // call transmit data routine
}
}
}
The code for all three modules SendSerialData3, out_serial3, and com3 reside in the same file.
Parameters to both modules are defined in the same manner (struct sciData *sd3) and calls are made in same fashion (&sci3Dat).
So the question is: Why does sd3=NULL inside SendSerialData3, but contain the correct values inside out_serial3?