And also does anybody know 3x4 keypad picbasic code?
And also does anybody know 3x4 keypad picbasic code?
Follow this link:http://www.rentron.com/PicBasic1.htm
I used the 4X4 keybord succesfully several times.
greetings,
Paul
Another way,
http://www.picbasic.co.uk/forum/showthread.php?t=3250
allow you to use the keypad format you want. 3x4,3x5,6x8,8x8 .....
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
can you convert this programme to 3x4 kaypad programme?????
1st column - RB0
2nd column - RB1
3rd column - RB2
1st row - RB3
2nd row - RB4
3rd row - RB5
4th row - RB6
DEFINE LOADER_USED 1
i VAR byte
col VAR byte
row VAR byte
num VAR byte
PIN VAR byte[4]
ADMIN VAR byte[4]
GREEN VAR PORTA.2
YELLOW VAR PORTA.1
BUZZER VAR PORTA.3
OPTION_REG.7 = 0
DATA 0,..............??????? I don't know how to write this part!!!
SETPIN:
SETPIN:
i = 0 WHILE i<4 PIN = 0 GOSUB KEYPAD LET PIN = num i = i + 1
WEND
CHKAMD:
WRITE 1, PIN
PAUSE 200
READ 0, ADMIN
PAUSE 200
IF PIN4 = ADMIN THEN
GREEN = 1
END
ELSE
GOTO SETPIN
ENDIF
KEYPAD:
PAUSE 50
NO_KEY:
TRISB = %01111000
PORTB = 0
IF ((PORTB >> 3)!= %1111)THEN GOTO NO_KEY
PAUSE 50
GOTKEY:
FOR col = 0 to 2
row = 0 TRISB = (dcd col)^%11111111
PORTB = 1
row = PORTB>>3
IF (row!= %1111)THEN CAL_NUM
NEXT col
GOTO GOTKEY
CAL_NUM:
YELLOW = 1
SOUND BUZZER,[100,10]
PAUSE 500
YELLOW = 0
num = (col*3) + (ncd (row^$F))
RETURN
Using the link i provided and using MPASM to compile you need...and your keypad results will be stor in YourVar variable as followCode:INCLUDE "KeyPad.bas" DEFINE KEYPAD_ROW 4 ' 4 ROW keypad DEFINE KEYPAD_ROW_PORT PORTB ' ROW port = PORTB DEFINE KEYPAD_ROW_BIT 3 ' ROW0 = PORTB.3 DEFINE KEYPAD_COL 3 ' 3 COL keypad DEFINE KEYPAD_COL_PORT PORTB ' COL port = PORTB DEFINE KEYPAD_COL_BIT 0 ' COL0 = PORTB.0 YourVar var byte Start: @ READKEYPAD _YourVar ' plah plah ' plah plah ' plah plah '
Code:col0 col1 col2 1 2 3 row0 4 5 6 row1 7 8 9 row2 10 11 12 row3
Last edited by mister_e; - 31st May 2006 at 00:20.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks