📄 main.c
字号:
/****************************************Copyright (c)***************************************************
** Guangzou ZLG-MCU Development Co.,LTD.
** graduate school
** http://www.zlgmcu.com
**
**--------------File Info--------------------------------------------------------------------------------
** File name: main.c
** Last modified Date: 2008-02-26
** Last Version: 1.0
** Descriptions: The main() function example template
**
**-------------------------------------------------------------------------------------------------------
** Created by: Chen Mingji
** Created date: 2008-02-26
** Version: 1.0
** Descriptions: The original version
**
**-------------------------------------------------------------------------------------------------------
** Modified by: Li Baihua
** Modified date: 2008-04-02
** Version: 1.1
** Descriptions: 发光二极管闪烁控制实验
**
*********************************************************************************************************/
#include "config.h"
# define LED1 1 << 17 /* P0.17控制LED1 */
/*********************************************************************************************************
** Function name: DelayNS
** Descriptions: 延时函数
** input parameters: uiDly 值越大,延时时间越长
** output parameters: 无
** Returned value: 无
*********************************************************************************************************/
void DelayNS (uint32 uiDly)
{
uint32 i;
for (; uiDly > 0; uiDly--){
for(i = 0; i < 50000; i++);
}
}
/*********************************************************************************************************
** Function name: main
** Descriptions: 跳线JP4短接,LED1闪烁
** input parameters: 无
** output parameters: 无
** Returned value: 无
*********************************************************************************************************/
int main (void)
{
PINSEL1 = PINSEL1 & (~(0x03 << 2)); /* 将P0.17设置为GPIO */
IO0DIR = LED1; /* 设置LED控制口为输出 */
IO0SET = LED1; /* LED1熄灭 */
while (1) {
IO0SET = LED1; /* LED1熄灭 */
DelayNS(50); /* 延时 */
IO0CLR = LED1; /* LED1点亮 */
DelayNS(50); /* 延时 */
}
return 0;
}
/*********************************************************************************************************
** End Of File
**********************************************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -