Omron CS CJ1W-ETN21 User Manual

Page 157

Advertising
background image

133

Using Socket Services by Manipulating Dedicated Control Bits

Section 6-7

Programming Example

If the Close Request Switch (CIO 151905) turns OFF
while the UDP Opening Flag (CIO 000201) is OFF, the
contents of the response code (D30027) in the Socket
Service Parameter Area is checked, and if it is not 0000
Hex (normal end), the UDP Close Error Flag (CIO
000101) is turned ON.

After the execution results have been checked, the UDP
Close Bit (CIO 000001) is turned OFF.

After the parameter has been set, the Close Request
Switch (CIO 151905) is turned ON and the UDP Closing
Flag (CIO 000201) is turned OFF.

When the UDP Closing Flag (CIO 000201) turns ON, the
following parameter is written to the parameter area for
socket number 1.
D30018: 0001 Hex = UDP/TCP socket No. 1

UDP Close
When the UDP Close Bit (CIO 000001) turns ON, the UDP
Close Error Flag (CIO 000101) is turned OFF and the
UDP Closing Flag (CIO 000201) is turned ON to initialize
processing.

If the UDP Open Request Switch (CIO 151900) turns
OFF while the UDP Opening Flag (CIO 000200) is OFF,
the contents of the response code (D30027) in the Socket
Service Parameter Area is checked, and if it is not 0000
Hex (normal end), the UDP Open Error Flag (CIO
000100) is turned ON.

After the execution results have been checked, the UDP
Open Bit (CIO 000000) is turned OFF.

After the parameters have been set, the UDP Open Re-
quest Switch (CIO 151900) is turned ON and the UDP
Opening Flag (CIO 000200) is turned OFF.

When the UDP Opening Flag (CIO 000200) turns ON, the
following parameters are written to the parameter area for
socket number 1.
D30018: 0001 Hex = UDP/TCP socket No. 1
D30019: 1000 Hex = Local UDP/TCP port No. 4096

UDP Open
When the UDP Open Bit (CIO 000000) turns ON, the UDP
Open Error Flag (CIO 000100) is turned OFF and the UDP
Opening Flag (CIO 000200) is turned ON to initialize pro-
cessing.

UDP Send
When the UDP Send Bit (CIO 000002) turns ON, the UDP
Send Error Flag (CIO 000102) is turned OFF and the UDP
Sending Flag (CIO 000202) is turned ON to initialize pro-
cessing.

@RSET

000000

@SET

MOV(21)

000000

000200

MOV(21)

SET

000000

RSET

000200

SET

000000

000200

151900

<>(305)

RSET

000000

000200

151900

@RSET

000001

@SET

MOV(21)

000001

000201

SET

000001

RSET

000201

Continued on next page.

SET

000001

000201

151905

<>(305)

RSET

000001

000201

151905

@RSET

000002

@SET

000100

000200

#0001

D30018

#1000

D30019

151900

000200

000100

000000

000101

000201

#0001

D30018

151905

000201

000101

000001

000102

000202

D30027

#0000

D30027

#0000

Advertising