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

📄 main.c

📁 周立功2103开发板CD资料
💻 C
字号:
/****************************************Copyright (c)**************************************************
**                               Guangzhou ZHIYUAN electronics Co.,LTD.
**                                 http://www.zyinside.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name:           main.c
** Last modified Date:  2006-02-22
** Last Version:        1.0
** Descriptions:        header file of the specific codes for LPC2200 target boards
**              Every project should include a copy of this file, user may modify it as needed
**------------------------------------------------------------------------------------------------------
** Modified by: 
** Modified date:
** Version: 
** Descriptions: 
**
********************************************************************************************************/

#define IN_MAIN
#include "config.h"
#include "ExtInterrupt.h"	//外部中断软件包

#define  BEEP  1 << 7                            //P0.7控制BEEP

#pragma import(__use_no_semihosting_swi)        //don't delete this line
/*********************************************************************************************************
** Function name:			IRQ_Exception
**
** Descriptions:			interrupt exceptional handler , change it as needed
**                          don't delete this function 
** input parameters:		None
** Returned value:			None
**         
**
** Created by:				Chenmingji
** Created Date:			2006/02/22
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void  IRQ_Exception(void)
{
}



/**************************************************************************************
** 函数名称:	DelayNS(uint32 dly)
** 功能描述:	延时函数
** 输入参数:   dly     延时值
** 输出参数:	无
** 返回值:	无 
****************************************************************************************/
void DelayNS(uint32 dly)
{
    uint32 i;
    for(; dly > 0; dly--)
        for(i = 0; i < 5000; i++);
}


/*********************************************************************************************************
** Function name:           Main
**
** Descriptions:            掉电唤醒后重新连接PLL
**
** input parameters:        None
** Returned value:          None
**         
**
** Created by:              Chenmingji
** Created Date:            2006/02/22
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void Main(void)
{
    uint32 i;
    
    TargetInit(VPBDIV_DATA, PLLCFG_DATA, MAMTIM_DATA);      // don't delete
    while((PLLSTAT & (1 << 10)) == 0);                      // can delete
    
    PINSEL1 = 0;			     
    IO0DIR = BEEP;
    IO0SET = BEEP;
    
    SetExtInt(1, 0, 1);                     //设置外部中断1低电平唤醒CPU
    
    for(i = 0; i < 10; i++)
    {
        IO0CLR = BEEP;
        DelayNS(100);
        IO0SET = BEEP;
        DelayNS(100);
    }
    
    PCONP = 0;							   //关闭定时器、RTC和Uart等功能部件
    PCON = 0x02;						   //系统进入掉电模式
    
    /*P0.14脚唤醒CPU*/
    /*实验分两次进行,第一次不进行PLL重新设定,观察掉电前和唤醒后BEEP鸣叫的间隔频率;
      第二次加上PLL重设定,再次观察掉电前和唤醒后的BEEP鸣叫的间隔频率*/
      
/* 
	//若要重设定PLL ,请反注释掉该段程序。

    PLLCON = 1;							  //使能PLL
    PLLCFG = 0x23;						  //设置M=4,P=2,和掉电前一样
    PLLFEED = 0xAA;						  //发送PLL馈送序列
    PLLFEED = 0x55;
    while((PLLSTAT & (1 << 10)) == 0);    //等待PLL锁定
    PLLCON = 3;							  //PLL使能和连接
    PLLFEED = 0xAA;						  //发送PLL馈送序列
    PLLFEED = 0x55;
*/
    
    
    //唤醒后BEEP鸣叫10次,注意间隔频率
    for(i = 0; i < 10; i++)
    {  
        IO0CLR = BEEP;
        DelayNS(100);
        IO0SET = BEEP;
        DelayNS(100);
    }
    
    while(1);
}


/*********************************************************************************************************
**                            End Of File
********************************************************************************************************/

⌨️ 快捷键说明

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