UDP ¶ UDP_Peer (FunctionBlock) UDP_Receive (FunctionBlock) UDP_ReceiveBuffer (FunctionBlock) UDP_Send (FunctionBlock) UDP_SendBuffer (FunctionBlock)
UDP_Peer (FB) ¶ FUNCTION_BLOCK UDP_Peer EXTENDS CBM.LTrig This function block activates a Peer by setting xEnable to TRUE. InOut: Scope Name Type Initial Comment Inherited from Input xEnable BOOL TRUE : Action starts FALSE : Action stops, outputs xDone , xBusy , xError are resetted LTrig Output xDone BOOL TRUE : Action successfully completed LTrig xBusy BOOL TRUE : Function block active LTrig xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error LTrig Input ipAddr IP_ADDR STRUCT(sAddr := ‘0.0.0.0’) ‘0.0.0.0’ => INADDR_ANY ‘127.0.0.1’ => INADDR_LOOPBACK ‘255.255.255.255’ => INADDR_NONE uiPort UINT ipMultiCast IP_ADDR STRUCT(sAddr := ‘255.255.255.255’) Multicast address. ‘255.255.255.255’ => INADDR_NONE Output eError ERROR xActive BOOL TRUE if the handle is valid hPeer CAA.HANDLE
UDP_Receive (FB) ¶ FUNCTION_BLOCK UDP_Receive EXTENDS CBM.LTrig This function block serves to receive data. The pointer pData specifies the memory area to write the read data to. szSize defines the max number of bytes to read. When data was read successfully, xReady is set to TRUE and szCount indicates the actually read number of bytes. ipFrom and uiPortFrom indicate the ip and port the data was received from. InOut: Scope Name Type Comment Inherited from Input xEnable BOOL TRUE : Action starts FALSE : Action stops, outputs xDone , xBusy , xError are resetted LTrig Output xDone BOOL TRUE : Action successfully completed LTrig xBusy BOOL TRUE : Function block active LTrig xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error LTrig Input hPeer CAA.HANDLE szSize CAA.SIZE pData CAA.PVOID Output eError ERROR xReady BOOL ipFrom IP_ADDR uiPortFrom UINT szCount CAA.SIZE
UDP_ReceiveBuffer (FB) ¶ FUNCTION_BLOCK UDP_ReceiveBuffer EXTENDS CBM.LTrig Like UDP_Receive this function block serves to receive data. The function block returns the handle of the buffer containing the data. As long as xReady is TRUE a new handle for the buffer can arrive. ipFrom and uiPortFrom indicate the ip and port the data was received from. The buffer is passed on and not copied like at UDP_Receive . InOut: Scope Name Type Comment Inherited from Input xEnable BOOL TRUE : Action starts FALSE : Action stops, outputs xDone , xBusy , xError are resetted LTrig Output xDone BOOL TRUE : Action successfully completed LTrig xBusy BOOL TRUE : Function block active LTrig xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error LTrig Input hPeer CAA.HANDLE Output eError ERROR xReady BOOL ipFrom IP_ADDR uiPortFrom UINT hBuffer CAA.HANDLE
UDP_Send (FB) ¶ FUNCTION_BLOCK UDP_Send EXTENDS CBM.ETrigTo This function block serves to sent data. The content of the memory area indicated by pointer pData contains the data to be written. szSize defines the number of bytes to be written. When xDone is set to TRUE the data was written successfully. The time out value has no effect at this function block. InOut: Scope Name Type Comment Inherited from Input xExecute BOOL Rising edge: Action starts Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values ( xDone , xError ) are present at the outputs for exactly one cycle. ETrigTo udiTimeOut UDINT Defines the time (µs) after which an FB (e.g. requiring an external acknowledgement) aborts operation due to a timeout with error message. ETrigTo Output xDone BOOL TRUE : Action successfully completed ETrigTo xBusy BOOL TRUE : Function block active ETrigTo xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error ETrigTo Input hPeer CAA.HANDLE ipAddr IP_ADDR uiPort UINT szSize CAA.SIZE pData CAA.PVOID Output eError ERROR
UDP_SendBuffer (FB) ¶ FUNCTION_BLOCK UDP_SendBuffer EXTENDS CBM.ETrigTo Like UDP_Send this function block serves to sent data. Instead of a pointer to the data, this function block expects a handle of the buffer containing the data to be written. The buffer is passed on and not copied like at UDP_Send . The time out value has no effect at this function block. InOut: Scope Name Type Comment Inherited from Input xExecute BOOL Rising edge: Action starts Falling edge: Resets outputs If a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values ( xDone , xError ) are present at the outputs for exactly one cycle. ETrigTo udiTimeOut UDINT Defines the time (µs) after which an FB (e.g. requiring an external acknowledgement) aborts operation due to a timeout with error message. ETrigTo Output xDone BOOL TRUE : Action successfully completed ETrigTo xBusy BOOL TRUE : Function block active ETrigTo xError BOOL TRUE : Error occurred, function block aborts action FALSE : No error ETrigTo Input hPeer CAA.HANDLE ipAddr IP_ADDR uiPort UINT hBuffer CAA.HANDLE Output eError ERROR
Functions ¶ Async DummyJob (Function) UDP IPSTRING_TO_UDINT (Function) IS_MULTICAST_GROUP (Function) UDINT_TO_IPSTRING (Function) UDP_GetDataSize (Function)
Async ¶ DummyJob (Function)
DummyJob (FUN) ¶ FUNCTION DummyJob : RTS_IEC_RESULT InOut: Scope Name Type Return DummyJob RTS_IEC_RESULT Input pParam __XWORD
UDP ¶ IPSTRING_TO_UDINT (Function) IS_MULTICAST_GROUP (Function) UDINT_TO_IPSTRING (Function) UDP_GetDataSize (Function)