When creating a new project, if stdio is chosen, the project generator includes an assembly file lowlvl.src which includes the primitives that will be used by the stdio functions calls like printf etc. However, these primitive only support a SIM I/O which simply write and read from a memory a location, i.e. you cannot write or read from a UART using the included primitives in the file lowlvl.src.
In order to use a UART for stdio functions, the lowlvl.src file has to be rewritten. This requires only a few lines of code and the below link shows an application note that deals with exactly this issue.
http://eu.renesas.com/media/products/software_and_tools/coding_tools/european_pdfs/app20050307-02.pdf http://eu.renesas.com/media/products/software_and_tools/coding_tools/european_pdfs/app20050307-02.pdf
-Michael
Actually, the pdf isn't entirely correct.
Removing the lowlvl.src file requires you to re-implement additional functions, for example if you are using printf then you will need to implement the write function in addition to the charput function.
Ive included a zip file Serial_IO_1664.zip that uses the previously mentioned application note to implement stdio functions over the SCI. ÂÂ
This program communicates from H8SX1664 to a terminal program via SCI0 and RS232.
  SCI0 configuration is: 19200 baud, 8 data bits, 1 stop bit, no parity.
  To use the program connect to an RSK H8SX1664, download the program, connect the serial port to the PC,
  and create a terminal session with the above parameters. Run the sample program on the board.
 ÂÂ
  Strings typed in the terminal program are read in and printed back using stdio function calls "scanf" and "printf"
  The file lowlvl.c contains functions charget(), charput() and puts() using SCI0.
  This file is a replacement for the lowlvl.src file that implements the same functions over SIM I/O.
  The lowlvl.src file has been excluded from this build. If this file is included in order to use SIM I/O, be sure to
  exclude lowlvl.c from the build.
  To view the SIM I/O window, select the Sim session from the session pulldown window, and then select
  the Simulated I/O window (Ctrl+Shift+I) from View>>CPU menu. This window can be used to type in strings and display them,
  just as you would on a terminal session.
Hello, I am new in the H8S environment. I tried to use the STDIO printf() function to print out message to UART but couldn't get it working using the latest HEW with new v7 compiler. Can someone tell me the syntax of the write() function call? The charput() routine didn't get called by printf() directly. Also, where can I download the "Serial_IO_1664.zip" file? Thanks for help!!
©2003–2010 Renesas Electronics Corporation. All rights reserved. Using Our Website | Privacy
Contact us