RMPSendMessage (FB)ΒΆ
FUNCTION_BLOCK FINAL RMPSendMessage EXTENDS CBM.ETRIG
Function block that can be used to send a message from a module to another module. Use this function block for sending messages. If sending succeded xDone gets TRUE. If an error occurs during sending (i.e. receiving could not be assured) xError gets TRUE. Reset xExecute to FALSE before reusage of the function block by setting xExecute to TRUE.
A possible call semantic could be:
- RMPSendMessage(xExecute := TRUE, itfRmp := pEnv^.rmps,
udiReceiverID := udiProxyCom, uiSenderModuleID:= UDINT_TO_UINT(ComAddress AND 16#FFFF), tValidity:=T#1S, mdData := mdData );
This function block needs to be called until xDone is TRUE. If so, sending was successfull.
- InOut:
Scope
Name
Type
Initial
Comment
Inherited from
Input
xExecute
BOOL
Rising edge: Action startsFalling edge: Resets outputsIf 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.ETrig
Output
xDone
BOOL
TRUE
: Action successfully completedETrig
xBusy
BOOL
TRUE
: Function block activeETrig
xError
BOOL
TRUE
: Error occurred, function block aborts actionFALSE
: No errorETrig
Inout
mdData
ARRAY [0..63] OF BYTE
The data to send
Input
itfRmp
The RMP (Reliable Message Protocoll) sevrice to use for sending. This service can be aquired via the environment available in any module via IModule (see example of the function block description).
udiReceiverID
UDINT
32-Bit-ID of receiver. This ID normaly is received, when receiving a message from a proxy (via Receive of IRMPService in an RMP (Reliable Message Protocoll) service
uiSenderModuleID
UINT
The (local) 16 bit address of the receiver, which equals the first 16bit of the ComAddress (see AND 16#FFFF)
tValidity
TIME
TIME#1s0ms
The time this message is valid when sending it
Output
uiError
UINT
If an error occured, the number accounts for one of the following errors: 1: send buffer full; 2: message cannot be transmitted before tValidity (connection broken or remote receive buffer full) 3: receiver application not connected to this app