6 F 3 B 0 3 6 2

6.5 Sample Programs

This section presents sample programs using UDP and TCP sockets.

1.UDP sockets

This is a sample program that issues the requests used with UDP sockets. It assumes that the parameter set up and operating mode control requests (run mode/socket interface transmission enable) have already completed.

a.UDP open request

This program issues a UDP open request for socket number 2 on the Ethernet Port.

This ladder program is executed by turning on the A contact on the R0620.

 

Parameters:

12544: 3100H, 00049: 0031H

 

 

UDP port number: 4000

 

 

 

 

/* UDP open request: executed when R0620 is set on.

*/

 

 

R0620

 

1- -+[12544

MOV RW000][00049 MOV RW001]----------------------------

/* Module designation, CMD number setup

*/

 

+[00002

MOV RW002][04000 MOV RW003]----------------------------

/* Socket identifier, UDP port number setup */

 

+[RW000

SEND RW010][RST R0620]---------------------------------

 

/* Turn R0620 off after request setup and completion. */

 

 

 

 

 

 

112

Page 113
Image 113
Toshiba T2N instruction manual Sample Programs, UDP sockets, UDP open request