新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > LPC2103學(xué)習(xí)板-蜂鳴器練習(xí)程序

LPC2103學(xué)習(xí)板-蜂鳴器練習(xí)程序

作者: 時(shí)間:2016-11-18 來源:網(wǎng)絡(luò) 收藏

本文引用地址:http://www.2s4d.com/article/201611/316024.htm

/**************ARM7(LPC2103)練習(xí)程序**************************/
/************************************************************************/
/*****File Function : 蜂鳴器測試 *****/
/*****Program Author : ClimberWin *****/
/*****MCU : LPC2103F 外部11.0592M晶振 *****/
/*****Compile Date : 2011/04/01 *****/
/*****Edition Info : V1.0*****/
/*****************************************************************/
//編譯環(huán)境 KEIL for ARM
//蜂鳴器 接口 P0.21

#include
#include
#define uint unsigned int
#define uchar unsigned char

#define speak (1<<21) //定義按鍵1的引腳

void delayms(unsigned int count);//延時(shí)程序
void speakertest(void);//蜂鳴器測試程序
/*************延時(shí)程序***************/

void delayms(unsigned int count)
{
unsigned int i,j;
for(i=0;ifor(j=0;j<5000;j++);
}


/***************************************************/
void speakertest(void)//蜂鳴器測試程序
{
uchar i;
for(i=0;i<100;i++)
{
IO0CLR=0x00200000;
delayms(1);
IO0SET=0x00200000;
delayms(1);
}
}
/*****************************************/


/////////////主程序///////////////////
void main(void)
{
uchar i;
IO0DIR=0x0027fc00; //配置P0.8-P1.5為輸出 P21輸出

speakertest();
while(1);

}



關(guān)鍵詞: LPC2103蜂鳴

評論


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

關(guān)閉