FB_SendRecvMsg: Send and Receive Message Function Block

Overview

The following graphic shows the pin diagram of the function block FB_SendRecvMsg:

G-SE-0047230.1.gif-high.gif

 

 

The function block FB_SendRecvMsg sends and receives user-defined messages. It sends a message on a serial line and then waits for a response. It is also possible to either send without waiting for a response or to receive a message without sending one. This function should be used with an ASCII manager.

I/O Variables Description

The table describes the input variables of the function block in the TwidoEmulationSupport library:

Input

Data type

Description

i_xExecute

BOOL

The function is executed on the rising edge of this input.

NOTE: When i_xExecute is set to TRUE at the first task cycle in RUNNING after a cold or warm reset, the rising edge is not detected.

i_xAbort

BOOL

Stops the ongoing operation at the rising edge.

i_iLink

INT

Indicates the port used to communicate:

o1 = Serial port 1

o2 = Serial port 2

i_iTimeout

INT

Set the maximum time to wait to receive a response. Specified in ms. A value of 0 means no timeout is enforced.

i_iQuantityToSend

INT

Number of objects to send.

i_pbyBufferToSend

POINTER TO BYTE

Address of the buffer in which object values to send are stored. The first 2 words are control words.

i_iSizeRecvBuffer

INT

Number of objects to receive.

i_pbyBufferToRecv

POINTER TO BYTE

Address of the buffer in which received object values are stored.

The table describes the output variables of the function block in the TwidoEmulationSupport library:

Output

Data type

Description

q_xDone

BOOL

q_xDone is set to TRUE when the function is completed successfully.

q_xBusy

BOOL

q_xBusy is set to TRUE while the function is ongoing.

q_Aborted

BOOL

q_Aborted is set to TRUE when the function is stopped with the i_xAbort input.

q_xError

BOOL

q_xError is set to TRUE when the function stops because of a detected error.

q_etCommError

SEN.CommunicationErrorCodes

q_etCommError contains the value of communication error codes SEN.CommunicationErrorCodes.

q_etOperError

SEN.OperationErrorCodes

q_etOperError contains the value of operation error codes SEN.OperationErrorCodes.

q_iQuantiyRecv

INT

Number of received objects