?? 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: 2004-09-16
** Last Version: 1.0
** Descriptions: The main() function example template
**
**------------------------------------------------------------------------------------------------------
** Created by: Chenmingji
** Created date: 2004-09-16
** Version: 1.0
** Descriptions: The original version
**
**------------------------------------------------------------------------------------------------------
** Modified by: Chenxibing
** Modified date: 2005-01-12
** Version:
** Descriptions: GPIO輸出實驗,控制蜂鳴器鳴叫。
**
********************************************************************************************************/
#include "config.h"
#define BEEP 1 << 7 // P0.7控制蜂鳴器,低電平蜂鳴
/*
*********************************************************************************************************
** 函數(shù)名稱 :DelayNS()
** 函數(shù)功能 :長軟件延時
** 入口參數(shù) :dly 延時參數(shù),值越大,延時越久
** 出口參數(shù) :無
*********************************************************************************************************
*/
void DelayNS (uint32 dly)
{
uint32 i;
for ( ; dly>0; dly--)
for (i=0; i<50000; i++);
}
/*
*********************************************************************************************************
** 函數(shù)名稱 :main()
** 函數(shù)功能 :用P0.7控制BEEP,讓BEEP鳴叫。
** 調(diào)試說明 :需將跳線JP5和LED短接。
*********************************************************************************************************
*/
int main (void)
{
PINSEL1 = 0x00000000; // 設(shè)置管腳連接GPIO
IO0DIR = BEEP; // 設(shè)置BEEP控制口為輸出
while (1)
{
IO0SET = BEEP; // BEEP停止蜂鳴
DelayNS(50);
IO0CLR = BEEP; // BEEP 蜂鳴
DelayNS(50);
}
return 0;
}
/*********************************************************************************************************
** End Of File
********************************************************************************************************/
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -