Udp Sample Programming - Omron Sysmac NJ-series User Manual

Machine automation controller cpu unit built-in ethernet/iptm port
Hide thumbs Also See for Sysmac NJ-series:
Table of Contents

Advertisement

9-6-4

UDP Sample Programming

In this sample, the UDP socket service is used for data communications between the NJ/NX-series
Controller and a remote node.
IP address: 192.168.250.1
UDP port number: 6000
Built-in EtherNet/IP Port
The processing procedure is as follows:
1
The SktUDPCreate instruction is executed to request creation of a UDP socket.
2
Execute the SktUDPSend instruction to request sending. The data in SendSocketDat[] is sent.
3
The SktUDPRcv instruction is executed to request reception. The receive data is stored in
RcvSocketDat[].
4
The SktClose instruction is executed to close the socket.
ST
Internal
Variables
External
Variables
*1 For an NX701 CPU Unit, replace the variable with _EIP1_EtnOnlineSta (Port1 Online) 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).
NJ/NX-series CPU Unit Built-in EtherNet/IP Port User's Manual (W506)
IP address: 192.168.250.2
UDP port number: 6001
Data sent.
Data received.
Ethernet line
Variable
Trigger
BOOL
DoSendAndRcv
BOOL
Stage
INT
RcvSocketDat
ARRAY[0..1999] OF
BYTE
WkSocket
_sSOCKET
SendSocketDat
ARRAY[0..1999] OF
BYTE
SktUDPCreate_instance
SktUDPCreate
SktUDPSend_instance
SktUDPSend
SktUDPRcv_instance
SktUDPRcv
SktClose_instance
SktClose
Variable
BOOL
*1
_EIP_EtnOnlineSta
Remote node
Data type
Initial value
False
False
0
[2000(16#0)]
(Handle:=0,
SrcAdr:=(PortNo:=0, IpAdr:=''),
DstAdr:=(PortNo:=0, IpAdr:=''))
[2000(16#0)]
Data type
Constant
9 Socket Service
Comment
Execution condi-
tion
Processing
Status change
Receive data
Socket
Send data
Comment
Online
9-19
9

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Sysmac nx-seriesSysmac nx1p2-10 seriesSysmac nx1p2-90 seriesSysmac nj501-5 seriesSysmac nj501-4 seriesSysmac nj501-3 series ... Show all

Table of Contents