薄膜4x4键盘与8x8点阵板的使用与编程
薄膜4x4键盘
薄膜4x4键盘的工作方式与3x4键盘类似,但有一个主要区别。当按下薄膜上的任何按键时,实际上是向PIC发送低电平输入,这被称为“低电平有效”。由于薄膜键盘采用低电平有效输入,因此使用了PIC内部的上拉电阻,并将薄膜键盘连接到PORTB。这意味着需要将LCD连接到另一个端口,这里选择了PORTD,并且不能使用LCD的头文件,因为该头文件中LCD连接到PORTB。
以下是薄膜4x4键盘的代码:
/*
* File: keypadCodedProg.c
* Author: H H Ward
* This uses the membrane 4by4 keypad that is active low
* Created on 23 December 2020, 13:09
*/
#include <xc.h>
#include <conFigInternalOscNoWDTNoLVP.h>
//some definitions
#define firstbyte 0b00110011
#define secondbyte 0b00110011
#define fourBitOp 0b00110010
#define twoLines 0b00101100
#define incPosition 0b00000110
#define cursorNoBlink 0b00001100
#define clearScreen 0b00000001
#define returnHome 0b000
超级会员免费看
订阅专栏 解锁全文
66

被折叠的 条评论
为什么被折叠?



