H e l p ! !
Archiver
Posts: 46,084
Can someone tell why this doesn't work?? BS2P40 chip
The slot zero program simply looks at eight switches hooked up to AUX pin 0 - 7,
works every time
The slot one program outputs to 6 leds through a 74HC595, works by itself (with
a couple of mods) but never works with the run command??
I'm trying to get a grip on this run and poll mode stuff but not having much
luck. When I run the slot zero program again do ALL the program lines get
executed again? If so how do I plant a seed for the lights variable without it
getting set back to zero all the time?? I thought by using the scratch pad I
could pass data back and forth this way but I am obviously doing something
wrong.
Thanks Mike B.
'{$STAMP BS2p, lights.bsp}
'Slot zero
switches var byte
lights var byte
lights = %00000001
put 0, lights
Main:
auxio
pause 300
switches = inl
debug ibin8 switches," ",ibin8 lights, cr
Run 1
goto main
'{$STAMP BS2p}
' Slot 1
D_out con 7
Clock con 8
latch con 9
dlytm con 100
pattern var byte
mainio
pause 300
low latch
Gosub out595
pause dlytm
run 0
:
end
out595:
get 0, pattern
if pattern = %00100000 then goreverse
pattern = pattern <<1
goto display
goreverse:
pattern = pattern >>1
display: shiftout d_out, clock,msbfirst,[noparse][[/noparse]pattern]
pulsout latch,3
put 0, pattern
return
[noparse][[/noparse]Non-text portions of this message have been removed]
The slot zero program simply looks at eight switches hooked up to AUX pin 0 - 7,
works every time
The slot one program outputs to 6 leds through a 74HC595, works by itself (with
a couple of mods) but never works with the run command??
I'm trying to get a grip on this run and poll mode stuff but not having much
luck. When I run the slot zero program again do ALL the program lines get
executed again? If so how do I plant a seed for the lights variable without it
getting set back to zero all the time?? I thought by using the scratch pad I
could pass data back and forth this way but I am obviously doing something
wrong.
Thanks Mike B.
'{$STAMP BS2p, lights.bsp}
'Slot zero
switches var byte
lights var byte
lights = %00000001
put 0, lights
Main:
auxio
pause 300
switches = inl
debug ibin8 switches," ",ibin8 lights, cr
Run 1
goto main
'{$STAMP BS2p}
' Slot 1
D_out con 7
Clock con 8
latch con 9
dlytm con 100
pattern var byte
mainio
pause 300
low latch
Gosub out595
pause dlytm
run 0
:
end
out595:
get 0, pattern
if pattern = %00100000 then goreverse
pattern = pattern <<1
goto display
goreverse:
pattern = pattern >>1
display: shiftout d_out, clock,msbfirst,[noparse][[/noparse]pattern]
pulsout latch,3
put 0, pattern
return
[noparse][[/noparse]Non-text portions of this message have been removed]