Thanks for the helpful comments.
A description of the program :
There are several modes of operation:
1- Standard process according to set points (3 temperatures and 1 relative humidity) by which some of 8 outputs are ON and some OFF in 8 states (combination matrix of 3 temperatures and 1 rh).
2- external (by modbus) main switch. When on - the operation is same as (1), otherwise shut down of all outputs in particular order.
3- operation in case of operational problems (detected by digital inputs). In this case, and depending on the detected fault , some of the outputs go off and stay that way for several minutes.
Based on this I decided to dedicate each mode of operation to its own subroutine which run one after another, wherein 8 internal MBs change state before actual output. Thise are overriden in order: mode 1 then 2 and last 3. So the last mode turns off relevant MBs set beforehand.
The snippets I posted above are from the third subroutine (events).
Now, I see that I should have used resets instead of inverted coils, because I need only to turn false some of the MBs. DanT -so yes because of this coils were true instead of just going false in this subroutine.
Ausman, I'll consider your suggestion on using vectors instead of MBs.
I tell you all this because maybe you have another idea for the design of the entire program.