Rewriting putchar() on MSP430F149

I think, that only reasonable way to make terminal connection between MSP430F149 PC, is to rewrite low-level fuction putchar() to use USART and let upper-level functions like printf() to make all the conversions needed. I'm using IAR and/or mspgcc. How do I replace putchar.o in library files needed, and what are those lib-files in both systems?

Reply to
ispe
Loading thread data ...

I use uprintf() which sends output one character at a time to a designated function. In my case the designated function is one I wrote myself and contains low level code to push characters out through the UART. I have this function in my program so it is not a library as such.

My print statements look like this: uprintf(my_designated_function, "Hello world" );

Let me know if you would like more detail.

Regards JC

Reply to
Joseph Casey

With IAR putchar() calls some function _cantrember(), IIRC. This function can be declared anywhere in your project.

It must be somewhere in the IAR help. I don't have IAR at home, but I will look it up at work tomorrow (if I don't forget ;-)

/Jan-Hinnerk

Reply to
Jan-Hinnerk Reichert

It is quite easy, and documented in the configuration section of the C compiler reference manual. The putchar() function calls __low_level_put() into which you put your serial transmit function call. In my case:

static void __low_level_put( int Character ) { USART_0_TX_Char( (unsigned char) Character ) ; }

IAR have an app note on the web site that covers the use of the serial port quite comprehensively and includes the implementation of a buffered, interrupt driven serial interface.

Ian

Reply to
ian_okey

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.