I have a problem with the printf fonction

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

I have a problem with the printf fonction

跳至解决方案
1,432 次查看
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 解答
726 次查看
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 回复数
726 次查看
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 项奖励
回复
727 次查看
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 项奖励
回复
726 次查看
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 项奖励
回复