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

📄 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)
{
}


void Delay_NS(uint32 dly)
{
    uint32 i;
    for(; dly > 0; dly--)
    {
        for(i = 0; i < 50000; i++);
    }
}

/*********************************************************************************************************
** Function name:           Main
**
** Descriptions:            外部中断1唤醒CPU,但不产生中断
**
** input parameters:        None
** Returned value:          None
**         
**
** Created by:              Chenmingji
** Created Date:            2006/02/22
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void Main(void)
{
    TargetInit(VPBDIV_DATA, PLLCFG_DATA, MAMTIM_DATA);      // don't delete
    while((PLLSTAT & (1 << 10)) == 0);                      // can delete
    
    PINSEL0 = 0;
    PINSEL1 = 0;
    
    IO0DIR = BEEP;
    IO0SET = BEEP;
    
    SetExtInt(1, 0, 1);		 //使能外部中断1,低电平触发,使能唤醒CPU功能
    						 //由于没有调用SetISR函数使能外部中断1,故在产生外部中断时不会产生中断而只会唤醒CPU
    while(1)
    {
        PCONP = 0x00;		 //进入掉电模式
        PCON = 0x02;
        
        IO0CLR = BEEP;		  //唤醒后鸣叫一声
        Delay_NS(10);
        IO0SET = BEEP;   
       
        while(IsExtInt(1))     //等待P0.14脚恢复为高电平
        {   
            CleanExtIntFlg(1); //清零EXTINT`中断标志
        }     
    }
    
}


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

⌨️ 快捷键说明

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