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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

ソリューションへジャンプ
2,431件の閲覧回数
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.

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,273件の閲覧回数
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 件の賞賛
返信
3 返答(返信)
1,273件の閲覧回数
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 件の賞賛
返信
1,274件の閲覧回数
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 件の賞賛
返信
1,273件の閲覧回数
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 件の賞賛
返信