Hi, All.
I am trying to send using SCI the string "Burst-Transmit/n/r" in a similar way that Frank Bormann wrote in example Lab9_3.c. Tha main difference is that I am trying to use an "sprintf" function to charge the string. I am also using SCI TX in FIFO mode.
The following main routine and the SCI_TX interrupt routine are the core of my programm
//main Routine
void main(void)
{
//Here, I write all initialization routines
while(1)
{
printf("Burst-Transmit\n\r");
//sprintf(message,"Burst-Transmit\n\r");
//A Timer interrupt is also running
while(CpuTimer0.InterruptCount < 40) // 40 * 50ms = 2 sec
{
}
CpuTimer0.InterruptCount = 0;
SciaRegs.SCIFFTX.bit.TXFFINTCLR = 1; // re-arm Tx - FIFO
}
}
/********************************************************************/
//SCI_TX_FIFO interrupt routine
interrupt void SCIA_TX_isr(void) // SCI-A Transmit Interrupt Service
{
unsigned int i;
sprintf(message,"Burst-Transmit\n\r");
// copy 16 character into SCI-A TX buffer
for(i=0;i<16;i++) SciaRegs.SCITXBUF= message[i];
// Acknowledge this interrupt to receive more interrupts from group 9
PieCtrlRegs.PIEACK.all = PIEACK_GROUP9;
}
The printf is working OK and the "Burst-Transmit" is written in the console window
My problem is with the hyperterminal that I have connected to the SCI output.
Sometimes, the right string is written "Burst.Transmit", but most times a bad string is written (something similar to "#/€$3.....ansmit".
The same is happening if I put the sprintf sentence in the main function instead of the SCI_TX interrupt routine.
Some explanation for that?