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

📄 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

#define EXTINT1_NO   15             //外部中断1的中断号
#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 < 5000; i++);
    }
}


/******************************************************************************************
**函数名称:ExtInt1_ISR
**功能描述:外部中断1中断服务函数
******************************************************************************************/
void ExtInt1_ISR(void)
{ 
    IO0CLR = BEEP;		   //蜂鸣器鸣叫
	Delay_NS(100);
    while(IsExtInt(1))     //等待P0.14脚恢复为高电平
    {    
        CleanExtIntFlg(1); //清零EXTINT1中断标志
    }
    IO0SET = BEEP;		   //关闭蜂鸣器

    
    VICVectAddr = 0;      //退出中断服务函数              
}

/*********************************************************************************************************
** 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(EXTINT1_NO, 0, (unsigned int)ExtInt1_ISR);//调用SetISR函数使能外部中断1,唤醒CPU的同时产生中断
    IRQEnable();             //打开中断
    
    while(1)
    {
        PCONP = 0x00;		 //进入掉电模式
        PCON = 0x02;
    }  
}


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

⌨️ 快捷键说明

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