I have a problem with the printf fonction

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

I have a problem with the printf fonction

ソリューションへジャンプ
1,470件の閲覧回数
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

ラベル(1)
0 件の賞賛
返信
1 解決策
764件の閲覧回数
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 件の賞賛
返信
3 返答(返信)
764件の閲覧回数
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 件の賞賛
返信
765件の閲覧回数
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 件の賞賛
返信
764件の閲覧回数
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 件の賞賛
返信