This will occur if customer is writing to outputs individually as opposed to writing once to the entire 24-bit word or 16-bit word in once shot.
Example: M10->X:$78420,0 M11->X:$78420,1 M12->X:$78420,2, if all set to zero intially.
If you write M10=1, M11=1, M12=1 in sequence, you might get M10=0 M11=1 m12=1. The problem is that m10 did not get set correctly.
The reason it occurs is because the MACRO CPU firmware will perform an entire read/modify write to the entire 24 or16 bit word for each output bit. For example, if you write M10=1, you are really writing to the entire 24 or 16 bit word and it takes time for the MACRO CPU to perform this task. The proper way to do this is to write to the output with one write statement instead of 16 or 24 (or 3 for that matter) simultaneously.
The reason you put the delay in between each output in your example is to allow the outputs to be processed properly on a bit by bit basis... the example in the manual builds the output word bit by bit and then with one write statement, you will write to the entire node address instead of 24 individual writes.
#define Inputs M4000 ; M-Variable pointer to hold 24-bit inputs
#define Outputs M4001 ; M-Variable pointer to hold 24-bit outputs
Inputs->X:$78420,0,24,U ; I/O Node 2 24-bit register (inputs)
Outputs->X:$78424,0,24,U ; I/O Node 3 24-bit register (outputs)
#define InMirror M4002 ; M-Variable pointer to hold inputs mirror word
#define OutMirror M4003 ; M-Variable pointer to hold outputs mirror word
#define OutState M4004 ; M-Variable pointer to latch current outputs state
InMirror->X:$10F0,0,24,U ; Reserve unused memory register (to hold inputs)
OutMirror->Y:$10F0,0,24,U ; Reserve unused memory register (to hold outputs)
OutState->* ; Self referenced
OutState=0 ; Initialize =0 on download
Open plc 1 clear
If (InMirror!=Inputs) ; Inputs state changed?
InMirror=Inputs ; Update inputs mirror word to match current state
EndIf ;
If (OutState!=OutMirror) ; Outputs state changed?
OutState=OutMirror ; Update state of outputs mirror word
Outputs=OutMirror ; Update outputs
EndIf
Close