Jump to content
OMRON Forums

Variable Range in PLC program


iannicholson

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:

 

P800..899=0

 

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:

 

CMD"P800..899=0"

 

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:

 

Cmd”P800..899=0”

P900=1

While(P900=1)

P900=0

Endwhile

 

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

Guest
This topic is now closed to further replies.

×
×
  • Create New...