Possible Communication Issues And Solutions
If the examples do not work as expected and slave and master boards are not able to communicate correctly, it is possible to find the reason for errors. The most important errors are described in master example output and formatted as below:
E (1692332) MB_CONTROLLER_MASTER: mbc_master_get_parameter(111): SERIAL master get parameter failure error=(0x107) (ESP_ERR_TIMEOUT).
Error |
Description |
Possible solution |
---|---|---|
0x106 |
|
Refer to slave register map. Check the master data dictionary for correctness. |
0x107 |
|
Measure and increase the maximum slave response timeout idf.py menuconfig, option |
0x108 |
|
Check the physical connection then refer to register map of your slave to configure the master data dictionary properly. |
0x103 |
|
Make sure your physical connection is working properly. Increase task stack size and check Modbus initialization sequence. |
Application Example
The examples below use the FreeModbus library port for serial TCP slave and master implementations accordingly. The selection of stack is performed through KConfig menu option “Enable Modbus stack support …” for appropriate communication mode and related configuration keys.
Please refer to the specific example README.md for details.
Protocol References
API Reference
Header File
Unions
-
union mb_communication_info_t
- #include <esp_modbus_common.h>
Device communication structure to setup Modbus controller.
Public Members
-
mb_mode_type_t mode
Modbus communication mode
-
uint8_t slave_addr
Modbus slave address field (dummy for master)
-
uart_port_t port
Modbus communication port (UART) number
-
uint32_t baudrate
Modbus baudrate
-
uart_parity_t parity
Modbus UART parity settings
-
uint16_t dummy_port
Dummy field, unused
-
struct mb_communication_info_t::[anonymous] [anonymous]
Modbus options version 1
-
mb_mode_type_t ip_mode
Modbus communication mode
-
uint8_t slave_uid
Modbus slave address field for UID
-
uint16_t ip_port
Modbus port
-
mb_tcp_addr_type_t ip_addr_type
Modbus address type
-
void *ip_addr
Modbus address table for connection
-
void *ip_netif_ptr
Modbus network interface
-
struct mb_communication_info_t::[anonymous] [anonymous]
Modbus options version 2
-
mb_mode_type_t mode
Macros
-
MB_RETURN_ON_FALSE(a, err_code, tag, format, ...)
-
MB_CONTROLLER_STACK_SIZE
-
MB_CONTROLLER_PRIORITY
-
MB_DEVICE_ADDRESS
-
MB_DEVICE_SPEED
-
MB_UART_PORT
-
MB_PAR_INFO_TOUT
-
MB_PARITY_NONE
-
_XFER_2_RD(dst, src)
-
_XFER_2_WR(dst, src)
Type Definitions
-
typedef esp_err_t (*iface_init)(void**)
common interface method types Interface method init
-
typedef esp_err_t (*iface_destroy)(void)
Interface method destroy
-
typedef esp_err_t (*iface_setup)(void*)
Interface method setup
-
typedef esp_err_t (*iface_start)(void)
Interface method start
Enumerations
-
enum mb_port_type_t
Types of actual Modbus implementation.
Values:
-
enumerator MB_PORT_SERIAL_MASTER
Modbus port type serial master.
-
enumerator MB_PORT_SERIAL_SLAVE
Modbus port type serial slave.
-
enumerator MB_PORT_TCP_MASTER
Modbus port type TCP master.
-
enumerator MB_PORT_TCP_SLAVE
Modbus port type TCP slave.
-
enumerator MB_PORT_COUNT
Modbus port count.
-
enumerator MB_PORT_INACTIVE
-
enumerator MB_PORT_SERIAL_MASTER
-
enum mb_event_group_t
Event group for parameters notification.
Values:
-
enumerator MB_EVENT_NO_EVENTS
-
enumerator MB_EVENT_HOLDING_REG_WR
Modbus Event Write Holding registers.
-
enumerator MB_EVENT_HOLDING_REG_RD
Modbus Event Read Holding registers.
-
enumerator MB_EVENT_INPUT_REG_RD
Modbus Event Read Input registers.
-
enumerator MB_EVENT_COILS_WR
Modbus Event Write Coils.
-
enumerator MB_EVENT_COILS_RD
Modbus Event Read Coils.
-
enumerator MB_EVENT_DISCRETE_RD
Modbus Event Read Discrete bits.
-
enumerator MB_EVENT_STACK_STARTED
Modbus Event Stack started
-
enumerator MB_EVENT_NO_EVENTS
-
enum mb_param_type_t
Type of Modbus parameter.
Values:
-
enumerator MB_PARAM_HOLDING
Modbus Holding register.
-
enumerator MB_PARAM_INPUT
Modbus Input register.
-
enumerator MB_PARAM_COIL
Modbus Coils.
-
enumerator MB_PARAM_DISCRETE
Modbus Discrete bits.
-
enumerator MB_PARAM_COUNT
-
enumerator MB_PARAM_UNKNOWN
-
enumerator MB_PARAM_HOLDING
Header File
Functions
-
esp_err_t mbc_master_init_tcp(void **handler)
Initialize Modbus controller and stack for TCP port.
- Parameters
handler – [out] handler(pointer) to master data structure
- Returns
ESP_OK Success
ESP_ERR_NO_MEM Parameter error
ESP_ERR_NOT_SUPPORTED Port type not supported
ESP_ERR_INVALID_STATE Initialization failure
-
esp_err_t mbc_master_init(mb_port_type_t port_type, void **handler)
Initialize Modbus Master controller and stack for Serial port.
- Parameters
handler – [out] handler(pointer) to master data structure
port_type – [in] type of stack
- Returns
ESP_OK Success
ESP_ERR_NO_MEM Parameter error
ESP_ERR_NOT_SUPPORTED Port type not supported
ESP_ERR_INVALID_STATE Initialization failure
-
void mbc_master_init_iface(void *handler)
Initialize Modbus Master controller interface handle.
- Parameters
handler – [in] - pointer to master data structure
-
esp_err_t mbc_master_destroy(void)
Destroy Modbus controller and stack.
- Returns
ESP_OK Success
ESP_ERR_INVALID_STATE Parameter error
-
esp_err_t mbc_master_start(void)
Start Modbus communication stack.
- Returns
ESP_OK Success
ESP_ERR_INVALID_ARG Modbus stack start error
-
esp_err_t mbc_master_setup(void *comm_info)
Set Modbus communication parameters for the controller.
- Parameters
comm_info – Communication parameters structure.
- Returns
ESP_OK Success
ESP_ERR_INVALID_ARG Incorrect parameter data
-
esp_err_t mbc_master_set_descriptor(const mb_parameter_descriptor_t *descriptor, const uint16_t num_elements)
Assign parameter description table for Modbus controller interface.
- Parameters
descriptor – [in] pointer to parameter description table
num_elements – number of elements in the table
- Returns
esp_err_t ESP_OK - set descriptor successfully
esp_err_t ESP_ERR_INVALID_ARG - invalid argument in function call
-
esp_err_t mbc_master_send_request(mb_param_request_t *request, void *data_ptr)
Send data request as defined in parameter request, waits response from slave and returns status of command execution. This function provides standard way for read/write access to Modbus devices in the network.
- Parameters
request – [in] pointer to request structure of type mb_param_request_t
data_ptr – [in] pointer to data buffer to send or received data (dependent of command field in request)
- Returns
esp_err_t ESP_OK - request was successful
esp_err_t ESP_ERR_INVALID_ARG - invalid argument of function
esp_err_t ESP_ERR_INVALID_RESPONSE - an invalid response from slave
esp_err_t ESP_ERR_TIMEOUT - operation timeout or no response from slave
esp_err_t ESP_ERR_NOT_SUPPORTED - the request command is not supported by slave
esp_err_t ESP_FAIL - slave returned an exception or other failure
-
esp_err_t mbc_master_get_cid_info(uint16_t cid, const mb_parameter_descriptor_t **param_info)
Get information about supported characteristic defined as cid. Uses parameter description table to get this information. The function will check if characteristic defined as a cid parameter is supported and returns its description in param_info. Returns ESP_ERR_NOT_FOUND if characteristic is not supported.
- Parameters
cid – [in] characteristic id
param_info – pointer to pointer of characteristic data.
- Returns
esp_err_t ESP_OK - request was successful and buffer contains the supported characteristic name
esp_err_t ESP_ERR_INVALID_ARG - invalid argument of function
esp_err_t ESP_ERR_NOT_FOUND - the characteristic (cid) not found
esp_err_t ESP_FAIL - unknown error during lookup table processing
-
esp_err_t mbc_master_get_parameter(uint16_t cid, char *name, uint8_t *value, uint8_t *type)
Read parameter from modbus slave device whose name is defined by name and has cid. The additional data for request is taken from parameter description (lookup) table.
- Parameters
cid – [in] id of the characteristic for parameter
name – [in] pointer into string name (key) of parameter (null terminated)
value – [out] pointer to data buffer of parameter
type – [out] parameter type associated with the name returned from parameter description table.
- Returns
esp_err_t ESP_OK - request was successful and value buffer contains representation of actual parameter data from slave
esp_err_t ESP_ERR_INVALID_ARG - invalid argument of function or parameter descriptor
esp_err_t ESP_ERR_INVALID_RESPONSE - an invalid response from slave
esp_err_t ESP_ERR_INVALID_STATE - invalid state during data processing or allocation failure
esp_err_t ESP_ERR_TIMEOUT - operation timed out and no response from slave
esp_err_t ESP_ERR_NOT_SUPPORTED - the request command is not supported by slave
esp_err_t ESP_ERR_NOT_FOUND - the parameter is not found in the parameter description table
esp_err_t ESP_FAIL - slave returned an exception or other failure
-
esp_err_t mbc_master_set_parameter(uint16_t cid, char *name, uint8_t *value, uint8_t *type)
Set characteristic’s value defined as a name and cid parameter. The additional data for cid parameter request is taken from master parameter lookup table.
- Parameters
cid – [in] id of the characteristic for parameter
name – [in] pointer into string name (key) of parameter (null terminated)
value – [out] pointer to data buffer of parameter (actual representation of json value field in binary form)
type – [out] pointer to parameter type associated with the name returned from parameter lookup table.
- Returns
esp_err_t ESP_OK - request was successful and value was saved in the slave device registers
esp_err_t ESP_ERR_INVALID_ARG - invalid argument of function or parameter descriptor
esp_err_t ESP_ERR_INVALID_RESPONSE - an invalid response from slave during processing of parameter
esp_err_t ESP_ERR_INVALID_STATE - invalid state during data processing or allocation failure
esp_err_t ESP_ERR_TIMEOUT - operation timed out and no response from slave
esp_err_t ESP_ERR_NOT_SUPPORTED - the request command is not supported by slave
esp_err_t ESP_FAIL - slave returned an exception or other failure
-
esp_err_t mbc_master_set_param_data(void *dest, void *src, mb_descr_type_t param_type, size_t param_size)
The helper function to set data of parameters according to its type.
- Parameters
dest – [in] the destination address of the parameter
src – [in] the source address of the parameter
param_type – [out] type of parameter from data dictionary
param_size – [out] the storage size of the characteristic (in bytes). Describes the size of data to keep into data instance during mapping.
- Returns
esp_err_t ESP_OK - request was successful and value was saved in the slave device registers
esp_err_t ESP_ERR_INVALID_ARG - invalid argument of function or parameter descriptor
esp_err_t ESP_ERR_NOT_SUPPORTED - the request command is not supported by slave
-
esp_err_t mbc_master_get_transaction_info(mb_trans_info_t *ptinfo)
The helper function to expose transaction info from modbus layer.
- Parameters
ptinfo – [in] the pointer to transaction info structure
- Returns
esp_err_t ESP_OK - the transaction info is saved in the appropriate parameter structure
esp_err_t ESP_ERR_INVALID_ARG - invalid argument of function or parameter descriptor
esp_err_t ESP_ERR_INVALID_STATE - invalid state during data processing or allocation failure
Unions
-
union mb_parameter_opt_t
- #include <esp_modbus_master.h>
Modbus parameter options for description table.
Public Members
-
int opt1
Parameter option1
-
int opt2
Parameter option2
-
int opt3
Parameter option3
-
struct mb_parameter_opt_t::[anonymous] [anonymous]
Parameter options version 1
-
int min
Parameter minimum value
-
int max
Parameter maximum value
-
int step
Step of parameter change tracking
-
struct mb_parameter_opt_t::[anonymous] [anonymous]
Parameter options version 2
-
int opt1
Structures
-
struct mb_parameter_descriptor_t
Characteristics descriptor type is used to describe characteristic and link it with Modbus parameters that reflect its data.
Public Members
-
uint16_t cid
Characteristic cid
-
const char *param_key
The key (name) of the parameter
-
const char *param_units
The physical units of the parameter
-
uint8_t mb_slave_addr
Slave address of device in the Modbus segment
-
mb_param_type_t mb_param_type
Type of modbus parameter
-
uint16_t mb_reg_start
This is the Modbus register address. This is the 0 based value.
-
uint16_t mb_size
Size of mb parameter in registers
-
uint16_t param_offset
Parameter name (OFFSET in the parameter structure)
-
mb_descr_type_t param_type
Float, U8, U16, U32, ASCII, etc.
-
mb_descr_size_t param_size
Number of bytes in the parameter.
-
mb_parameter_opt_t param_opts
Parameter options used to check limits and etc.
-
mb_param_perms_t access
Access permissions based on mode
-
uint16_t cid
-
struct mb_param_request_t
Modbus register request type structure.
-
struct mb_trans_info_t
Modbus transacion info structure.
Public Members
-
uint64_t trans_id
Modbus unique transaction identificator
-
uint16_t err_type
Modbus last transaction error type
-
uint8_t dest_addr
Modbus destination short address (or UID)
-
uint8_t func_code
Modbus last transaction function code
-
uint8_t exception
Modbus last transaction exception code returned by slave
-
uint64_t trans_id
Macros
-
MB_MASTER_CHECK(a, err_code, format, ...)
-
MB_MASTER_ASSERT(con)
-
MB_EACH_ELEM(psrc, pdest, arr_size, elem_size)
The macro to access arrays of elements for type conversion.
Enumerations
-
enum mb_descr_type_t
Modbus descriptor table parameter type defines.
Values:
-
enumerator PARAM_TYPE_U8
Unsigned 8
-
enumerator PARAM_TYPE_U16
Unsigned 16
-
enumerator PARAM_TYPE_U32
Unsigned 32
-
enumerator PARAM_TYPE_FLOAT
Float type
-
enumerator PARAM_TYPE_ASCII
ASCII type
-
enumerator PARAM_TYPE_BIN
BIN type
-
enumerator PARAM_TYPE_I8_A
I8 signed integer in high byte of register
-
enumerator PARAM_TYPE_I8_B
I8 signed integer in low byte of register
-
enumerator PARAM_TYPE_U8_A
U8 unsigned integer written to hi byte of register
-
enumerator PARAM_TYPE_U8_B
U8 unsigned integer written to low byte of register
-
enumerator PARAM_TYPE_I16_AB
I16 signed integer, big endian
-
enumerator PARAM_TYPE_I16_BA
I16 signed integer, little endian
-
enumerator PARAM_TYPE_U16_AB
U16 unsigned integer, big endian
-
enumerator PARAM_TYPE_U16_BA
U16 unsigned integer, little endian
-
enumerator PARAM_TYPE_I32_ABCD
I32 ABCD signed integer, big endian
-
enumerator PARAM_TYPE_I32_CDAB
I32 CDAB signed integer, big endian, reversed register order
-
enumerator PARAM_TYPE_I32_BADC
I32 BADC signed integer, little endian, reversed register order
-
enumerator PARAM_TYPE_I32_DCBA
I32 DCBA signed integer, little endian
-
enumerator PARAM_TYPE_U32_ABCD
U32 ABCD unsigned integer, big endian
-
enumerator PARAM_TYPE_U32_CDAB
U32 CDAB unsigned integer, big endian, reversed register order
-
enumerator PARAM_TYPE_U32_BADC
U32 BADC unsigned integer, little endian, reversed register order
-
enumerator PARAM_TYPE_U32_DCBA
U32 DCBA unsigned integer, little endian
-
enumerator PARAM_TYPE_FLOAT_ABCD
Float ABCD floating point, big endian
-
enumerator PARAM_TYPE_FLOAT_CDAB
Float CDAB floating point big endian, reversed register order
-
enumerator PARAM_TYPE_FLOAT_BADC
Float BADC floating point, little endian, reversed register order
-
enumerator PARAM_TYPE_FLOAT_DCBA
Float DCBA floating point, little endian
-
enumerator PARAM_TYPE_I64_ABCDEFGH
I64, ABCDEFGH signed integer, big endian
-
enumerator PARAM_TYPE_I64_HGFEDCBA
I64, HGFEDCBA signed integer, little endian
-
enumerator PARAM_TYPE_I64_GHEFCDAB
I64, GHEFCDAB signed integer, big endian, reversed register order
-
enumerator PARAM_TYPE_I64_BADCFEHG
I64, BADCFEHG signed integer, little endian, reversed register order
-
enumerator PARAM_TYPE_U64_ABCDEFGH
U64, ABCDEFGH unsigned integer, big endian
-
enumerator PARAM_TYPE_U64_HGFEDCBA
U64, HGFEDCBA unsigned integer, little endian
-
enumerator PARAM_TYPE_U64_GHEFCDAB
U64, GHEFCDAB unsigned integer, big endian, reversed register order
-
enumerator PARAM_TYPE_U64_BADCFEHG
U64, BADCFEHG unsigned integer, little endian, reversed register order
-
enumerator PARAM_TYPE_DOUBLE_ABCDEFGH
Double ABCDEFGH floating point, big endian
-
enumerator PARAM_TYPE_DOUBLE_HGFEDCBA
Double HGFEDCBA floating point, little endian
-
enumerator PARAM_TYPE_DOUBLE_GHEFCDAB
Double GHEFCDAB floating point, big endian, reversed register order
-
enumerator PARAM_TYPE_DOUBLE_BADCFEHG
Double BADCFEHG floating point, little endian, reversed register order
-
enumerator PARAM_TYPE_U8
-
enum mb_descr_size_t
Modbus descriptor table parameter size in bytes.
Values:
-
enumerator PARAM_SIZE_U8
Unsigned 8
-
enumerator PARAM_SIZE_U8_REG
Unsigned 8, register value
-
enumerator PARAM_SIZE_I8_REG
Signed 8, register value
-
enumerator PARAM_SIZE_I16
Unsigned 16
-
enumerator PARAM_SIZE_U16
Unsigned 16
-
enumerator PARAM_SIZE_I32
Signed 32
-
enumerator PARAM_SIZE_U32
Unsigned 32
-
enumerator PARAM_SIZE_FLOAT
Float 32 size
-
enumerator PARAM_SIZE_ASCII
ASCII size default
-
enumerator PARAM_SIZE_ASCII24
ASCII24 size
-
enumerator PARAM_SIZE_I64
Signed integer 64 size
-
enumerator PARAM_SIZE_U64
Unsigned integer 64 size
-
enumerator PARAM_SIZE_DOUBLE
Double 64 size
-
enumerator PARAM_MAX_SIZE
-
enumerator PARAM_SIZE_U8
-
enum mb_param_perms_t
Permissions for the characteristics.
Values:
-
enumerator PAR_PERMS_READ
the characteristic of the device are readable
-
enumerator PAR_PERMS_WRITE
the characteristic of the device are writable
-
enumerator PAR_PERMS_TRIGGER
the characteristic of the device are triggerable
-
enumerator PAR_PERMS_READ_WRITE
the characteristic of the device are readable & writable
-
enumerator PAR_PERMS_READ_TRIGGER
the characteristic of the device are readable & triggerable
-
enumerator PAR_PERMS_WRITE_TRIGGER
the characteristic of the device are writable & triggerable
-
enumerator PAR_PERMS_READ_WRITE_TRIGGER
the characteristic of the device are readable & writable & triggerable
-
enumerator PAR_PERMS_READ
Header File
Functions
-
esp_err_t mbc_slave_init_tcp(void **handler)
Initialize Modbus Slave controller and stack for TCP port.
- Parameters
handler – [out] handler(pointer) to master data structure
- Returns
ESP_OK Success
ESP_ERR_NO_MEM Parameter error
ESP_ERR_NOT_SUPPORTED Port type not supported
ESP_ERR_INVALID_STATE Initialization failure
-
esp_err_t mbc_slave_init(mb_port_type_t port_type, void **handler)
Initialize Modbus Slave controller and stack for Serial port.
- Parameters
handler – [out] handler(pointer) to master data structure
port_type – [in] the type of port
- Returns
ESP_OK Success
ESP_ERR_NO_MEM Parameter error
ESP_ERR_NOT_SUPPORTED Port type not supported
ESP_ERR_INVALID_STATE Initialization failure
-
void mbc_slave_init_iface(void *handler)
Initialize Modbus Slave controller interface handle.
- Parameters
handler – [in] - pointer to slave interface data structure
-
esp_err_t mbc_slave_destroy(void)
Destroy Modbus controller and stack.
- Returns
ESP_OK Success
ESP_ERR_INVALID_STATE Parameter error
-
esp_err_t mbc_slave_start(void)
Start Modbus communication stack.
- Returns
ESP_OK Success
ESP_ERR_INVALID_ARG Modbus stack start error
-
esp_err_t mbc_slave_setup(void *comm_info)
Set Modbus communication parameters for the controller.
- Parameters
comm_info – Communication parameters structure.
- Returns
ESP_OK Success
ESP_ERR_INVALID_ARG Incorrect parameter data
-
mb_event_group_t mbc_slave_check_event(mb_event_group_t group)
Wait for specific event on parameter change.
- Parameters
group – Group event bit mask to wait for change
- Returns
mb_event_group_t event bits triggered
-
esp_err_t mbc_slave_get_param_info(mb_param_info_t *reg_info, uint32_t timeout)
Get parameter information.
- Parameters
reg_info – [out] parameter info structure
timeout – Timeout in milliseconds to read information from parameter queue
- Returns
ESP_OK Success
ESP_ERR_TIMEOUT Can not get data from parameter queue or queue overflow
-
esp_err_t mbc_slave_set_descriptor(mb_register_area_descriptor_t descr_data)
Set Modbus area descriptor.
- Parameters
descr_data – Modbus registers area descriptor structure
- Returns
ESP_OK: The appropriate descriptor is set
ESP_ERR_INVALID_ARG: The argument is incorrect
Structures
-
struct mb_param_info_t
Parameter access event information type.
-
struct mb_register_area_descriptor_t
Parameter storage area descriptor.
Public Members
-
uint16_t start_offset
Modbus start address for area descriptor
-
mb_param_type_t type
Type of storage area descriptor
-
void *address
Instance address for storage area descriptor
-
size_t size
Instance size for area descriptor (bytes)
-
uint16_t start_offset
Macros
-
MB_SLAVE_CHECK(a, err_code, format, ...)
-
MB_SLAVE_ASSERT(con)
Modbus Endianness Conversion API Reference
Header File
Functions
-
int8_t mb_get_int8_a(val_16_arr *pi16)
Get int8_t (low byte) value represenatation from register.
- Returns
int8_t value of converted from register value
-
uint16_t mb_set_int8_a(val_16_arr *pi16, int8_t i8)
Set i8 value to the register value pointed by pi16.
- Returns
uint16_t value which represents the actual hex value of the register
-
int8_t mb_get_int8_b(val_16_arr *pi16)
Get int8_t (high byte) value from the register value pointed by pi16.
- Returns
uint16_t value which represents the actual hex value of the register
-
uint16_t mb_set_int8_b(val_16_arr *pi16, int8_t i8)
Set i8 (high byte) value from the register value pointed by pi16.
- Returns
uint16_t value which represents the actual hex value of the register
-
uint8_t mb_get_uint8_a(val_16_arr *pu16)
Get uint8_t (low byte) value represenatation from register poined by pu16.
- Returns
uint8_t the value of converted from register value
-
uint16_t mb_set_uint8_a(val_16_arr *pu16, uint8_t u8)
Set u8 (low byte) value into the register value pointed by pu16.
- Returns
uint16_t the value which represents the actual hex value of the register
-
uint8_t mb_get_uint8_b(val_16_arr *pu16)
Get uint8_t (high byte) value from the register value pointed by pu16.
- Returns
uint16_t the value which represents the actual hex value of the register
-
uint16_t mb_set_uint8_b(val_16_arr *pu16, uint8_t u8)
Set u8 (high byte) value into the register value pointed by pu16.
- Returns
uint16_t the value which represents the actual hex value of the register
-
int16_t mb_get_int16_ab(val_16_arr *pi16)
Get int16_t value from the register value pointed by pu16 with ab endianness.
- Returns
int16_t the value which represents the converted value from register
-
uint16_t mb_set_int16_ab(val_16_arr *pi16, int16_t i16)
Set i16 value to the register pointed by pi16 with ab endianness.
- Returns
int16_t the value which represents the converted value from register
-
uint16_t mb_get_uint16_ab(val_16_arr *pu16)
Get uint16_t value from the register value pointed by pu16 with ab endianness.
- Returns
uint16_t value which represents the converted register value
-
uint16_t mb_set_uint16_ab(val_16_arr *pu16, uint16_t u16)
Set u16 value to the register pointed by pu16 with ab endianness.
- Returns
uint16_t value which represents the converted value from register
-
int16_t mb_get_int16_ba(val_16_arr *pi16)
Get int16_t value from the register value pointed by pu16 with ba endianness.
- Returns
int16_t value which represents the converted register value
-
uint16_t mb_set_int16_ba(val_16_arr *pi16, int16_t i16)
Set i16 value to the register pointed by pi16 with ba endianness.
- Returns
uint16_t value which represents the converted value from register
-
uint16_t mb_get_uint16_ba(val_16_arr *pu16)
Get uint16_t value from the register value pointed by pu16 with ba endianness.
- Returns
uint16_t value which represents the converted register value
-
uint16_t mb_set_uint16_ba(val_16_arr *pu16, uint16_t u16)
Set u16 value to the register pointed by pu16 with ba endianness.
- Returns
uint16_t value which represents the converted value from register
-
int32_t mb_get_int32_abcd(val_32_arr *pi32)
Get int32_t value from the register value pointed by pi32 with abcd endianness.
- Returns
int32_t value which represents the converted register value
-
uint32_t mb_set_int32_abcd(val_32_arr *pi32, int32_t i32)
Set i32 value to the register pointed by pi32 with abcd endianness.
- Returns
uint32_t value which represents the converted value from register
-
uint32_t mb_get_uint32_abcd(val_32_arr *pu32)
Get uint32_t value from the register value pointed by pu32 with abcd endianness.
- Returns
uint32_t value which represents the converted register value
-
uint32_t mb_set_uint32_abcd(val_32_arr *pu32, uint32_t u32)
Set u32 value to the register pointed by pu32 with abcd endianness.
- Returns
uint32_t value which represents the converted value from register
-
int32_t mb_get_int32_badc(val_32_arr *pi32)
Get int32_t value from the register value pointed by pi32 with badc endianness.
- Returns
int32_t value which represents the converted register value
-
uint32_t mb_set_int32_badc(val_32_arr *pi32, int32_t i32)
Set i32 value to the register pointed by pi32 with badc endianness.
- Returns
uint32_t value which represents the converted value from register
-
uint32_t mb_get_uint32_badc(val_32_arr *pu32)
Get uint32_t value from the register value pointed by pu32 with badc endianness.
- Returns
unt32_t value which represents the converted register value
-
uint32_t mb_set_uint32_badc(val_32_arr *pu32, uint32_t u32)
Set u32 value to the register pointed by pu32 with badc endianness.
- Returns
uint32_t value which represents the converted value from register
-
int32_t mb_get_int32_cdab(val_32_arr *pi32)
Get int32_t value from the register value pointed by pi32 with cdab endianness.
- Returns
int32_t value which represents the converted register value
-
uint32_t mb_set_int32_cdab(val_32_arr *pi32, int32_t i32)
Set i32 value to the register pointed by pi32 with cdab endianness.
- Returns
uint32_t value which represents the converted value from register
-
uint32_t mb_get_uint32_cdab(val_32_arr *pu32)
Get uint32_t value from the register value pointed by pu32 with cdab endianness.
- Returns
int32_t value which represents the converted register value
-
uint32_t mb_set_uint32_cdab(val_32_arr *pu32, uint32_t u32)
Set u32 value to the register pointed by pu32 with cdab endianness.
- Returns
uint32_t value which represents the converted value from register
-
int32_t mb_get_int32_dcba(val_32_arr *pi32)
Get int32_t value from the register value pointed by pi32 with dcba endianness.
- Returns
int32_t value which represents the converted register value
-
uint32_t mb_set_int32_dcba(val_32_arr *pi32, int32_t i32)
Set i32 value to the register pointed by pi32 with dcba endianness.
- Returns
uint32_t value which represents the converted value from register
-
uint32_t mb_get_uint32_dcba(val_32_arr *pu32)
Get uint32_t value from the register value pointed by pu32 with dcba endianness.
- Returns
uint32_t value which represents the converted register value
-
uint32_t mb_set_uint32_dcba(val_32_arr *pu32, uint32_t u32)
Set u32 value to the register pointed by pu32 with dcba endianness.
- Returns
uint32_t value which represents the converted value from register
-
float mb_get_float_abcd(val_32_arr *pf)
Get float value from the register pointed by pf with abcd endianness.
- Returns
float value which represents the converted register value
-
uint32_t mb_set_float_abcd(val_32_arr *pf, float f)
Set f value to the register pointed by pf with abcd endianness.
- Returns
uint32_t value which represents the converted value from register
-
float mb_get_float_badc(val_32_arr *pf)
Get float value from the register pointed by pf with badc endianness.
- Returns
float value which represents the converted register value
-
uint32_t mb_set_float_badc(val_32_arr *pf, float f)
Set f value to the register pointed by pf with badc endianness.
- Returns
uint32_t value which represents the converted value from register
-
float mb_get_float_cdab(val_32_arr *pf)
Get float value from the register pointed by pf with cdab endianness.
- Returns
float value which represents the converted register value
-
uint32_t mb_set_float_cdab(val_32_arr *pf, float f)
Set f value to the register pointed by pf with cdab endianness.
- Returns
uint32_t value which represents the converted value from register
-
float mb_get_float_dcba(val_32_arr *pf)
Get float value from the register pointed by pf with dcba endianness.
- Returns
float value which represents the converted register value
-
uint32_t mb_set_float_dcba(val_32_arr *pf, float f)
Set f value to the register pointed by pf with dcba endianness.
- Returns
uint32_t value which represents the converted value from register
-
double mb_get_double_abcdefgh(val_64_arr *pd)
Get double value from the register pointed by pd with abcdefgh endianness.
- Returns
double value which represents the converted register value
-
uint64_t mb_set_double_abcdefgh(val_64_arr *pd, double d)
Set d value to the register pointed by pd with abcdefgh endianness.
- Returns
uint64_t value which represents the converted value from register
-
double mb_get_double_hgfedcba(val_64_arr *pd)
Get double value from the register pointed by pd with hgfedcba endianness.
- Returns
double value which represents the converted register value
-
uint64_t mb_set_double_hgfedcba(val_64_arr *pd, double d)
Set d value to the register pointed by pd with hgfedcba endianness.
- Returns
uint64_t value which represents the converted value from register
-
double mb_get_double_ghefcdab(val_64_arr *pd)
Get double value from the register pointed by pd with ghefcdab endianness.
- Returns
double value which represents the converted register value
-
uint64_t mb_set_double_ghefcdab(val_64_arr *pd, double d)
Set d value to the register pointed by pd with ghefcdab endianness.
- Returns
uint64_t value which represents the converted value from register
-
double mb_get_double_badcfehg(val_64_arr *pd)
Get double value from the register pointed by pd with badcfehg endianness.
- Returns
double value which represents the converted register value
-
uint64_t mb_set_double_badcfehg(val_64_arr *pd, double d)
Set d value to the register pointed by pd with badcfehg endianness.
- Returns
uint64_t value which represents the converted value from register
-
int64_t mb_get_int64_abcdefgh(val_64_arr *pi64)
Get int64_t value from the register pointed by pi64 with abcdefgh endianness.
- Returns
int64_t value which represents the converted register value
-
uint64_t mb_set_int64_abcdefgh(val_64_arr *pi, int64_t i)
Set i value to the register pointed by pi with abcdefgh endianness.
- Returns
uint64_t value which represents the converted value from register
-
int64_t mb_get_int64_ghefcdab(val_64_arr *pi64)
Get int64_t value from the register pointed by pi64 with ghefcdab endianness.
- Returns
int64_t value which represents the converted register value
-
uint64_t mb_set_int64_ghefcdab(val_64_arr *pi, int64_t i)
Set i value to the register pointed by pi with ghefcdab endianness.
- Returns
uint64_t value which represents the converted value from register
-
int64_t mb_get_int64_hgfedcba(val_64_arr *pi64)
Get int64_t value from the register pointed by pi64 with hgfedcba endianness.
- Returns
int64_t value which represents the converted register value
-
uint64_t mb_set_int64_hgfedcba(val_64_arr *pi, int64_t i)
Set i value to the register pointed by pi with hgfedcba endianness.
- Returns
uint64_t value which represents the converted value from register
-
int64_t mb_get_int64_badcfehg(val_64_arr *pi64)
Get int64_t value from the register pointed by pi64 with badcfehg endianness.
- Returns
int64_t value which represents the converted register value
-
uint64_t mb_set_int64_badcfehg(val_64_arr *pi, int64_t i)
Set i value to the register pointed by pi with badcfehg endianness.
- Returns
uint64_t value which represents the converted value from register
-
uint64_t mb_get_uint64_abcdefgh(val_64_arr *pui)
Get uint64_t value from the register pointed by pui with abcdefgh endianness.
- Returns
uint64_t value which represents the converted register value
-
uint64_t mb_set_uint64_abcdefgh(val_64_arr *pui, uint64_t ui)
Set ui value to the register pointed by pi with abcdefgh endianness.
- Returns
uint64_t value which represents the converted value from register
-
uint64_t mb_get_uint64_hgfedcba(val_64_arr *pui)
Get uint64_t value from the register pointed by pui with hgfedcba endianness.
- Returns
uint64_t value which represents the converted register value
-
uint64_t mb_set_uint64_hgfedcba(val_64_arr *pui, uint64_t ui)
Set ui value to the register pointed by pui with hgfedcba endianness.
- Returns
uint64_t value which represents the converted value from register
-
uint64_t mb_get_uint64_ghefcdab(val_64_arr *pui)
Get uint64_t value from the register pointed by pui with ghefcdab endianness.
- Returns
uint64_t value which represents the converted register value
-
uint64_t mb_set_uint64_ghefcdab(val_64_arr *pui, uint64_t ui)
Set ui value to the register pointed by pui with ghefcdab endianness.
- Returns
uint64_t value which represents the converted value from register
-
uint64_t mb_get_uint64_badcfehg(val_64_arr *pui)
Get uint64_t value from the register pointed by pui with badcfehg endianness.
- Returns
uint64_t value which represents the converted register value
-
uint64_t mb_set_uint64_badcfehg(val_64_arr *pui, uint64_t ui)
Set ui value to the register pointed by pui with badcfehg endianness.
- Returns
uint64_t value which represents the converted value from register
Macros
-
MB_BO16_0
Defines the constant values based on native compiler byte ordering.
-
MB_BO16_1
-
MB_BO32_0
-
MB_BO32_1
-
MB_BO32_2
-
MB_BO32_3
-
MB_BO64_0
-
MB_BO64_1
-
MB_BO64_2
-
MB_BO64_3
-
MB_BO64_4
-
MB_BO64_5
-
MB_BO64_6
-
MB_BO64_7
Type Definitions
-
typedef uint8_t val_16_arr[2]
The sized array types used for mapping of extended values.
-
typedef uint8_t val_32_arr[4]
-
typedef uint8_t val_64_arr[8]