Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

4x3 alphanumeric keypad

Status
Not open for further replies.

brennbar67

Member level 3
Member level 3
Joined
Jul 26, 2004
Messages
54
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Visit site
Activity points
580
alphanumeric keypad interfacing

Does anyone know how write a program that able to display the character keyed by the keypad??
Anyone got the c-source code or the assembly code??
If you can send me the material, is it much appreciated... :)
 

4x3 keyboard pic

I used pic controller. but 4X4 key

;**********************************************
; STEP to follow when test this program
; 1.Connect RS232 or RS422 cable between board and PC.
; 2.Download this program to CPU.
; 3.Run terminal program such as Procom plus,XTALK etc.
; 4.Set parameter Procom plus to 9600 baud,No parity,8 bits data and 1 bit. stop
; 5.Connect Keyboard 4x4 to KBI/IO on board CP-PIC V4.0
; RB4 connect row 1
; RB5 connect row 2
; RB6 connect row 3
; RB7 connect row 4
; RD0 connect column 1
; RD1 connect column 2
; RD2 connect column 3
; RD3 connect column 4
; 6.Press any key on keyboard, you will see the key that you pressed.
;**********************************************

list p=16f877 ; list directive to define processor
#include <p16f877.inc> ; processor specific variable definitions

count EQU 0x21
colm EQU 0x22
dt1 EQU 0x23
dt2 EQU 0x24
dt3 EQU 0x25

ORG 0x0000

;************ initial *******************

init bsf STATUS,RP0 ; select bank 1
clrf TRISD
movlw 0xff
movwf TRISB
bcf OPTION_REG,7
movlw 0x40 ; BAUD rate 9600
movwf SPBRG
clrf TXSTA ; 8 bits data ,no,1 stop

bcf STATUS,RP0 ; select bank 0
bsf RCSTA,SPEN ; Asynchronous serial port enable
bsf RCSTA,CREN ; continuous receive

bsf STATUS,RP0 ; select bank 0
bsf TXSTA,TXEN ; Transmit enable
BSF TXSTA,BRGH ; HI SPEED
bcf STATUS,RP0 ; select bank 0
;********** start to send **********************
scan movlw 0xfe ; start scan column 1
movwf colm
clrf count ; clear counter
scan1 movf colm,w ; scan column
movwf PORTD
btfss PORTB,4 ; check RB4
goto sw_1
btfss PORTB,5 ; check RB5
goto sw_2
btfss PORTB,6 ; check RB6
goto sw_3
btfss PORTB,7 ; check RB7
goto sw_4
movlw .4
clrc ; clear carry flag
addwf count,f
clrc
rlf colm,f ; rotate scan
btfsc colm,4 ; check last column
goto scan1
goto scan ; start scan

sw_4 incf count,f
sw_3 incf count,f
sw_2 incf count,f
sw_1 movf count,w

call TAB
call send ; Send data to RS232
call delay
goto scan ; Back to scan

send movwf TXREG ; Send recent data to TX
wait1 movlw TXSTA ;
movwf FSR
btfss INDF,1 ; check TRMT bit in TXSTA (FSR)
goto wait1 ; TXREG full or TRMT = 0
return

delay movlw 3 ; delay
movwf dt1
sd3 clrf dt2
sd2 clrf dt3
sd1 decfsz dt3
goto sd1
decfsz dt2
goto sd2
decfsz dt1
goto sd3
return

;********* Tebel of message ********************

TAB addwf PCL,f ; Move offset to PC lower

DT "0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"
 

4x3 alphanumeric keypad price list

Read Appplication Note AN234
Hardware Techniques for PICmicro Microcontrollers
From Microchip
You will can Read 20 Key from 1 pin
(A2D)
 

alphanumeric keypad code download

There are many mcu application books can find it.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top