Can some one Help.........What is the different in these two code routine
sam_sam_sam
Posts: 2,286
Hi, Everyone
I have a question what is the different about the way these two
codes work
I notice that they do not work the same
they seem·to say the same thing but one has ENDIF dose this a·make different in the
way it is compile·
Can some one explane what the different is·and when to use one over the other
Thanks to any one that can explane this to me
IF hrs = $00·AND mins = $05 AND secs = $00 THEN EXIT
LOW 15
················································· VS
IF hrs = $00·AND mins = $05 AND secs = $00 THEN
·EXIT
LOW 15
ENDIF
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 12/17/2007 8:07:27 PM GMT
I have a question what is the different about the way these two
codes work
I notice that they do not work the same
they seem·to say the same thing but one has ENDIF dose this a·make different in the
way it is compile·
Can some one explane what the different is·and when to use one over the other
Thanks to any one that can explane this to me
IF hrs = $00·AND mins = $05 AND secs = $00 THEN EXIT
LOW 15
················································· VS
IF hrs = $00·AND mins = $05 AND secs = $00 THEN
·EXIT
LOW 15
ENDIF
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 12/17/2007 8:07:27 PM GMT
Comments
This code:
would translate to something like this in internal PBASIC:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Functionally, these should work the same
Thanks You for your reply
I thought that should work the same
I found out that they do not work same
In this example·I am NOT RESETTING THE TIME TO $00 AND $00 for mins and secs
I want to pick up where it left off when the power was LOSS so if the routine is done that stay done when the power come back on meaning that the LED should be OFF
Here is an example
IF secs > $05 THEN
HIGH··LED
ENDIF
IF mins = $03 AND secs = $15 THEN
EXIT
LOW LED
ENDIF
The·LED would BLINK once and then be··OFF Which is what i want it to do
If i could get this to where it would not BLINK at all it would be better but if not then i can live with this
·If you power OFF the basic Stamp power ON agian after the 3 mins and 15 secs had past
IF secs > $05 THEN
HIGH··LED
ENDIF
·
IF mins = $03 AND secs = $15 THEN EXIT
LOW LED
·If you power OFF the basic Stamp power ON agian after the 3 mins and 15 secs had past
Now with·this one when you power down the Basic Stamp
The Led would STAY ON all the time This·is not what·is wanted in this case
Now i would like understand why this seem to make a different·
I have seen this before that it make a different where you put command next to THEN or on the next line and using ENDIF
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam
Thank you for your reply here are both examples
·One works the way i want it to work the other
One dose not
·I like to understand what is different
Let me clear some thing UP these two routine work fine the way i want them to work they both turn the Led off As long you do not power down the Basic Stamp
The Problem is when you·POWER the Basic Stamp DOWN after· 3 mins and 15 secs have past·and POWER It back UP is where the different thing are happing
·I would like to understand why they work different
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any··that you may have and all of your time finding them
·
·
·
·
Sam
Post Edited (sam_sam_sam) : 12/17/2007 10:10:27 PM GMT
If you end the line with then the next lines are part of the if until you get to an endif.
the first version does not require an endif while the second does.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen