SCI port and printf()

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

SCI port and printf()

ソリューションへジャンプ
5,981件の閲覧回数
gautier
Contributor II
Hello,
 
I use codewarrior to program a MC9S12 and I use the software stationnery.
 
The exemple for communicate with a hyperterminal running correctly.(SerialCommProject_DP256.mcp)
 
But it's run with the SCI0 port and I want to use the SCI1 port of the microcontroller.
 
 
I don't understand what modification must be execute to use printf() function on the SCI1 port.
 
Can you help me to solve this problem??
 
Thanks for your answers.
 
 
ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
1,025件の閲覧回数
CrasyCat
Specialist III
Hello
 
Low level PutChar & GetChar functions are implemented in file termio.c, which is located in your {Install}\lib\hc12c\src directory.
To use SCI1 as stdout, you have to create a new source file (termio_SCI1 for example) where you implement the TERMIO_PutChar, TERMIO_GetChar and TERMIO_Init for SCI1.
 
Then just add your own terminal io file (termio_SCI1.c in your project and remove Termio.c.
 
This should do it.
 
CrasyCat

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
1,025件の閲覧回数
gautier
Contributor II
thanks for your answer, I will try to do that, but Do you think the twice SCI port can be active in the same time??
0 件の賞賛
返信
1,025件の閲覧回数
CrasyCat
Specialist III
Hello
 
No you have to decide if you want to use SCI0 or SCI1 as stdout.
Only 1 stdout can be used at a given time.
 
Also once the application is running, there is no library function allowing you to
switch easily to another stdout.
 
Now if you want to have the same output on both SCI port, just change the code to send the same character to both port. SCI0 first and then SCI1.
 
For reading this might be more complicated. I am even not sure it can work.
I hope this helps. 
 
CrasyCat
0 件の賞賛
返信
1,025件の閲覧回数
gautier
Contributor II

Okay it's what I have just discover with an anlyse of termio.C

But I think it's possible to use SCI0 with termio and SCI1 with others functions using sprintf() or to put the text in a buffer and after ussing this buffer to put on SCI1 port.

 

Do you thinks this is a solution is hardly to realise ???????

 

0 件の賞賛
返信
1,025件の閲覧回数
CrasyCat
Specialist III
No this is fine too and should be working.
Just you cannot use printf for both port.
 
You can use printf for one and then some separate function to write to the other port.
 
CrasyCat
0 件の賞賛
返信
1,026件の閲覧回数
CrasyCat
Specialist III
Hello
 
Low level PutChar & GetChar functions are implemented in file termio.c, which is located in your {Install}\lib\hc12c\src directory.
To use SCI1 as stdout, you have to create a new source file (termio_SCI1 for example) where you implement the TERMIO_PutChar, TERMIO_GetChar and TERMIO_Init for SCI1.
 
Then just add your own terminal io file (termio_SCI1.c in your project and remove Termio.c.
 
This should do it.
 
CrasyCat
0 件の賞賛
返信