Help reading buttons
Irritant
Posts: 2
I'm not new to stamps, but I never seem to get far enough along to figure out how to accomplish what I want to do.
I'd like to know if someone could point me in the right direction:
I have 8 magnetic reed switches and a serial LCD. (seetron)·and a BS2
I'd like to display a message on the LCD corresponding to the individual inputs.
If all 8 are open/closed, then all 8 messages should display one at·a time.
So far my programs don't work properly.
I'm ripping my hair out for something this simple
Please help.
I'd like to know if someone could point me in the right direction:
I have 8 magnetic reed switches and a serial LCD. (seetron)·and a BS2
I'd like to display a message on the LCD corresponding to the individual inputs.
If all 8 are open/closed, then all 8 messages should display one at·a time.
So far my programs don't work properly.
I'm ripping my hair out for something this simple
Please help.
Comments
Your first micro goal should be to display the results of pressing buttons on the debug terminal, with a display like
%00110110
that shows a 0 or a 1 for each switch.
Then, see if you can display "hello" on each line of your LCD screen.
Then, display the switch states (e.g. , like %00110110) on the LCD screen as well asf on the Debug screen.
Then you are ready for the messages finale with a modicum of hair remaining!
-- Tracy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
' {$STAMP BS2}
' {$PBASIC 2.5}
'******************************************display constants
'16468 set up 9600 8 data bits no parity
LCD_CLS············ CON 1
scroll_l········· CON 24
n96n_Baud········· CON 16468
'var
pin_status· VAR Byte· 'test routine variable
'*******************************************routine start
DIRS=%1111111100000000······· 'pins 0-7 inputs, pins 8-15 outp
PAUSE 1000
SEROUT 16,n96n_baud, [noparse][[/noparse]254,132,"TEST MODE "]
TOP:
pin_status=INL········· 'read the value of the inputs into pin_status
SEROUT 16,n96n_baud, [noparse][[/noparse]254,194,"I/P=",DEC INL.BIT0,DEC INL.BIT1,DEC INL.BIT2,DEC INL.BIT3,DEC INL.BIT4,DEC INL.BIT5,DEC INL.BIT6,DEC INL.BIT7,"······················ "]
······'display the active i/ps
GOTO TOP········· 'repeat
· SEROUT pin, baud, [noparse][[/noparse]254, 194, BIN8 pin_status]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
I look at the suggestions and I wonder what the hell I was thinking!
Tracy, thanks for the walk through.
weydev, thanks for the example and
John, I appreciate your help as well.
I just wish I had a better handle on the whole programming thing. My mind doesn't seem to grasp the "obvious"
Is there any resource for the programming challenged? I have the parallax book, I have Scott Edwards Stamp book, and both of them seem to gloss over things that I don't seem to understand.
any help would be appreciated.
thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office