SCI port and printf()

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

SCI port and printf()

Jump to solution
5,702 Views
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.
 
 
Labels (1)
Tags (1)
0 Kudos
1 Solution
746 Views
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

View solution in original post

0 Kudos
5 Replies
746 Views
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 Kudos
746 Views
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 Kudos
746 Views
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 Kudos
746 Views
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 Kudos
747 Views
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 Kudos