📄 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"
#define LED1 (0x01 << 20) /* 定义蜂鸣器控制引脚 */
/*********************************************************************************************************
** Function name: delayNS
**
** Descriptions: 延时函数
**
** input parameters: uiDly 延时参数
** Returned value: none 无
**
*********************************************************************************************************/
void delayNS (uint32 uiDly)
{
uint32 i;
for ( ; uiDly > 0; uiDly--) {
for (i = 0; i < 0xFFFF; i++){
}
}
}
/*********************************************************************************************************
** 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)
{
char *pMat ="MatN=0 MatTime=500000 MatCtrlMode=1 MatInt=1 MatOut=0";
/* 以us为单位,中断,下降沿,通道0*/
IO0DIR |= LED1;
IO0SET |= LED1;
timeReset(3,(void*)NULL); /* 功能寄存器复位,以防意外 */
/*
* 匹配产生中断,中断服务程序中对LED1的输出取反
*/
timerMatInit (3,pMat,(void*)NULL); /* 定时器匹配初始化 */
if (irqVicSet(TIMER3_VIC,0,timer3Isr) != -1) { /* VIC中断设置 */
/* 设置成功 */
IRQEnable(); /* 打开IRQ内核中断 */
timerStart(3,NULL); /* 启动定时器工作 */
}
while (1) {
}
return 0;
}
/*********************************************************************************************************
END FILE
*********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -