I've attached an example program we use on our development boards. It has an example of writing data via RS232. The setup for the routines uses Codewarrior's processor expert.
It's not for the same part, but the 9S08s are all similar.
Are you looking how to printf to SCI? If yes then check this non-PE CW example for SE demo board, which shows possible implementation of required TERMIO etc routines:
"Program Files\Freescale\CodeWarrior for Microcontrollers V6.3\(CodeWarrior_Examples)\HCS08\Evaluation Board Examples\DEMO9S08SE8_LAB1"
i've wrote something like this, but it only sends message through the USB (not from the RS232 port as i would like it to be), even if i change specific jumper from USB to COM...
/////////////////////////////////////////////////////////////////////////////////////////
// InitSCI
/////////////////////////////////////////////////////////////////////////////////////////
void InitSCI(word baud) {
SCIBD = baud; // set baud
}
/////////////////////////////////////////////////////////////////////////////////////////
// SendMsg
/////////////////////////////////////////////////////////////////////////////////////////
void SendMsg(char msg[]) {
byte i=0;
char nxt_char;
SCIC2 = 0x08;
nxt_char = msg[i++];
while(nxt_char != 0x00) {
while(!SCIS1_TDRE){}
SCID = (byte) nxt_char;
nxt_char = msg[i++];
}
}
///////////////////////////////////////////
SendMsg("HELLO");
SendMsg("\r\n");
Hello,
It would seem that this is a hardware configuration issue with your board. I assume that the board includes a USB to RS232 converter or adaptor. The output from the MCU will be generated by the SCI module.
Incidently, your SendMsg() function might be simplified somewhat. It is also a good idea to initialise all the SCI control registers within the InitSCI() function.
void SendMsg( char *msg){ while (*msg) { // Test for non-null character while (!SCIS1_TDRE); // Wait until ready to send SCID = *msg; // Send next character msg++; // Increment pointer }}
Regards,
Mac