📄 main.c
字号:
/***********************************************Copyright (c)*********************************************
** Guangzou ZLG-MCU Development Co.,LTD.
**
** http://www.zlgmcu.com
**
**--------------File Info---------------------------------------------------------------------------------
** File name: main.c
** Last modified Date: 2007-09-20
** Last Version: 1.0
** Descriptions: The main() function example template
**
**--------------------------------------------------------------------------------------------------------
** Created by:
** Created date:
** Version:
** Descriptions:
**
**--------------------------------------------------------------------------------------------------------
** Modified by:
** Modified Date:
** Version:
** Descriptions:
**
*********************************************************************************************************/
#include "config.h"
/*********************************************************************************************************
** Function name: main
** Descriptions: 用户主函数,用户写程序需要注意以下几个步骤
** 1.用户要对自己操作的管脚进行管脚功能设置,设置文件为pinConfig.h
** 2.如果用户代码需要中断,需要打开内核中断,函数为:IRQEnable(); FIQEnable();
** 3.用户有中断,需要设置VIC,设置函数请参考IRQManage.h
** 4.其他功能实现用户可参考相关驱动的头文件或使用说明文档
** Input parameters: NONE
** Output parameters: NONE
** Returned value: NONE
*********************************************************************************************************/
void timeDlyUs (uint32 uiDly)
{
uint32 i;
uint32 j;
for(i = 0; i < uiDly; i++) {
for(j = 0; j < 10000; j++);
}
}
/*********************************************************************************************************
** Function name: main
** Descriptions: 用户主函数,用户写程序需要注意以下几个步骤
** 1.用户要对自己操作的管脚进行管脚功能设置,设置文件为pinConfig.h
** 2.如果用户代码需要中断,需要打开内核中断,函数为:IRQEnable(); FIQEnable();
** 3.用户有中断,需要设置VIC,设置函数请参考IRQManage.h
** 4.其他功能实现用户可参考相关驱动的头文件或使用说明文档
** Input parameters: NONE
** Output parameters: NONE
** Returned value: NONE
*********************************************************************************************************/
int main (void)
{
uint8 temp[40];
uint32 i;
IRQEnable(); /* 开中断 */
memset( temp, 0, 40);
uartInit(0, "BaudRate=9600 DataBits=8 StopBits=1 Parity=NONE RtsControl=NONE", NULL);
irqVicSet(UART0_VIC, 3, uart0Isr); /* 设置串口优先级 */
if (rtcInit(0, "Outclk=1", NULL) != 1) {
rtcTimeSet(0, "Year=2007 Month=11 Day=24 Hour=12 Min=49 Sec=20", NULL);
}
rtcModeSet(0, RTC_MODE_ALARM, "Year=2007 Month=11 Day=24 Hour=12 Min=49 Sec=40");
/* 设置报警时间 */
irqVicSet(RTC_VIC, 4, rtcIsr); /* 设置RTC优先级 */
/* 设置当前时间 */
while (1) {
rtcTimeGet(0, (char*)temp, NULL);
uartWrite(0, temp, strlen((char*)temp), NULL); /* 输出测试时间 */
for ( i = 0; i < 5000000; i++);
}
return 0;
}
/*********************************************************************************************************
END FILE
*********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -