Structures and Enums

UDPCommMgr_typ

The main structure for a single UDP Comm Manager instance. An application declares one UDPCommMgr_typ variable per interface (conventionally named commMgr, as used throughout this documentation) and passes it to UDPCommFn_Cyclic every scan. The sub-structure headers below use commMgr to show how each member is addressed.

commMgr

Name Type Description
IN UDPCommMgr_IN_typ Structure containing all inputs for commMgr
OUT UDPCommMgr_OUT_typ Structure containing all outputs for commMgr

commMgr.IN

Name Type Description
CMD UDPCommMgr_IN_CMD_typ Commands for commMgr
PAR UDPCommMgr_IN_PAR_typ Parameters for commMgr
CFG UDPCommMgr_IN_CFG_typ Configurations for commMgr

commMgr.IN.CMD

Name Type Description
Enable BOOL Enable FUB
Send BOOL Send datagram on rising edge or on level if AllowContinuosSend is True
AcknowledgeData BOOL Acknowledge data received and clear receive data
AcknowledgeError BOOL Acknowledge error

commMgr.IN.PAR

Name Type Description
AllowContinuousSend BOOL Enables level sensitive Send command
SendFlags UINT Send flags to be used see AsUDP for supported UDP flags
pSendData UDINT Pointer to data to be sent
SendLength UDINT Length of data to be sent
AllowContinuousReceive BOOL Data will be continuously cleared without need to AcknowledgeData
ReceiveFlags UINT Receive flags to be used see AsUDP for supported UDP flags
pReceiveData UDINT Pointer to buffer where received data should be stored
MaxReceiveLength UDINT Size of receive data buffer
DisableReceiving BOOL Disables receiving without disabling the whole communication manager

commMgr.IN.CFG

Name Type Description
LocalInterface UDPCommMgr_Interface_typ Interface to be used locally
RemoteInterface UDPCommMgr_Interface_typ Remote interface for data to be sent

commMgr.OUT

Name Type Description
STAT UDPCommMgr_OUT_STAT_typ Structure containing all stats for commMgr

commMgr.OUT.STAT

Name Type Description
CommunicationActive BOOL Communication is active
Sending BOOL Currently sending data
DataSent BOOL Data is sent. Stays TRUE until Send is cleared (unless AllowContinuousSend is set)
SentDataLength UDINT Length of data that was sent with last command
NewDataAvailable BOOL New data has been received
ReceivedDataLength UDINT Length of received data
ReceivedFromInterface UDPCommMgr_Interface_typ Interface last data was received from
Ident UDINT Ident for local interface
Error BOOL Indicates error has occurred
ErrorID UINT Error ID
ErrorString STRING Error description

UDPCommMgr_Interface_typ

Name Type Description
IPAddress STRING IP address to be used for interface
Port UINT Port to be used for interface

Errors/Status

The following errors can appear in commMgr.OUT.STAT.ErrorID (when commMgr.OUT.STAT.Error is set), or as the return value of the library functions.

Name Value Description
UDPCOMM_ERR_INVALIDINPUT 50000 Invalid input reference (e.g. a null pointer) passed to the function
UDPCOMM_ERR_RECVDATATOOLARGE 50001 Received data is larger than the receive buffer (MaxReceiveLength)
UDPCOMM_ERR_SENDDATATOOLARGE 50002 Data to send is larger than the send buffer (SendLength)