udpRcvFromVar

PLCopen motion icon

 Function - Receives the contents of a variable from another controller through UDP.

Inputs

Input

Data Type

Range

Unit

Default

Description

En

BOOL

0 to 1

N/A

No default

Execute the function.

sock

DINT

0, 65535

N/A

No default

Socket number, return value from udpCreate.

add[ ]

USINT

0 to 32

N/A

No default

Array which contains information about the server.

This includes the sender's IP address.

varName

STRING

 

N/A

No default

The name of a PxMM variable (or array or structure) that stores data from the sender.

The variable should be the same type as what is being sent.

See udpSendToVar for more information.

Outputs

Output

Data Type

Range

Unit

Description

OK

BOOL

 

N/A

Returns TRUE when the function successfully executes.

See Function - General Rules.

Q

DINT

 

N/A

Number of bytes received.

Remarks

  • Receives the contents a variable sent from another controller and saves it to a local variable.
  • This allows for the exchange of data across controllers.

Figure 1: udpRcvFromVar


  • Limitations

    • Function block instance variable types are not supported.
    • These types of variables cannot be sent or received:
      • Variables defined with a UDFB.
      • The Input and Output variables defined for a sub-program.
    • udpSendToVar and udpRcvFromVar do not automatically swap bytes for big vs. little endian systems.
    • Send / receive functionality is:

       

      PCMM / AKD PDMM

      PCMM2G

      Simulator

      PCMM / AKD PDMM

      PCMM2G

      Simulator

      Compatibility is based on the endianness of the controller's information.
      PCMM and AKD PDMM are big-endian.
      PCMM2G and Simulator are little-endian.

    • 3rd party stand-alone programs on x86 platforms are responsible for endian conversions for UDP telegrams from a AKD PDMM / PCMM.

FBD Language Example

FFLD Language Example

IL Language Example

Not available.

ST Language Example

            udpRcvFromVar( Socket_Number, Add, MyUDPVar )