main.c

来自「Freescale Code Warrior中C的编程」· C语言 代码 · 共 48 行

C
48
字号
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */


void MCU_init(void); /* Device initialization function declaration */

void main(void) {
  /* include your code here */
 /*
  0.0000000000
    ||||||||||___________    0.0009765625
    |||||||||____________    0.001953125
    ||||||||_____________    0.00390625
    |||||||______________    0.0078125
    ||||||_______________    0.015625
    |||||________________    0.03125
    ||||_________________    0.06125
    |||__________________    0.125
    ||___________________    0.25
    |____________________    0.5   */
    

  /* Uncomment this function call after using Device Initialization
     to use the generated code */
  /* MCU_init(); */
  unsigned int A,B;
  
  A = 0xB32F;
  
  EnableInterrupts; /* enable interrupts */

    
  //0.378 = 0.25 + 0.125 + 0.001953125
  
  // what about 3.1416? or
  // what about 0.672?
  
  for(;;) {
  
    // B = 0.378 * A
    
    B = (A>>2)+(A>>3)+(A>>9);

    __RESET_WATCHDOG(); /* feeds the dog */
  } /* loop forever */
  /* please make sure that you never leave this function */
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?