Pete,
it sounds like you are working on a fairly complex problem.
As you have figured out the TBASIC language does not have any sort of computed GOTO or computed CALL functionality. So your choices are to either make the computed CALL using a CF or to do it in ladder logic.
I am guessing that your code is using the variable SeqNo to make decisions. Most of my non-trivial PLC programs work in this manner.
The PLCs allow you to use COUNTERs 1..8 as "sequencers". The Present Value of these Sequencer/Counters can be tested in ladder logic and the Preset Values can be changed in ladder logic. When used as Sequencers you are limited to the values of 0..31.
I use this mechanism for many reasons:
- Ladder logic is faster than TBASIC in making these decisions
- The SeqNo is visible for debug both in simulation and on-line monitoring.
- The SeqNo can be changed during debug to force code to run. for debug.
- it provides a method to support multiple threads of operation. Poor-man's multitasking.
This approach scares most PLC programmers because it sounds too complex.
If you are interested, I have posted many examples of this sort of approach. I’d be happy explain how it works.
Gary d