AnsweredAssumed Answered

SCI s08pa16 not working

Question asked by avdit kohli on Jul 11, 2014
Latest reply on Jul 22, 2014 by avdit kohli

Hi,

I am  trying to work with SCI on the MCU mc9s08pa16 (32 Pins) and seem to set the right baud rate of 28.8k for a 8MHz clock and I think my initialisation is also correct but the output seems like garbage values. If I send 'A' 0x41 and 'B' 0x42, I observe 1F 0F on the terminal. I checked my hardware and it seemed to be working correctly.

 

 

void Init_SCI(void) // using TxD1 RxD1

 

{

SCI1_BDH = 0x00;

SCI1_BDL = 0x12; //Sets the baud rate at 28.8K bps for a bus clock speed of 8MHz ,decimal =17.36 ** I have tried pre scalars from 0x09 to0x16

SCI1_C1 = 0x03; //Sets 8 bit communication, with parity enabled and odd parity

SCI1_C2 = 0x00; //Not really required for our use, but none the less explicitly set

SCI1_C3 = 0x10; //Transmit output inverted hence TXINV set,to take care of the level shifter transistor in between

SCI1_C2_TE = 0b1; //Enable transmitter

SCI1_C2_RE = 0b1; //Enable receiver

SCI1_C3_TXINV = 0b1; //Invert transmit characters

}

 

 

void transmit_data(byte tx_data) //Tested fine with baud rate 28.8K, 7 data bits, 1 stop bit and odd parity

 

{

if(SCI1_C2_TE != 0b1) {SCI1_C2_TE = 0b1;} //Enable transmitter

while (SCI1_S1_TDRE != 0b1);

SCI1_D = tx_data;

}  //Sends one byte of data = tx_data to the PC

 

Thanks,

Avdit

Outcomes