Chinaunix首页 | 论坛 | 博客
  • 博客访问: 186611
  • 博文数量: 38
  • 博客积分: 2010
  • 博客等级: 大尉
  • 技术积分: 424
  • 用 户 组: 普通用户
  • 注册时间: 2009-06-19 12:41
文章分类

全部博文(38)

文章存档

2017年(2)

2016年(1)

2010年(8)

2009年(27)

我的朋友

分类: 嵌入式

2010-11-17 15:55:32

今天整理一下按键驱动开发步骤, 采用Zilog CPU

1.用宏定义好input output GPIO口线的mask, 首先对口线进行初始化.初始化步骤如下:

//step1: Configure the GPIO0s as the universal IO Pin
//step2: Configure the Input Pin
//step3: Configure the Output Pin, and OutPut low
//step4: Configure input pins' interrupt
//Step4.1: Clear the input GPIO0s Pin's interrupt
//Step4.2: Clear Interrupt Pending Flop
//Step4.3: Configure as A channel Interrupt
//Step4.4: Configure GPIO0s as Level trigger Interrupt
//Step4.5: Configure GPIO0s as Falling Interrupt
//Step5: Init global variables
//Step6: Set GPIO interrup handler and init timer event
//Step7: Enable Input pins' Interrupt
//Step8: Enable the GPIO0A Interrupt Control
PS:中断口都作为Input, output口线要配置电平.

2.初始化后, 编写Step6中的Interrupt handler.

//Step1: Disable Gpio interrupt
//Step2: init variable.
//Step3: Start timer event, every 20ms do a scan.
//Step4: clear interrupt pending.

3.很重要的一步:用20ms中断定时器事件进行键值扫描.

阅读(1559) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~