⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 根据freescale XXDZ60的多用途时钟发生器的设置原理
💻 C
字号:
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */


 void PeriphInit(void)
{
										
  // Clear COP Watchdog timeout
  SOPT1 = 0x00;
  
  // Select FBE MCG mode (IREFS=0, CLKS=10)
  MCGC1 = 0xB8;
  // LP=0 and selects external high frequency crystal clock  		                
  MCGC2 = 0x36;
  // PLLS=0
  MCGC3 = 0x00;
  // Wait until the initialization cycle of the external crystal clock is completed 
  while(!(MCGSC&0x02))
    {
  
  // Set TJA1040 CAN transceiver in normal mode operation (STB LOW) 
  PTDD = 0x00;
  PTDDD = 0x55;   
    }
  
 }

void main(void) {
  unsigned int wCount;
  
  EnableInterrupts; /* enable interrupts */
  /* include your code here */
 /// PTDDD = 0xFF;
  ///PTDD = 0x55;

  PeriphInit();
 
  for(;;) 
  {
    for (wCount = 0; wCount < 0xfff0; wCount++) 
    { }     
      if (PTDD == 0x55) 
         {
           PTDD = 0xA6;
         }
      else 
        {
          PTDD = 0x55;
        }
     
    __RESET_WATCHDOG(); /* feeds the dog */
  } /* loop forever */
  /* please make sure that you never leave main */
}

⌨️ 快捷键说明

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