ARM7---矩阵键盘
来源:互联网 发布:crontab 执行php延迟 编辑:程序博客网 时间:2024/06/06 14:04
//config.h
#ifndef __CONFIG_H#define __CONFIG_H#include <LPC21xx.H>#ifndef TRUE#define TRUE 1#endif#ifndef FALSE#define FALSE 0#endiftypedef unsigned char uint8;typedef signed char int8;typedef unsigned short uint16;typedef signed short int16;typedef unsigned int uint32;typedef signed int int32;typedef float fp32;typedef double fp64 ;#define Fosc11059200#define Fcclk(Fosc*4)#define Fcco(Fcclk*4)#define Fpclk(Fcclk/4)*1#endif
//Text1.c
/***********************************************************************功能:不完美的ARM7 查询方式 4X4矩阵键盘**********************************************************************/#include "config.h"#define row1 0x00000080#define row2 0x00000100#define row3 0x00000200#define row4 0x00000400#define col1 0x00000800#define col2 0x00001000#define col3 0x00002000#define col4 0x00004000//显示的字符数组uint8 DispCode[]={0x3f,0x06,0x5b,0x4f,0x66, //0-4 0x6d,0x7d,0x07,0xff,0x6f, //5-9 0x77,0x7c,0x39,0x5e,0x79, //A,b,C,d,E,F 0x71};//延时函数,消除抖动void Delay(uint16 count){uint8 i; while(--count != 0) for(i = 0; i < 125; i++); }//主函数入口int main(){PINSEL0 &= 0xc0000000;//设置P0.0-P0.14为IO口IO0DIR =0xffffffff;while(1){while(1){IO0CLR = row1+row2+row3+row4;//置行为低IO0SET = col1+col2+col3+col4;//置列为高IO0DIR &=0x000007ff;//设置0-10为输出,11-14为输入if(((IO0PIN & col1)==0) || ((IO0PIN & col2)==0) || ((IO0PIN & col3)==0) ||((IO0PIN & col4)==0)){Delay(20);//消除抖动if(((IO0PIN & col1)==0) || ((IO0PIN & col2)==0) || ((IO0PIN & col3)==0) ||((IO0PIN & col4)==0)){IO0CLR = 0x7f; //清空IO0CLR = row1;IO0SET = row2+row3+row4;if((IO0PIN & col1)==0) {IO0SET = DispCode[0];break;}if((IO0PIN & col2)==0) {IO0SET = DispCode[1];break; }if((IO0PIN & col3)==0) {IO0SET = DispCode[2];break; }if((IO0PIN & col4)==0) {IO0SET = DispCode[3];break; }IO0CLR = row2;IO0SET = row1+row3+row4;if((IO0PIN & col1)==0) {IO0SET = DispCode[4];break; }else if((IO0PIN & col2)==0) {IO0SET = DispCode[5];break; }else if((IO0PIN & col3)==0) {IO0SET = DispCode[6];break; }else if((IO0PIN & col4)==0) {IO0SET = DispCode[7];break; }IO0CLR = row3;IO0SET = row1+row2+row4;if((IO0PIN & col1)==0) {IO0SET = DispCode[8];break; }else if((IO0PIN & col2)==0) {IO0SET = DispCode[9];break; }else if((IO0PIN & col3)==0) {IO0SET = DispCode[10];break; }else if((IO0PIN & col4)==0) {IO0SET = DispCode[11];break; }IO0CLR = row4;IO0SET = row1+row2+row3;if((IO0PIN & col1)==0) {IO0SET = DispCode[12];break; }else if((IO0PIN & col2)==0) {IO0SET = DispCode[13];break; }else if((IO0PIN & col3)==0) {IO0SET = DispCode[14];break; }else if((IO0PIN & col4)==0) {IO0SET = DispCode[15];break; }}}}}}
//图片
- ARM7---矩阵键盘
- arm7(S3C44B0X)键盘中断驱动程序
- 矩阵键盘
- 矩阵键盘
- 矩阵键盘
- 矩阵键盘
- 矩阵键盘
- 矩阵键盘
- 矩阵键盘
- 矩阵键盘
- 矩阵键盘
- 矩阵键盘
- 矩阵键盘
- 矩阵键盘
- arm7
- AVR----矩阵键盘实验
- s3c2410矩阵键盘驱动
- avrstudio 5 矩阵键盘
- 深入了解FileNet
- 菜鸟杯” hdu 4151 I The Special Number
- emacs笔记
- 原创2D/3D游戏引擎源代码开源
- char、nchar、varchar、nvarchar的区别和特点
- ARM7---矩阵键盘
- 常用 Java 静态代码分析工具的分析与比较
- Android 自定义AlertDialog并通过AlertDialog修改TextView的值
- 使用Android中sqlite表的全文检索
- Session监听器处理代码学习
- c# 构造器的一点理解(2)
- 第六章堆排序之“最大优先级队列”
- Virtualbox 学习 (三) --- 关于 Guest Additions
- OpenGL基础知识(五)