printf  with  void TERMIO_PutString(const char *p)      (mc9s12dp256)

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

printf  with  void TERMIO_PutString(const char *p)      (mc9s12dp256)

Jump to solution
2,435 Views
Snail_cz
Contributor I

Hi,

I am trying to use printf function. It works with “void TERMIO_PutChar(char ch);”, but I need whole string at once. So, I want to use this function: “void TERMIO_PutString(const char *p);”. It doesn’t work even I define this string: “_TERMIO_HAS_PUT_STRING_”.

The original function definition in TERMIO.h:

#ifdef _TERMIO_HAS_PUT_STRING_
  void TERMIO_PutString(const char *p);
#endif

I tried somethnig like this:

void TERMIO_PutString(const char *p){
  while(*p){
     vSCI0_send( (signed char) *p);
     p++;
  }
}

Thanks,

Excuse my English.

Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
1,277 Views
CrasyCat
Specialist III

Hello

 

This is just a function prototype for a function that can be called by printf to write output to stdout as a whole string.

 

Idea here is that printf is ready to support that as soon as a programmer implements such a function.

As stated in my previous email the fact that you want to send the whole string at once is probably a requirement from the device you want to use for stdout.

 

So you need to write the driver for that device.

 

The SCI we are using as stdout in TermIO.c can only transfer one character at a time. So there is no reason for implementing a PutString function there.

 

CrasyCat

View solution in original post

0 Kudos
Reply
3 Replies
1,277 Views
Snail_cz
Contributor I

Hi,

ok, thank you.

And do you know why in this file (TERMIO.h) is a definition for this function ?

0 Kudos
Reply
1,278 Views
CrasyCat
Specialist III

Hello

 

This is just a function prototype for a function that can be called by printf to write output to stdout as a whole string.

 

Idea here is that printf is ready to support that as soon as a programmer implements such a function.

As stated in my previous email the fact that you want to send the whole string at once is probably a requirement from the device you want to use for stdout.

 

So you need to write the driver for that device.

 

The SCI we are using as stdout in TermIO.c can only transfer one character at a time. So there is no reason for implementing a PutString function there.

 

CrasyCat

0 Kudos
Reply
1,277 Views
CrasyCat
Specialist III

Hello

 

THere is no implementation of TERMIO_PutString available in the layout.

You have to implement it yourself.

 

If you need ability to send the whole string at once, you are probably using something else as a SCI as standard output.

In this case you need to write the low level function for your peripheral yourself.

Implementation will depend on the peripheral used.

 

CrasyCat

0 Kudos
Reply