TurpoUrpo
Lifetime Supporting Member
Yes it was, my eyes hurt trying to read it.
I use an integer step number for each sequence. I set an 'increment' bit when I am on step n and the conditions are true to move onto step n + 1, Once incremented I reset the bit. When the final step in the sequence is true, I reset the step number.
I then use range comparators on the integer step number to set flags to request outputs to energise.
Advantages:
1. Finished code is clean and easily readable by others
2. Step numbers relate directly to the FDS - you *have* got one these? - just checking
3. Mods to the sequence are simple
4. This method can be used on any PLC.
I'll have a play with this next time I write a sequence. I guess I use an increment bit from the days when setting a bit was 1 byte whereas moving a constant was 4 bytes and this could be significant - not so relevant any more now that PLCs generally have decent amounts of memory and are reasonably quick
I use nearly the same step-technique as you do, only putting the whole schmutz into one FB. And I gave up the S/R bits looong time ago.
***
A comment to JL.
I think you could (but neither say you should, nor that it is better) use it with your integer 'random' numbering aswell. Look here at this simple example:
Kalle
SET is useful when there needs to be some hand shaking between two asynchronous tasks. Task 1 SETs a bit to signal some event. Task 2 is waiting for the bit and when it is set Task 2 continues doing something but also clears or RSTs the bit two acknowledge the transaction.I don't think set should never be used, but I do save it for those times that it really adds something.