Hello
Where are you trying to write to?
Do you want to write to the target SCI port?
In that case just add the file {Install}\lib\hc12c\src\termio.c to your project.
If you want to redirect stdout anywhere else, you will have to provide an implementation of the low level write function in your own termio.c.
I hope this helps.
CrasyCat
Hi,
Been wading through various posts about printf, PRINTF (for the simulator/debugger) and termio.
My setup:
CW 5.9.0
PE 2.98 for HCS12SX
MCU12XDP512
I have a softek kit for my MCU. i use SCI0 to connect to a peripheral device. The SCI0 code is autogenerated by PE.
While debugging, i needed to see what's arriving at my SCI0. I therefore use the Terminal Component as a Virtual SCI.All good.
I aslo need to call printf at various points in my code (for debugging only) and see the output on Terminal. So i add the termio.c mentined in the previous post. Works fine, the output appears on the same Terminal used above.
My questions:
1.I did not modify termio.c so it's apparently using SCI0. Does this mean all printfs are also redirected to the SCI0 uart as well? I don't want this to happen.
2.If yes, then i need to change the SCI_ADDR in termio.c to point to another (unused) uart. Where can i find the address of my uarts? The current defintion is :
#define SCI_ADDR 0x00c8
3.Do i need to add a new Terminal component to see the printfs in case point 1 is true?
Thanks.
UPDATE:
Think i made a mistake. The Terminal component seems to work only in simulation mode! Not while debuggin on the softked board. How do i see what's being received on my SCI0?
Hello
If you are debugging on real hardware you need to connect your board SCI0 connector with one of the PC serial port using a RS232 cable.
Once this is done, you need to configure the Terminal.
- Click right inside of the terminal window
- Select "Configure Connections ..."
- In the "Configure Terminal Connection" dialog set "Default Configuration" to "Serial Port"
- Set "Serial Port" and "Baud Rate" according to your configuration (in the provided termio.c, baud rate is configured
to 9600 Baud.
To go back to our initial question, yes printf will be sent to terminal using SCI0.
If you want to use an alternate serial port, you need to use another serial port on your chip.
Please refer to the microcontroller reference manual to find our address of the other serial port.
If you intend to use another serial port for printf, make sure to connect this SCI with your Host PC serial port.
CrasyCat
"If you intend to use another serial port for printf, make sure to connect this SCI with your Host PC serial port."
Thanks, that seems to do the trick