📄 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: delayNS
** Descriptions: 长软件延时
** Input parameters: dly 延时参数,值越大,延时越久
** Output parameters: NONE
** Returned value: NONE
*********************************************************************************************************/
void delayNS (uint32 dly)
{
uint32 i;
for ( ; dly>0; dly--)
for (i=0; i<50000; 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
*********************************************************************************************************/
#define LED1 P0_17
#define KEY1 P0_16
int main (void)
{
char cWdtArg[50]="WdtTimerOut=100"; /* 看门狗定时100ms */
gpioClr(LED1); /* 点亮LED灯 */
delayNS(50); /* 延时 */
gpioSet(LED1); /* 熄灭LED灯 */
wdtInit(0, cWdtArg, 0); /* 看门狗初始化 */
while(1){
while(gpioGet(KEY1)==0) { /* 有按键按下, 停止喂狗 */
delayNS(50);
}
wdtFeed(0,NULL); /* 喂狗 */
}
}
/*********************************************************************************************************
END FILE
*********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -