Sample Programming
In this sample, the SendCmd instruction sends CPU UNIT DATA READ command from the network
No. 0, node No. 2, Unit No. 0 and receives the data.
Ethernet cable
Node address 1
Node address 2 Unit No. 0
CPU UNIT DATA READ
ST
Internal
Varia-
bles
Name Data type Initial value Comment
T
rigger BOOL FALSE Execution condition
DoFinsTrigger BOOL FALSE Processing
SendCmdExecute BOOL FALSE SendCmd instruction execu-
tion flag
State SINT 0 Sample programming status
InDNetAdr _sDNET_ADR NetNo:=0, NodeNo:=0,
UnitNo:=16#0
Network address at send
destination
InOption _sRESPONSE isNonResp:=FALSE,
T
imeOut:=0, Retry:=0
Response
CmdDat ARRA
Y[0..1] OF
BYTE
[2(16#0)] Send data
RespDat ARRAY[0..1023] OF
BYTE
[1024(16#0)] Receive data
SendCmdInstance SendCmd SendCmd instance
External variable Name Data type Comment
_Port_isAvailable BOOL Network Communications Instruction Enabled Flag
IF ( (Trigger=TRUE) AND (DoFinsTrigger=FALSE) AND (_Port_isAvailable=TRUE) ) THEN
State:= 1;
DoFinsTrigger:=TRUE;
SendCmdExecute := FALSE; // Send execution status
InDNetAdr.NetNo :=USINT#0; // Set network address.
InDNetAdr.NodeNo :=USINT#2;
InDNetAdr.UnitNo :=BYTE#16#0;
InOption.isNonResp :=FALSE; // Set response.
InOption.TimeOut :=UINT#20;
InOption.Retry :=USINT#2;
3 Client Function
3-17
NX-series CPU Unit FINS Function User's Manual (W596)
FINS Communications Instructions
3
SendCmd