serial keypad
Dan Taylor
Posts: 207
Could someone show me an example program for the 4x4 keypad sold by ucontroller.com? I tried a simple SERIN program but a lot of the buttons come back with the same result. Any guidance would be nice!
Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dan Taylor
Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dan Taylor
Comments
Can you post the information you have about the module you are using (datasheet and so forth) and the program you are trying to use with it? That way, we can see what all you have and try to offer some suggestions to get you up and running.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
But the programs that I have tried have just been something like this:
serin, 5, 9600, [noparse][[/noparse]value]
debug ? value
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dan Taylor
Dave
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dave Andreae
Parallax Tech Support·
"Is the baud rate set to 9600 ? also sometimes you have the option of inverting, if such an option exists, see if that helps.
The data is returned as an ASCII code,· so you won't receive a "1" when 1 is pressed, you'll instead receive a "49" in decimal, or "31" in hex, whatever number base you are using."
So, Yes my baud rate is set to 9600. He doesn't use the BASIC Stamp so he couldn't write me a program. Here is a program I just ran along with the results:
DO
· SERIN 3, 9600, [noparse][[/noparse]Value]
· DEBUG CR, DEC Value
LOOP
Key····· ·Value
1·····=···· 6
2·····=···· 24
3·····=···· 60
4·····=···· 96
5···· =···· 102
6···· =···· 120
7···· =···· 126
8···· =···· 0 OR 128
9···· =·····134
0···· =···· 0
*···· =···· 152
#···· =···· 30
A···· =·····6
B···· =·····24
C···· =···· 30
D···· =···· 96
As you can see some of the buttons return with the same value. Such as the Button 1 and the button A both return with the value 6.
This is the problem I am having.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dan Taylor
Try 84. That's for 9600 Baud, 8 bits, non-inverted.
Post Edited (Mike Green) : 2/11/2010 6:11:59 PM GMT
The value for 9600 baud for the BS2 is 84; can you verify you get the same results by replacing the 9600·in the code with 84 and running the program again? This is the command that Mike suggested to review, there is a table in the manual that provides common baud values on page 419.
BASIC Stamp Syntax & Reference Manual:
http://www.parallax.com/Portals/0/Downloads/docs/prod/stamps/web-BSM-v2.2.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com
It is working wonderfully know! Thanks for you help.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Dan Taylor
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,
Joshua Donelson
www.parallax.com