Thank you for your reply.I use a subprogram to read the M value and set the value of M, but will be counted twice cause unexpected results in the ladder program.
Today, I placed the M0 value in the TMR to the M4, then an interval of 0.1 seconds and then reset the TMR, then after TMR M1 M4 subtract of the expected value. The ladder program changed to the following code, it can work!