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

Script language
Table of Contents

Advertisement

APPENDIX B – CX-Server Communications Control
Examples
bValid = CXServer.IsPointValid("MyPoint")
bValid = CXServer.IsPointValid("MyPoint", "MyPLC")
In both examples, the boolean variable bValid is set True if the point "MyPoint" has been defined.
PLC Memory Functions
(A, AR, C, CIO, D, DM, DR, E, EM, -
G, GR, H, IR, LR, SR, ST, T, TC, TK, W)
All PLC memory functions (e.g. A, AR, D, DM etc.) work in exactly the same way. The following
examples use the DM function to get and set the value of a DM address in a PLC.
Example 1
intVal = CXServer.DM(100)
In this example, the contents of DM100 will be read from the PLC and stored in 'intVal'.
Note:
These examples assume there is only 1 PLC in the CX-Server project file, or that the
'SetDefaultPLC' function has been used to select the required PLC. Refer to the
'SetDefaultPLC' function for details about using script with multiple PLCs in the
project.
Example 2
CXServer.DM(100) = 75
In this example, the value 75 will be written to DM100 in the PLC.
Bit addressing, that is accessing data from individual memory bits, is also supported by these memory
areas: IR, AR, HR and CIO.
Example 3
bVal = CXServer.IR("100.2")
In this example, the status of bit IR100.2 (i.e. bit 2 of IR100) will be read from the PLC and stored in
'bVal' (e.g. 'bVal' will be set to TRUE or FALSE).
Example 4
CXServer.IR("100.2") = True
In this example, bit IR100.2 (i.e. bit 2 of IR100) in the PLC will be set to True. Note that use of the
quotes is optional, but is required to differentiate between 100.1 and 100.10
ListPLCs
Holds a list of all PLC names configured in the project file. This property is read only.
Page 146
OMRON
Revision 2.0

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cx-supervisor 2.0

Table of Contents