main.c
来自「DP256_HCS12_PLL锁相环驱动程序」· C语言 代码 · 共 67 行
C
67 行
/***************************************************************************************
*
* (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 + =
减小字号Ctrl + -
显示快捷键?