GPIO输入----检测按键(EasyARM2131)
**--------------File Info----------------------------------------------------------
** 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
** Descriptions:The original version
************************************************************************************/
#include "config.h"
const uint32 BEEP = (1<7);
const uint32 KEY1 = (1<16);
/*************************************************************************
** 函数名称:main()
** 函数功能:GPIO输入测试
检测按键KEY1:KEY1按下,蜂鸣器蜂鸣;松开后,停止蜂鸣
** 跳线说明:需将跳线JP8和KEY1短接,JP11连接蜂鸣器
*************************************************************************/
int main (void)
{
PINSEL0 = 0x00000000; //所有引脚都设置为GPIO
PINSEL1 = 0x00000000; //
IO0DIR = BEEP; //蜂鸣器控制口输出,其余输入
while(1)
{
if((IO0PIN & KEY1) == 0) //KEY1按下,蜂鸣器蜂鸣
IO0CLR = BEEP;
else //松开后,停止蜂鸣
IO0SET = BEEP;
}
return 0;
}
/**********************************************************************************
** End Of File
***********************************************************************************/
GPIO输入检测按键EasyARM213 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)