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

📄 main.c

📁 DP256_HCS12_PLL锁相环驱动程序
💻 C
字号:
/***************************************************************************************
*					             
*		(c) copyright 2005,Tongji-Freescale Automobile Electronic Aligned Lab,ShangHai,China
*
*						         All Rights Reserved
*
*
* File Name				: RTI&TIMER
*
* Programmer(s)			: Wukai
*	
* Date Created			: 2005.07.16
*
* Current Revision		: V1.0
*
* Modification History	: 
*
* Description			: 
*
***************************************************************************************/

#include <hidef.h>      /* common defines and macros */
#include <mc9s12dp256.h>     /* derivative information */


#pragma LINK_INFO DERIVATIVE "mc9s12dp256b"


/*PORTS初始化程序*/
void PORTSInit(void)		
{
  DDRS=0xff;						/*PORTS定义为输出*/
  PTS=0xff;						  /*初始化为高,LED灭*/	
}

void main(void) 
{
  unsigned int count=0;
  unsigned char count1=0;
  
  DisableInterrupts;      /*关全局中断*/
  PORTSInit();
  
  
    
  /*PLL setup*/
  PLLCTL_PLLON=0; /*PLL off*/  
	SYNR=0;
	REFDV=0;				/*PLLCLK times (2+1)/(1+1)=3/2*/
	PLLCTL_AUTO=1;  //AUTO mode
	PLLCTL_PLLON=1; /*PLL on*/
	while(!CRGFLG_LOCK){}
	CLKSEL_PLLSEL = 1;		/*Use PLL,OSCCLK =16M,PLLCLK=32M*/
  
  
  EnableInterrupts;				/*开全局中断*/
  for(;;)/*循环等待*/
  {
    for(count=0;count<65535;count++)
    for(count1=0;count1<20;count1++)
    {
      asm NOP;
    }
    
    PTS_PTS2=~PTS_PTS2;
  }
}

⌨️ 快捷键说明

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