![background image](http://html1.mh-extra.com/html/omron/cx-supervisor-script-reference-rev2-0/cx-supervisor-script-reference-rev2-0_reference-manual_744212157.webp)
APPENDIX B – CX-Server Communications Control
OMRON
Page 144
Revision 2.0
In this example, ‘NewValue’ will be written to the point ‘MyPoint’ in the PLC called ‘MyPLC’. The
script will wait for the write 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
write 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.
ReadArea
Reads a specified block of memory from a PLC.
Examples of synchronous read:
MyVariant = CXServer.ReadArea(“MyPLC/DM0”, 12, vbString)
MyVariant = CXServer.ReadArea(“BoilerTemp”, 10, vbInteger)
MyVariant = CXServer.ReadArea(“BoilerTemp”, 20)
In the first example, DM0 to DM11 will be read as characters (part of a string) from ‘MyPLC’ and
will be stored in ‘MyVariant’. The second example demonstrates that it is also possible to use a
logical name for the start address, and that any VB variant types (such as vbInteger) can be used. The
third example shows that the VB Variant type parameter is optional – if none is specified then
vbInteger is assumed. The script will wait for the read operation to complete before continuing to
execute the next line.
Note:
If accessing from a CX-Supervisor script, the following integral values should be used
for the return type:
Constant Value
Description
vbEmpty 0 Uninitialized
(default)
vbNull
1
Contains no valid data
vbInteger 2 Integer
subtype
vbLong 3 Long
subtype
vbSingle 4 Single
subtype
vbSingle 5 Double
subtype
vbCurrency 6 Currency
subtype
vbDate 7
Date
subtype
vbString 8 String
subtype
vbObject 9 Object
vbError 10
Error
subtype
vbBoolean 11 Boolean
subtype
vbVariant
12
Variant (used only for arrays of variants)
vbDataObject 13
Data access object
vbDecimal 14 Decimal
subtype
vbByte 17
Byte
subtype
Содержание CX-SUPERVISOR - SCRIPT REFERENCE REV2.0
Страница 2: ...CX Supervisor Script Language Software Revision 2 0...
Страница 3: ......
Страница 5: ...CX Supervisor Script Language OMRON Page ii Revision 2 0...
Страница 7: ...CX Supervisor Script Language OMRON Page iv Revision 2 0...
Страница 9: ...CX Supervisor Script Language OMRON Page vi Revision 2 0...
Страница 13: ......
Страница 15: ...CHAPTER 1 Introduction OMRON Page 2 Revision 2 0...
Страница 19: ...CHAPTER 2 Expressions OMRON Page 6 Revision 2 0...
Страница 21: ...CHAPTER 3 Scripts OMRON Page 8 Revision 2 0...
Страница 151: ...CHAPTER 8 Colour Palette OMRON Page 138 Revision 2 0...