EasyManua.ls Logo

Omron NJ501-1300 - Page 195

Omron NJ501-1300
398 pages
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...
8-23
8 Message Communications
NJ-series CPU Unit Built-in EtherNet/IP Port Users Manual (W506)
8-2 Using CIP Message Communications
8
8-2-7 Sample Programming for CIP Connection
(Class 3) Message Communications
IF (DoCIPTrigger=TRUE) THEN
CASE Stage OF
1 : // Open CIP class 3 connection.
CIPOpen_instance(
Execute :=TRUE,
TimeOut :=UINT#20, // Timeout time: 2.0 s
RoutePath :='02/192.168.250.2'); // Route path
IF (CIPOpen_instance.Done=TRUE) THEN
Stage :=INT#2; // Normal end
ELSIF (CIPOpen_instance.Error=TRUE) THEN
Stage :=INT#10; // Error end
END_IF;
2 : // Request writing value of variable.
CIPWrite_instance(
Execute :=TRUE,
Handle :=CIPOpen_instance.Handle, // Handle
DstDat :='WritingDat', // Source variable name
Size :=UINT#1, // Number of elements to write
SrcDat :=WriteDat); // Write data
IF (CIPWrite_instance.Done=TRUE) THEN
Stage :=INT#3; // Normal end
ELSIF (CIPWrite_instance.Error=TRUE) THEN
Stage :=INT#20; // Error end
END_IF;
3 : // Request reading value of variable.
CIPRead_instance(
Execute :=TRUE,
Handle :=CIPOpen_instance.Handle, // Handle
SrcDat :='OriginalDat', // Source variable name
Size :=UINT#1, // Number of elements to read
DstDat :=ReadDat); // Read data
IF (CIPRead_instance.Done=TRUE) THEN
Stage :=INT#4; // Normal end
ELSIF (CIPRead_instance.Error=TRUE) THEN
Stage :=INT#30; // Error end
END_IF;

Table of Contents

Related product manuals