Gary Hoffmann
11-27-2009, 09:57 AM
Hello all,
I have been fiddling with a very simple program off and on for some time and I can't seem to get a "handle" on this "problem"..Basic Stamp1 is looking at an input pin and depending on the state of the pin (high/low) is supposed to go into two different routines.· I am not looking for someone to "write the program for me, but I am miseralbly failing somewhere...I have posted a request before but was not too successful with it..
I'll post the unfinished routine here and attemt to "remark" what I am attempting to do... Please understand that I am very "green" with this soooo· patience if you please, however any constructive help would be greatly appreciated.
Thanks,
Gary
Dirs = %00001111
Start:
IF PIN0 = 0 then relayroutine1
IF PIN0 = 1 then relayroutine2
relayroutine1:
HIGH 5······················· 'Pulling pin5 high
Pause 800
High 6························ 'Pulling pin6 high
Pause 800
LOW 6
Pause 800
LOW 5
All very simple...however if I get the program to go back to start and pin 0 is still 0 or·1 (as the case may be)·it obviously continues to do this loop which I do not want.. I want this to be executed only one time, regardless how long pin0 is "0" or "1"
However, if I don't put a "pointer" back to start, the processor will "hang at the bottom of this routine and "that is it"...
Now for the relayroutine2 it is basically the same thing, it is supposed to toggle through the routine and than ·sit, look at·pin0 and ONLY act upon a chance in level on pin0..
Where am I going wrong here or what am I not "getting" ???
Any help would be super..
Thanks a bunch
Gary
·
I have been fiddling with a very simple program off and on for some time and I can't seem to get a "handle" on this "problem"..Basic Stamp1 is looking at an input pin and depending on the state of the pin (high/low) is supposed to go into two different routines.· I am not looking for someone to "write the program for me, but I am miseralbly failing somewhere...I have posted a request before but was not too successful with it..
I'll post the unfinished routine here and attemt to "remark" what I am attempting to do... Please understand that I am very "green" with this soooo· patience if you please, however any constructive help would be greatly appreciated.
Thanks,
Gary
Dirs = %00001111
Start:
IF PIN0 = 0 then relayroutine1
IF PIN0 = 1 then relayroutine2
relayroutine1:
HIGH 5······················· 'Pulling pin5 high
Pause 800
High 6························ 'Pulling pin6 high
Pause 800
LOW 6
Pause 800
LOW 5
All very simple...however if I get the program to go back to start and pin 0 is still 0 or·1 (as the case may be)·it obviously continues to do this loop which I do not want.. I want this to be executed only one time, regardless how long pin0 is "0" or "1"
However, if I don't put a "pointer" back to start, the processor will "hang at the bottom of this routine and "that is it"...
Now for the relayroutine2 it is basically the same thing, it is supposed to toggle through the routine and than ·sit, look at·pin0 and ONLY act upon a chance in level on pin0..
Where am I going wrong here or what am I not "getting" ???
Any help would be super..
Thanks a bunch
Gary
·