Programming Question from who else!
Guido
Posts: 195
Here is another stupid question. I am trying to set up 5 different setpoints. These setpoints will be coming from the A/D converter - Stamp Eprom memory.
When a setpoint is called I would like to have a + or - dead band so as not to have the unit it is driving hunting all the time. These setpoints will be wriiten to memory at a random sequence. Not knowing the actual setpoint parramiters creates the problem.
For instance, If I knew the paramitters I could use the following statement:
If Spt1=1234<>1239 then (turn something off or on)
The above example I am using is using a dead band of 5 just as an example.
Now that I have totally confused you! How can I write this same statement using a saved unknown variable.
If Spt1= A-5· then (turn something off or on)
If Spt1= A+5 then (turn something off or on)
How could something like this be written into a one line instruction?
Thank You Again
Guido
When a setpoint is called I would like to have a + or - dead band so as not to have the unit it is driving hunting all the time. These setpoints will be wriiten to memory at a random sequence. Not knowing the actual setpoint parramiters creates the problem.
For instance, If I knew the paramitters I could use the following statement:
If Spt1=1234<>1239 then (turn something off or on)
The above example I am using is using a dead band of 5 just as an example.
Now that I have totally confused you! How can I write this same statement using a saved unknown variable.
If Spt1= A-5· then (turn something off or on)
If Spt1= A+5 then (turn something off or on)
How could something like this be written into a one line instruction?
Thank You Again
Guido
Comments
The biggest favor you could probably do yourself is to take an hour out sometime and peruse the Parallax PBASIC Stamp Manual. You'll find it easy to read, and most informative.
That being said, this looks like a good candidate for a SELECT .... CASE statement. Check the PBASIC Stamp Manual or the PBASIC Help File for details.
Regards,
Bruce Bates