2-693
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Communications Instructions
2
CIPRead
The CIPRead instruction reads the value of the network variable specified with source variable name
SrcDat from another Controller on a CIP network. The other Controller is specified with Handle.
The read data value is stored in DstDat.
Size specifies the number of elements to read. If SrcDat is an array, specify the number of elements to
read with Size. If SrcDat is not an array, always specify 1 for Size. If the value of Size is 0, nothing is
read regardless of whether SrcDat is an array or not.
When the read operation is completed, the number of bytes of the data that was read is assigned to
read data size RcvSize. You can read a maximum of 1,988 bytes of data.
The data type of Handle is structure _sCIP_HANDLE. The specifications are as follows:
If the value of ErrorID is WORD#16#1C00, the CIP message error code is stored in ErrorIDEx.
The following example reads the value of variable abc. The read data is stored in variable def and the
value of variable vwx changes to UINT#1.
To read array data, pass a subscripted array element to ScrDat as the parameter. Also pass a sub-
scripted array element to DstDat as the parameter. The following example reads the four array variable
elements abc[3] to abc[6] and stores the results in array variable elements def[10] to def[13]. The value
of variable vwx will be UINT#4.
Function
Name Meaning Description Data type Valid range Unit Default
Handle Handle Handle _sCIP_
HANDLE
--- --- ---
Handle Handle Handle UDINT Depends on
data type.
--- ---
Reading Arrays
CIPRead_instance(A, cip_h, ‘abc’, UINT#1,
def, ghi, jkl, mno, pqr,
stu, vwx);
LD
ST
jkl
mno
pqr
stu
vwx
cip_h
‘abc’
UINT#1
def def
ghi
A
CIPRead
CIPRead_instance
Execute Done
Handle Busy
SrcDat Error
Size ErrorID
DstDat
ErrorIDEx
RcvSize
CIPRead_instance(A, cip_h, ‘abc[3]’, UINT#4,
def[10], ghi, jkl, mno, pqr,
stu, vwx);
LD
ST
jkl
mno
pqr
stu
vwx
cip_h
‘abc[3]’
UINT#4
def[10] def[10]
ghi
A
CIPRead
CIPRead_instance
Execute Done
Handle Busy
SrcDat Error
Size ErrorID
DstDat
ErrorIDEx
RcvSize