FB_ArtNetReceive

FB_ArtNetReceive 1:

This function block receives Art-Net telegrams via UDP.

VAR_INPUT

    bExecute          : BOOL;
    sSrvNetId         : T_AmsNetId,
    sLocalHost        : T_IPv4Addr;
    nLocalPort        : UDINT;
    tTimeout          : TIME;

bExecute: The block starts processing if a positive edge is encountered at this input. A negative edge terminates processing.

sSrvNetId: String containing the network address of the TwinCAT TCP/IP Connection Server. For the local computer (default) an empty string may be specified.

sLocalHost: The local IP address (IPv4) of the UDP client/server socket as a string (e.g. '2.168.0.5'). An empty string may be specified for the default network adapter.

nLocalPort: The local IP port number of the UDP client/server socket (e.g. 6454).

tTimeout: States the length of the timeout that may not be exceeded during execution of the command.

VAR_OUTPUT

    bBusy                 : BOOL;
    bError                : BOOL;
    nErrorID              : UDINT;
    bArtPollReceived      : BOOL;
    stDmxData             : ST_DmxArtNetData;
    stFrameCounter        : ST_FrameCounter;
    aAvailableNodes       : ARRAY[0..31] OF ST_PollReplyParameter;

bBusy: When the function block is activated this output is set. It remains set until a feedback is received.

bError: If an error should occur during the transfer of the command, then this output is set once the bBusy output was reset.

nErrorID: Returns the error code of the last executed step, if the bError output is set.
See Error codes.

stDmxData: This structure contains the most recently received data.

stFrameCounter: Structure with information about the number of received 'ArtPoll', 'ArtPollReply' and 'ArtDmx' telegrams.

aAvailableNodes: Provides an array of a structure with information on further Art-Net™ devices, from which an 'ArtPollReply' telegram was sent.

VAR_IN_OUT

    hSocket       : T_HSOCKET;

hSocket: Input/output variable with the handle of an opened UDP socket. If the transfer takes place at input 0, the system tries to create a new socket.
If successful, a new socket is opened, and hSocket provides the associated socket handle.