Deepika A

printf - MC68HC908BQ8

Discussion created by Deepika A on Nov 21, 2007
Latest reply on Nov 23, 2007 by Deepika A
Hi everyone,
I am using codewarrior IDE Version 5.9.0. And controller is MC68HC908BQ8.
I want to print the data of a global variable, I have included stdio.h and compiled
the compiler error I got was

"Symbol TERMIO_PutChar in file C:\Program Files\Freescale\CodeWarrior for Microcontrollers V6.0\lib\hc08c\lib\ansii.lib is undefined"

So I have included termio.c file and terminal.c  the program get comiled but I got run time error at location 

Error: At location 0203 -
Error: Attempt to use invalid or uninitialized memory

I got this error when I tried to execute the line in Bold

    while (!(SCI.SCSR & 0x80)) {};    /* wait for output buffer empty */
    SCI.SCDR = ch;"

This code is termio.c file


And I got this code from the forum and tried to compile
#include <hidef.h>
#include <stdio.h>
#include <termio.h>
char buf[20];
int bufpos;
void TERMIO_Init(void) {
void TERMIO_PutChar(char ch) {
buf[bufpos]= ch;
if (bufpos >= sizeof(buf)) {
bufpos -= sizeof(buf);
int dtTarget= 2;
void main(void) {
(void)printf("SP %u\n\r", dtTarget );
while (1) { _FEED_COP(); }
I got error as "Link Error   : L1102: Out of allocation space in segment RAM at address 0x11E".
Can someone provide the piece of code to print.