熟女俱乐部五十路二区av,又爽又黄禁片视频1000免费,国产卡一卡二卡三无线乱码新区,中文无码一区二区不卡αv,中文在线中文a

新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > GPIO輸出---控制蜂鳴器蜂鳴

GPIO輸出---控制蜂鳴器蜂鳴

作者: 時間:2016-11-10 來源:網(wǎng)絡(luò) 收藏
/*****************************Copyright (c)******************************

**--------------File Info--------------------------------------------------

本文引用地址:http://www.bjwjmy.cn/article/201611/317404.htm

** File name:main.c
** Last modified Date: 2011-04-09
** Last Version:1.0
** Descriptions:The main() function example template
**-------------------------------------------------------------------------
** Created by:lxliu
** Created date:2011-04-09
** Version:1.0
**************************************************************************/
#include "config.h"

#define BEEP 1<<7 //P0.7控制蜂鳴器,低電平蜂鳴

/*************************************************************************
** 函數(shù)名稱:DelayNS()
** 函數(shù)功能:長軟件延時
** 入口參數(shù):dly延時控制值,值越大,延時越長
** 出口參數(shù):無
*************************************************************************/

void DelayNS(uint32 dly)
{
uint32 i;
for(;dly>0;dly--)
for(i=0;i<50000;i++);
}


/*************************************************************************
** 函數(shù)名稱:main()
** 函數(shù)功能:用P0.7控制BEEP,讓蜂鳴器蜂鳴
** 調(diào)試說明:需將跳線JP11和BEEP短接
*************************************************************************/

int main (void)
{
PINSEL0=0x00000000; //設(shè)置P0口為GPIO功能
IO0DIR=BEEP; //設(shè)置P0.7為輸出

while(1)
{
IO0SET=BEEP; //蜂鳴器停止蜂鳴
DelayNS(10); //延時
IO0CLR=BEEP; //蜂鳴器蜂鳴
DelayNS(100);//延時
}
return 0;
}
/*****************************************************************************
** End Of File
******************************************************************************/



關(guān)鍵詞: GPIO輸出蜂鳴器蜂

評論


技術(shù)專區(qū)

關(guān)閉