More BS2P40 questions
Archiver
Posts: 46,084
I now have the beast in hand and I am trying to get my mind around the new
"polling" commands. Is there a good tutorial somewhere that explains the ins
and out of the different modes?? Failing that, does anyone have a working
program using the BS2P (I don't care what the application is, just want to see
how the polling is used in real life) that they would care to send me to look
at??
Thanks.
Mike B.
[noparse][[/noparse]Non-text portions of this message have been removed]
"polling" commands. Is there a good tutorial somewhere that explains the ins
and out of the different modes?? Failing that, does anyone have a working
program using the BS2P (I don't care what the application is, just want to see
how the polling is used in real life) that they would care to send me to look
at??
Thanks.
Mike B.
[noparse][[/noparse]Non-text portions of this message have been removed]
Comments
Below is some sample code that turns on an led if an input pin is pull low.
Sixteen leds are located on the MAINIO side and sixteen inputs are located on
the AUXIO side. The leds are activated by pulling them low thru the stamp.
The inputs are in a pullup state. When an input on the AUXIO side is pull low
the corresponding MAINIO pin is pull low so to light up the led. Use 10k ohm
resistors on the inputs and 500 ohm resistors on the leds.
Hope this helps.
Chuck
'security system with 10k pullups on auxio pins and ground outputs on high
leds on mainio pins
'10/23/01
'{$STAMP BS2p,secur}
w var word
z var byte
x var w.lowbyte
y var w.highbyte
p var nib
debug cls,"SECURITY SYSTEM IS ARMED",cr
auxio
for p=0 to 15
pollin p,0
next
'get 134,z
'debug ? z
mainio
pollrun 1
dirs=%1111111111111111
outs=%1111111111111111
pollmode 4
get 135,z
debug bin8 z,cr
pollwait 7
'aa:
'goto aa
'put this program in slot 1
'{$STAMP BS2p}
get 130,b0
get 131,b1
w1=$ffff ^ w0
outs=w1
debug "ALARM ON ",bin16 w0,cr
pause 1000
run 0