EasyManua.ls Logo

Omron NX102-12 Series - Page 372

Omron NX102-12 Series
578 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Exter-
nal vari-
able
Variable Data type Constant Comment
_EIP_EtnOnlineSta
*1
BOOL Online
*1. For an NX701 CPU Unit and an NX102 CPU Unit, replace the variable with _EIP1_EtnOnlineSta (Port1 On-
line) or _EIP2_EtnOnlineSta (Port2 Online), depending on the built-in EtherNet/IP port which is used.
For an NX1P2 CPU Unit, replace the variable with _EIP1_EtnOnlineSta (Port1 Online).
// Start sequence when Trigger changes to TRUE.
IF((Trigger=TRUE) AND(DoSendAndRcv=FALSE) AND (_EIP_EtnOnlineSta=TRUE))THEN
DoSendAndRcv :=TRUE;
Stage :=INT#1;
SktUDPCreate_instance(Execute:=FALSE); // Initialize instance.
SktUDPSend_instance( // Initialize instance.
Execute :=FALSE,
SendDat :=SendSocketDat[0]); // Dummy
SktUDPRcv_instance( // Initialize instance.
Execute :=FALSE,
RcvDat :=RcvSocketDat[0]); // Dummy
SktClose_instance(Execute:=FALSE); // Initialize instance.
END_IF;
IF (DoSendAndRcv=TRUE) THEN
CASE Stage OF
1 : // Request to create a s
ocket.
SktUDPCreate_instance(
Execute :=TRUE,
SrcUdpPort :=UINT#6000, // Local UDP port number
Socket =>WkSocket); // Socket
IF (SktUDPCreate_instance.Done=TRUE) THEN
Stage :=INT#2; // Normal end
ELSIF (SktUDPCreate_instance.Error=TRUE) THEN
Stage :=INT#10; // Error end
END_IF;
2 : // Send request
WkSocket.DstAdr.PortNo :=UINT#6001;
WkSocket.DstAdr.IpAdr :='192.168.250.2';
SktUDPSend_instance(
Execute :=TRUE,
Socket :=WkSocket, // Socket
SendDat :=SendSocketDat[0], // Send data
Size :=UINT#2000); // Send data size
IF (SktUDPSend_instance.Done=TRUE) THEN
9 Socket Service
9-18
NJ/NX-series CPU Unit Built-in EtherNet/IP Port Users Manual (W506)

Table of Contents

Related product manuals