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 |
| ||
MOV RW000][00049 MOV | |||
/* Module designation, CMD number setup | */ | ||
| |||
+[00002 | MOV RW002][04000 MOV | ||
/* Socket identifier, UDP port number setup */ | |||
| |||
+[RW000 | SEND RW010][RST | ||
| /* Turn R0620 off after request setup and completion. */ | ||
|
| ||
|
|
|
|
⎯ 112 ⎯