Deep Shah

MC9S12DP256 SCI Interrupt driven help

Discussion created by Deep Shah on Mar 22, 2008
Latest reply on Mar 22, 2008 by Jim Donelson
I am trying to send a 10 byte string onto the MCU. I have been trying to write a SCI interrupt code that take this string when it arrives. How do I go about doing this. So far I have the following:
 
 
char number[] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x67};
void main(void)
{
   SCI0BDL = 156;      //set baud rate = 9600 
   //SCI0CR1 = 0x40;   // LOOPS,WOMS,RSRC,M,WAKE,ILT,PE,PT
                              // sci disable in wait,parity disable,odd parity
   SCI0CR2 = 0x2C;   // TIE,TCIE,RIE,ILIE,TE,RE,RWU,SBK
                             // rxfull or int enable, ,transmitter enable,receiver enable
 
}
 
__interrupt void sci0ISR(void)
{
  int sci0_data_in;
 
       sci0_data_in = SCI0DRL - 48;             // read received character + clear interrupt flag
       PTH = number[sci0_data_in];               // show received data on port B
}
 
Currently, I am trying to write a piece of code that would take a byte at a time and display it onto Port H. However, this interrupt code that I have written seems to fail. I am trying to figure this out, but I am being unsuccessful at this. Any help or suggestions will be really appreciated. Thanks.

Outcomes