One thing the OP has not stated is what type of solenoid (bet they do not know) it can make a difference in which way you write the code, for example if a 5 port valve then there is no need to keep the coil energised it only needs a pulse, In that situation I normally keep it on until it reaches position (or alarm timeout). not that it probably matters but holding a solenoid on (assume back while machine at standby) can cause premature overheating of the coil reducing it's life span.
Going back to small code, It will also depend on which order you put AND/OR logic.
Example Siemens:
A M0.0
A(
OR M0.1
OR M0.2
)
= M 0.3
However,
OR M0.1
OR M0.2
A M0.0
= M0.3
is the same thing but less instructions.
Melsec
Going back to small code, It will also depend on which order you put AND/OR logic.
Example Siemens:
A M0.0
A(
OR M0.1
OR M0.2
)
= M 0.3
However,
OR M0.1
OR M0.2
A M0.0
= M0.3
is the same thing but less instructions.
Melsec