I have a problem with the printf fonction

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

I have a problem with the printf fonction

Jump to solution
1,431 Views
Juliendy
Contributor I

Hello,

 

I have a problem with the printf fonction.

I'm sorry for my bad english

 

My program is :

 

#include <hidef.h>

#include "derivative"

#include <stdio.h>

#include <termio.h>

 

int x=0;

 

int main(void)

{

  for(;:smileywink:

  {

    if(x<20)

    {

      printf("%d\n",x);

      x++;

      return 0;

    }

  }

}

///////////////////////////////////////////////////////////////////////////////////////////

 

On HyperTerminal, I don't receive the printf.

 

I believe that my program is in the loop "while (!(SCI.SCxSR1 & 0x80) )  {};" in the termio.c.  WHY ???

 

By default, what is the port used, SCI0 or SCI1 ?

 

How do I configure the connection in hyperterminal, knowing that I have a MC9S12DG128 ?

 

Best Regards

Julien

Labels (1)
0 Kudos
Reply
1 Solution
725 Views
CompilerGuru
NXP Employee
NXP Employee

The termio.c contains a routine TERMIO_Init for the setup, it might need to be adapted for the hardware.

Alternatively Processor Expert (or Device Initialization) can be used to setup the sci module.

 

Daniel

View solution in original post

0 Kudos
Reply
3 Replies
725 Views
WadeH
Contributor III

I don't see any harware initialization: somewhere in your code should be a line like:

 

   Initialize_SCI();

 

 

.. or something similar, possibly including a baud-rate setting, parity-type, etc

 

Look into demo code for your CPU

 

 

 

0 Kudos
Reply
726 Views
CompilerGuru
NXP Employee
NXP Employee

The termio.c contains a routine TERMIO_Init for the setup, it might need to be adapted for the hardware.

Alternatively Processor Expert (or Device Initialization) can be used to setup the sci module.

 

Daniel

0 Kudos
Reply
725 Views
Juliendy
Contributor I

thank you for your answer, it's OK for the printf.
The baud rate was bad in TERMIO_Init().

 

Best Regards

Julien

0 Kudos
Reply