?? 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 + -