在线时间60 小时
UID399382
注册时间2012-11-5
NXP金币38
TA的每日心情 | 慵懒 2021-8-31 12:39 |
---|
签到天数: 5 天 连续签到: 1 天 [LV.2]偶尔看看I
高级会员

- 积分
- 561
- 最后登录
- 2025-7-21
|
- /* ###################################################################
- ** Filename : main.c
- ** Project : FRDM-KL46Z-ConsoleIO
- ** Processor : MKL46Z256VLL4
- ** Version : Driver 01.01
- ** Compiler : GNU C Compiler
- ** Date/Time : 2014-11-07, 06:26, # CodeGen: 0
- ** Abstract :
- ** Main module.
- ** This module contains user's application code.
- ** Settings :
- ** Contents :
- ** No public methods
- **
- ** ###################################################################*/
- /*!
- ** @file main.c
- ** @version 01.01
- ** @brief
- ** Main module.
- ** This module contains user's application code.
- */
- /*!
- ** @addtogroup main_module main module documentation
- ** @{
- */
- /* MODULE main */
- /* Including needed modules to compile this module/procedure */
- #include "Cpu.h"
- #include "Events.h"
- #include "CsIO1.h"
- #include "IO1.h"
- #include "LED_GREEN.h"
- #include "BitIoLdd1.h"
- #include "LED_RED.h"
- #include "BitIoLdd2.h"
- #include "SW1.h"
- #include "SW1_Bit.h"
- #include "BitIoLdd3.h"
- #include "MMA8451.h"
- /* Including shared modules, which are used for whole project */
- #include "PE_Types.h"
- #include "PE_Error.h"
- #include "PE_Const.h"
- #include "IO_Map.h"
- /* User includes (#include below this line is not maintained by Processor Expert) */
- #include "PORT_PDD.h"
- /*lint -save -e970 Disable MISRA rule (6.3) checking. */
- int main(void)
- /*lint -restore Enable MISRA rule (6.3) checking. */
- {
- /* Write your local variable definition here */
- int i = 0, count = 10;
- float j = 1.01,k = 0.99;
- char a = 10;
- /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
- PE_low_level_init();
- /*** End of Processor Expert internal initialization. ***/
- /* Write your code here */
- LED_GREEN_PutVal(1);
- LED_RED_PutVal(1);
- while(1)
- {
- // i = 500000;
- // while(i--);
- // LED_GREEN_PutVal(1);
- // if(SW1_Bit_GetVal() == 0)
- // {
- // LED_GREEN_PutVal(0);
- // printf("\rcount = %d ",count++);
- // while(0 == SW1_Bit_GetVal());
- // LED_GREEN_PutVal(1);
- // }
- <font color="#ff0000"> printf("%d,%f,%f\n",i,j,k);</font>
- LED_GREEN_NegVal();
- }
- /* For example: for(;;) { } */
- /*** Don't write any code pass this line, or it will be deleted during code generation. ***/
- /*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/
- #ifdef PEX_RTOS_START
- PEX_RTOS_START(); /* Startup of the selected RTOS. Macro is defined by the RTOS component. */
- #endif
- /*** End of RTOS startup code. ***/
- /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/
- for(;;){}
- /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
- } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
- /* END main */
- /*!
- ** @}
- */
- /*
- ** ###################################################################
- **
- ** This file was created by Processor Expert 10.4 [05.10]
- ** for the Freescale Kinetis series of microcontrollers.
- **
- ** ###################################################################
- */
复制代码 以上是我FRDM—KL46Z板子的代码,但是printf("%d,%f,%f\n",i,j,k); %f打印出来的结果为空。
请问如何设置prinf允许浮点输出啊?
|
|