Need code help pls for a keypad!
Kitster
Posts: 1
Hello peeps,
···· I need some help please.· I am working on a keypad project and i seem to be having some problems.· I am using the design and code from Shaun·Wilson's·website.· Once i got everything hooked up, when i·hit a number on the keypad, I am gettin jibberish on the screen.· It looks like ASCII characters and letters being displayed and not the number.· I am not that adept at using PBASIC language, and i am not sure whats going on.· The only difference between his project and mine is the keypad itself.· I am not sure if it is the code or the keypad that is giving me trouble.
The Project:
http://www.geocities.com/SiliconValley/Orchard/6633/keypad.html
The code i am using (shaun's PBASIC 2.0):
http://geocities.com/SiliconValley/Orchard/6633/keypad.txt
The Keypad I am using:
http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=169245
LCD:
http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/txtSearch/27976/List/1/ProductID/52/Default.aspx?SortField=ProductName%2cProductName
···· The keypad that shaun used can be seen under the first link.· If anyone can help me out i'd appriciate it.· I have read many things in the nut and bolts but I am having problems finding what i need.
·
·
Chris
Post Edited (Kitster) : 12/9/2007 12:52:50 AM GMT
···· I need some help please.· I am working on a keypad project and i seem to be having some problems.· I am using the design and code from Shaun·Wilson's·website.· Once i got everything hooked up, when i·hit a number on the keypad, I am gettin jibberish on the screen.· It looks like ASCII characters and letters being displayed and not the number.· I am not that adept at using PBASIC language, and i am not sure whats going on.· The only difference between his project and mine is the keypad itself.· I am not sure if it is the code or the keypad that is giving me trouble.
The Project:
http://www.geocities.com/SiliconValley/Orchard/6633/keypad.html
The code i am using (shaun's PBASIC 2.0):
http://geocities.com/SiliconValley/Orchard/6633/keypad.txt
The Keypad I am using:
http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&catalogId=10001&productId=169245
LCD:
http://www.parallax.com/Store/Microcontrollers/BASICStampModules/tabid/134/txtSearch/27976/List/1/ProductID/52/Default.aspx?SortField=ProductName%2cProductName
···· The keypad that shaun used can be seen under the first link.· If anyone can help me out i'd appriciate it.· I have read many things in the nut and bolts but I am having problems finding what i need.
·
·
Chris
Post Edited (Kitster) : 12/9/2007 12:52:50 AM GMT
Comments
btn var byte
number var byte
A var byte
B var byte
C var byte
D var byte
n9600 con $4054 'baudrate
clrLCD con 12 'clear LCD
input 1 'makes pin 1-5 a input
input 2
input 3
input 4
input 5
btn =0
loop:
button 1,1,50,10,btn,0,nokey 'check pin 1 for data
'available for keypress(1 for but press 0 for no but pres)
A=in2 'put binary value into a variable
B=in3 ' "
C=in4 ' "
D=in5 ' "
serout 0, n9600, [noparse][[/noparse]bin A, bin B, bin C, bin D,cr] ' display the
binary value of the key pressed
A=1*A ' Lsb convert a binary 1 to 1 or 0 to 0
B=2*B ' convert a binary 1 to a 2 and a 0 to 0
C=4*C '· " ··· "··· "·· 1 to a 4 and a 0 to 0
D=8*D 'msb convert a binary 1 to a 8 and a 0 to 0
Number =A+B+C+D 'convert to a decimal
serout 0,n9600, [noparse][[/noparse]dec Number,cr] 'display a 0-15 on LCD
debug DEC number
pause 2000
serout 0, n9600, [noparse][[/noparse]clrLCD] 'clear
nokey: goto loop