Jump to content
OMRON Forums

Variable Range in PLC program


Recommended Posts

I'm using a range of P-variables to store positions (P800..899). I can issue the following online command to zero out all of the P-variables in the range:




This doesn't seem to work in PLC or motion programs, however (it gives a syntax error in PEWIN32Pro). I have tried the following instead:




This does not give a syntax error, but I'm not confident that it is having the intended effect (I have a customer running the code, so I don't have direct access to PMAC from my shop currently). Is this valid?


I assume that I could write a While loop and incrementally write 0 to each variable, but this seems inefficient.


What is the recommended method to write a single value to a large range of variables when in a PLC or motion program?

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

This is valid. You will need a one-time while loop to force the execution at that point as in the following:








A Cmd”” is not executed until the end of this PLC’s current scan. The while loop acts as a “current scan”.

Link to comment
Share on other sites

This topic is now closed to further replies.

  • Create New...