Omron CX-SUPERVISOR - SCRIPT REFERENCE REV2.0 Reference Manual page 156

Script language
Table of Contents

Advertisement

OMRON
Each 'Value' function above will access data in the PLC called 'MyPLC'.
Note:
If there is only 1 PLC in the project then it is not necessary to call the 'SetDefaultPLC'
function. The first PLC in a project will automatically be set as the default PLC.
OpenPLC
Opens a PLC for communications. If no PLC is specified then the default PLC is opened.
Example 1:
CXServer.SetDefaultPLC("MyPLC")
CXServer.OpenPLC()
CXServer.DM(100) = 10
CXServer.DM(50) = 10
Example 2:
CXServer.OpenPLC("MyPLC")
CXServer.DM(100) = 10
ClosePLC
Closes a previously opened PLC. If no PLC is specified then the default PLC is closed.
Example:
CXServer.ClosePLC("MyPLC")
Read
Function to read the value of a PLC point.
Example of synchronous Read
intVal = CXServer.Read("MyPLC", "MyPoint", 0)
In this example, the Point 'MyPoint' will be read from the PLC 'MyPLC' and stored in 'intVal'. The
script will wait for the read operation to complete before continuing to execute the next line due to
the '0' parameter. This is identical to the operation of the 'Value' method.
Note: If the PLC is not open, then this command will cause it to be opened, and then closed after the
read is complete. If more than one read or write operation is to be performed, it is considerably
faster and more efficient to use the OpenPLC command first, do all the reading and writing, and then
(if required) use the ClosePLC command to close the PLC.
Write
Function to write the value of a PLC point.
Example of synchronous write:
CXServer.Write("MyPLC", "MyPoint", NewValue, 0)
Revision 2.0
APPENDIX B – CX-Server Communications Control
Page 143

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cx-supervisor 2.0

Table of Contents