The 'Exit' command is supposed to cause a loop to be exited and program execution continues at the first line after the loop. I have a situation in simulating the 08M where this is not occurring, and seems to be a simulator problem. I am using Version 5.2.6.
The below code doesn't do anything, but illustrates the problem (I also have the problem in my real code that IS supposed to do something, but that code is more complicated than necessary to include here exclusively for the purposes of illustration).
Load the below code and set the generic analog value to 800 then have the simulator step through quickly. No problems. Stop the simulator at a convenient point in the code, say the 'For' statement (step to it if necessary). Change the analog value, which is the value read into W5 by the ReadADC10 command, to, say, 12, or anything <751, which will trigger the Exit. The Exit does cause the loop to be exited, however, program execution jumps to the Let Dirs command (as if a reset had been issued) and the code immediately below the For/Next loop is not executed at all. Let the simulator run freewheel and you will see this behavior repeats on each iteration of the loop.
Now, the real question is whether this happens in the 08M too?
Tech Support, any ideas?
Thanks, Odessa
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Let Dirs=%00001
CFL:
For W6=W2 to 100
Gosub TFD
If W5<751 then Exit
Pause 6
Next W6
b9=50
b3=178
Goto CFL
TFD:
ReadADC10 2,W5
Return
The below code doesn't do anything, but illustrates the problem (I also have the problem in my real code that IS supposed to do something, but that code is more complicated than necessary to include here exclusively for the purposes of illustration).
Load the below code and set the generic analog value to 800 then have the simulator step through quickly. No problems. Stop the simulator at a convenient point in the code, say the 'For' statement (step to it if necessary). Change the analog value, which is the value read into W5 by the ReadADC10 command, to, say, 12, or anything <751, which will trigger the Exit. The Exit does cause the loop to be exited, however, program execution jumps to the Let Dirs command (as if a reset had been issued) and the code immediately below the For/Next loop is not executed at all. Let the simulator run freewheel and you will see this behavior repeats on each iteration of the loop.
Now, the real question is whether this happens in the 08M too?
Tech Support, any ideas?
Thanks, Odessa
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Let Dirs=%00001
CFL:
For W6=W2 to 100
Gosub TFD
If W5<751 then Exit
Pause 6
Next W6
b9=50
b3=178
Goto CFL
TFD:
ReadADC10 2,W5
Return
Last edited: