sending HELLO WORLD message via RS232 on DEMO9S08LL16

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

sending HELLO WORLD message via RS232 on DEMO9S08LL16

1,690 Views
Mirak
Contributor I

Hello,

I am trying to send a HELLOWORLD message via the RS232 port of the DEMO9S08LL16 DEMOBOARD. But actually, i'm not finding how. :smileysad:

 

Can anyone tell me what to do to make this work?

Labels (1)
0 Kudos
5 Replies

552 Views
Witztronics
Contributor IV

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.

0 Kudos

552 Views
Mirak
Contributor I

thank you =)

but anybody have another solution without the use of processor expert?

sorry but i'm a noob :/

0 Kudos

552 Views
kef
Specialist I

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"

0 Kudos

552 Views
Mirak
Contributor I

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... :smileysad:


/////////////////////////////////////////////////////////////////////////////////////////
// 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");


0 Kudos

552 Views
bigmac
Specialist III

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

 

0 Kudos