Ok Steve,
We will try again, I am confusing myself as well now.
this is what you block says:-
FB55 SEG11
:L KF +22
:L FY 59
:>< F
:JC M001
:S F154.2
:S F154.6
:R F154.1
:A I48.2
:JC M002
:JU M001
M002:
L KF +23
T FY 59
M001:
***
One line at a time, this will also help me to understand a bit better.
L KF +22 //load constant (INT) 22
L FY 59 //Load the value in FY 59, although this value is in HEX that doesn't matter.
>< F //Compare both values with each other
JC M001 //jump if the above is true to label M001.
S F154.2 //Set flag 154.2
S F154.6 //Set flag 154.6
R F154.1 //Reset flag 154.1
A I48.2 //Check wether input 48.2 is made
JC M002 //If I48.2 is made then jump to label M002
JU M001 //If I48.2 is not made then jump to label M001
M002: //Label M002
L KF +23 //load constant (INT) 23
T FY 59 //Transfer the value 23 into FY 59 (in hex that would be 17)
M001 //Label M001, which is the segment end, go to next segment.
Now, I am not convince that the compare function should be a compare for inequality, I would have thought it would be a == (compare for equality), because as you say, this seems to be logic to 'step' the process on, what I call an 'Auto state register', in otherwords when the process is in 'auto state' 22 do such and such, then when 'auto state' 22 has finished (I48.2 is made) load 23 into the 'auto state' register and do whats required to complete that 'auto state' and so on.
Each step in the routine is controlled by the relevant FY.
Would that be FY 59?
The reason for this was that a flag was constantly set and i could only reset it by using CONTROL VARIABLE again to reset the flag.
What flag did you reset?
If you are having to force the machine into the next 'auto state' by inserting the next state number into the FY (59 or ?) and the machine is only cycling once and then stopping at the same place again, then the conditions that allow the next step (auto state) to load are not being satisfied, perhaps I48.2 is not being made?
I am not sure if this has helped you any, or maybe totally confused you. Perhaps you could email me the relevant block, or even the whole project, that might give me a better understanding of what is actually happening.
Paul