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

📄 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 "RTC.h"

#pragma import(__use_no_semihosting_swi)        //don't delete this line



#define BEEP 1<<7    //P0.7控制蜂鸣器

/*********************************************************************************************************
** 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 RTC_Int(void)
**功能描述:RTC中断服务函数
********************************************************************************************************/
void RTC_Int(void)
{
    if((IO0SET & BEEP) == 0) 
    {
        IO0SET = BEEP;
    }
    else
    {
        IO0CLR = BEEP;
    }
    
    ILR = 0x03;
    VICVectAddr = 0;
}

/*********************************************************************************************************
**函数名称:  Main
**功能描述:  利用RTC产生秒中断以驱动蜂鸣器发声
********************************************************************************************************/
void Main(void)
{
    TargetInit(VPBDIV_DATA, PLLCFG_DATA, MAMTIM_DATA);      // don't delete
    while((PLLSTAT & (1 << 10)) == 0);                      // can delete
    PINSEL0 = 0;
    IO0DIR = BEEP;
    IO0SET = BEEP;
    
    IRQEnable();
    
    RTCInit(0);      //VBP作为RTC时钟源
    CIIR = 0x01;     //设置秒值的增量产生一次中断
    
    SetISR(13,0,(unsigned int)RTC_Int);
     
    while(1);
}


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

⌨️ 快捷键说明

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