Skip to main content
Skip table of contents

AddressesToMBFB [LJM User's Guide]

Creates a Modbus Feedback (MBFB) packet. This packet can be sent to the device using LJM_MBFBComm.


int MaxBytesPerMBFB,
int * aAddresses,
int * aTypes,
int * aWrites,
int * aNumValues,
double * aValues,
int * NumFrames,
unsigned char * aMBFBCommand)


MaxBytesPerMBFB [in]

The maximum number of bytes that the Feedback command is allowed to consist of. It is highly recommended to pass the size of the aMBFBCommand buffer as MaxBytesPerMBFB to prevent buffer overflow. See LJM_DEFAULT_FEEDBACK_ALLOCATION_SIZE.

aAddresses [in]

An array of size NumFrames representing the register addresses to read from or write to for each frame.

aTypes [in]

An array of size NumFrames containing the data type of each value sent/received for each frame.

Types - UINT16 (0), UINT32 (1), INT32 (2), FLOAT32 (3)

aWrites [in]

An array of size NumFrames containing the desired type of access for each frame, which is either read (0) or write (1).

aNumValues [in]

An array of size NumFrames that contains the number of consecutive values for each frame.  Use 1 for a single (non-consecutive) value.

aValues [in]

An array of values to be transferred to/from the device. This array contains all the values for all the frames, so its size should be the sum of all elements in the aNumValues array. Each write value will be converted to its corresponding frame type defined in aTypes. LJM_UpdateValues can be used later to update this array with read values.

NumFrames [in/out]

Input as the number of frames being created. Output as the number of frames that were successfully put into the aMBFBCommand buffer, which may be less or equal to the input number. If NumFrames is altered by this function, LJM_AddressesToMBFB will return the warning code LJME_FRAMES_OMITTED_DUE_TO_PACKET_SIZE.

aMBFBCommand [out]

The resultant Modbus Feedback command. Transaction ID and Unit ID will be blanks that LJM_MBFBComm will fill in.


LJM errorcodes or 0 for no error.


The LJM_NamesToAddresses and LJM_NameToAddress functions may be used to initialize the aAddresses and aTypes parameters from register names.


Please see the Low-level Feedback Functions overview page for an example.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.