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

📄 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控制BEEP
/*********************************************************************************************************
** 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(uint32 dly)
**
**功能描述: 延时函数
********************************************************************************************************/
void Delay(uint32 dly)
{
	uint32 i;
	for(;dly > 0; dly--)
	{
		for(i = 0; i < 5000; i++);
	}
}


/*********************************************************************************************************
**函数名称:  Main( )
**
** 功能描述:  利用RTC的定时报警功能驱动蜂鸣器鸣叫
********************************************************************************************************/
void Main(void)
{
    RTCtime  time;
    TargetInit(VPBDIV_DATA, PLLCFG_DATA, MAMTIM_DATA);      // don't delete
    while((PLLSTAT & (1 << 10)) == 0);                      // can delete
    
    IO0DIR = BEEP;
    IO0SET = BEEP;
    
    RTCInit(1);	     //初始化RTC,使用外部的32.768KHz
    
    time.sec = 31;
    time.min = 59;
    time.hour = 23;
    time.day = 27;
    time.week = 1;
    time.month = 2;
    time.year = 2006;
    
    SetRTCtime(time);	  //设置时间值
    SetAMR(0xFE);        // 仅使能秒值匹配报警
    SetAlarmTime(0,30);  // 设置秒匹配值为30,每当秒值等于30时就报警一次
    CIIR = 0;
    while(1)
    {
        if(ILR & 0x02)
        {
           
            IO0CLR = BEEP;
			Delay(1000);
            IO0SET = BEEP;
            
            ILR = 0x02;		  //清零报警中断标志
        }
    }
     
}


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

⌨️ 快捷键说明

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