Symbols
loading...
Files
loading...

mb_tcp_slave sample sample

mb_tcp_slave sample is a sample project defining the following symbols:

Most used functions

Name
Location
Summary
Free allocated memory.
Gets the actual esp_netif pointer from the internal network interface list The supplied ordinal number could - point to a predef netif -> "STA", "AP", "ETH" - if no entry in the list (NULL) -> check if the system added this netif - point to a custom netif -> just return the entry in the list - users is responsible for the lifetime of this netif (to be valid between mdns-init -> deinit)
Duplicate a string with length limit.
Query mDNS for host or service Note that querying PTR types sends Multicast query, all other types send Unicast queries
This function is wait for modbus master request finish and return result. Waiting result include request process success, request respond timeout, receive data error and execute function error.You can use the above callback function.
This function is take Mobus Master running resource. Note:The resource is define by Operating System.
Function to set bits in a byte buffer. This function allows the efficient use of an array to implement bitfields. The array used for storing the bits must always be a multiple of two bytes. Up to eight bits can be set or cleared in one operation.
ucBits[2] = {0, 0}; // Set bit 4 to 1 (read: set 1 bit starting at bit offset 4 to value 1) xMBUtilSetBits( ucBits, 4, 1, 1 ); // Set bit 7 to 1 and bit 8 to 0. xMBUtilSetBits( ucBits, 7, 2, 0x01 ); // Set bits 8 - 11 to 0x05 and bits 12 - 15 to 0x0A; xMBUtilSetBits( ucBits, 8, 8, 0x5A);
Allocate and zero memory.
This is modbus master user error handling funcion. If it is defined in the user application, then helps to handle the errors and received/sent buffers to transfer as well as handle the slave exception codes.
Function to read bits in a byte buffer. This function is used to extract up bit values from an array. Up to eight bit values can be extracted in one step.
UCHAR ucBits[2] = {0, 0}; UCHAR ucResult; // Extract the bits 3 - 10. ucResult = xMBUtilGetBits( ucBits, 3, 8 );
Enable mDNS interface
Allocate new answer and add it to answer list (destination)
Set/Add TXT item for service TXT record with hostname and txt value length
Disable mDNS interface
Callback function used if a Holding Register value is read or written by the protocol stack. The starting register address is given by \c usAddress and the last register is given by usAddress + usNRegs - 1.
Callback function used if a Holding Register value is read or written by the protocol stack. The starting register address is given by \c usAddress and the last register is given by usAddress + usNRegs - 1.
Set the hostname for mDNS server required if you want to advertise services
Set the default instance name for mDNS server
appends uint16_t in a packet, incrementing the index
The helper function to set data of parameters according to its type
Remove service from mDNS server with hostname
Set instance name for service with hostname
Set service port with hostname
Remove and free all services from mDNS server
Add service to mDNS server with a delegated hostname
Replace all TXT items for service with hostname
Remove TXT item for service TXT record with hostname
Free allocated memory for mDNS task.
Initialize mDNS on given interface
Callback function used if a Coil Register value is read or written by the protocol stack. If you are going to use this function you might use the functions xMBUtilSetBits( ) and xMBUtilGetBits( ) for working with bitfields.
Callback function used if a Coil Register value is read or written by the protocol stack. If you are going to use this function you might use the functions xMBUtilSetBits( ) and xMBUtilGetBits( ) for working with bitfields.
Browse mDNS for a service `_service._proto`.
Stop the `_service._proto` browse.
Add multiple subtypes for service at once.
Generic mDNS query All following query methods are derived from this one
Query mDNS for service
Query mDNS for SRV record
Query mDNS for TXT record
Look up delegated services.
Look up self hosted services.
Stop and free mDNS server
Adds a hostname and address to be delegated A/AAAA queries will be replied for the hostname and services can be added to this host.
Remove a delegated hostname All the services added to this host will also be removed.
Set/Add TXT item for service TXT record with hostname
Query mDNS for A record
Query mDNS for A record Please note that hostname must not contain domain name, as mDNS uses '.local' domain.
Queue RX packet action
Allocate memory for mDNS task.
Gets data pointer to the mDNS packet
sets uint16_t value in a packet
Initialize Modbus Master controller interface handle
This function will request read discrete inputs.
This function is release Modbus Master running resource. Note:The resource is define by Operating System. If you not use OS this function can be empty.
Release resources used by the protocol stack. This function disables the Modbus Master protocol stack and release all hardware resources. It must only be called when the protocol stack is disabled.
Enable the Modbus Master protocol stack. This function enables processing of Modbus Master frames. Enabling the protocol stack is only possible if it is in the disabled state.
Disable the Modbus Master protocol stack. This function disables processing of Modbus frames.
The main pooling loop of the Modbus Master protocol stack. This function must be called periodically. The timer interval required is given by the application dependent Modbus slave timeout. Internally the function calls xMBMasterPortEventGet() and waits for an event from the receiver or transmitter state machines.
This function will request read input register.
This function will request write holding register.
This function will request write multiple holding register.
This function will request read holding register.
This function will request read and write holding register.
This function will request read coil.
This function will request write one coil. @see eMBMasterReqWriteMultipleCoils
This function will request write multiple coils. @see eMBMasterReqWriteCoil
Enable the Modbus protocol stack. This function enables processing of Modbus frames. Enabling the protocol stack is only possible if it is in the disabled state.
Disable the Modbus protocol stack. This function disables processing of Modbus frames.
The main pooling loop of the Modbus protocol stack. This function must be called periodically. The timer interval required is given by the application dependent Modbus slave timeout. Internally the function calls xMBPortEventGet() and waits for an event from the receiver or transmitter state machines.
Initialize Modbus Slave controller interface handle
Initialize Modbus controller and stack
Initialize Modbus controller and stack for TCP slave
Create Modbus Master controller and stack for TCP port
Remove service from mDNS server
appends byte in a packet, incrementing the index
read uint16_t from a packet
Add service to mDNS server
Set/Add TXT item for service TXT record
appends FQDN to a packet, incrementing the index and compressing the output if previous occurrence of the string (or part of it) has been found
Callback function used if a Input Discrete Register value is read by the protocol stack. If you are going to use his function you might use the functions xMBUtilSetBits( ) and xMBUtilGetBits( ) for working with bitfields.
#include "mb_m.h"
The protocol stack does not internally allocate any memory for the registers. This makes the protocol stack very small and also usable on low end targets. In addition the values don't have to be in the memory and could for example be stored in a flash. Whenever the protocol stack requires a value it calls one of the callback function with the register address and the number of registers to read as an argument. The application should then read the actual register values (for example the ADC voltage) and should store the result in the supplied buffer. If the protocol stack wants to update a register value because a write register function was received a buffer with the new register values is passed to the callback function. The function should then use these values to update the application register values. The common callback function used to transfer common data as bytes from command buffer in little endian format.
Callback function used if the value of a Input Register is required by the protocol stack. The starting register address is given by \c usAddress and the last register is given by usAddress + usNRegs - 1.
This is modbus master respond timeout error process callback function.
This is modbus master receive data error process callback function.
This is modbus master execute function error process callback function.
This is modbus master request process success callback function.
Initialize the Modbus Master protocol stack. This functions initializes the ASCII or RTU module and calls the init functions of the porting layer to prepare the hardware. Please note that the receiver is still disabled and no Modbus frames are processed until eMBMasterEnable( ) has been called.
Initialize the Modbus Master protocol stack for Modbus TCP. This function initializes the Modbus TCP Module. Please note that frame processing is still disabled until eMBEnable( ) is called.
These Modbus functions are called for user when Modbus run in Master Mode.
Initialize the Modbus protocol stack. This functions initializes the ASCII or RTU module and calls the init functions of the porting layer to prepare the hardware. Please note that the receiver is still disabled and no Modbus frames are processed until eMBEnable( ) has been called.
Initialize the Modbus protocol stack for Modbus TCP. This function initializes the Modbus TCP Module. Please note that frame processing is still disabled until eMBEnable( ) is called.
Release resources used by the protocol stack. This function disables the Modbus protocol stack and release all hardware resources. It must only be called when the protocol stack is disabled.
Configure the slave id of the device. This function should be called when the Modbus function Report Slave ID is enabled ( By defining MB_FUNC_OTHER_REP_SLAVEID_ENABLED in mbconfig.h ).
#include "mb.h"
The protocol stack does not internally allocate any memory for the registers. This makes the protocol stack very small and also usable on low end targets. In addition the values don't have to be in the memory and could for example be stored in a flash. Whenever the protocol stack requires a value it calls one of the callback function with the register address and the number of registers to read as an argument. The application should then read the actual register values (for example the ADC voltage) and should store the result in the supplied buffer. If the protocol stack wants to update a register value because a write register function was received a buffer with the new register values is passed to the callback function. The function should then use these values to update the application register values. Callback function used if the value of a Input Register is required by the protocol stack. The starting register address is given by \c usAddress and the last register is given by usAddress + usNRegs - 1.
Callback function used if a Input Discrete Register value is read by the protocol stack. If you are going to use his function you might use the functions xMBUtilSetBits( ) and xMBUtilGetBits( ) for working with bitfields.
Function to setup communication options for TCP/UDP Modbus port
Keeps FSM event handle and mask then wait for Master stack to start
Set network options for Master port
Check whether a service has been added.
Check whether a service has been added.
Set instance name for service
Replace all TXT items for service
Deletes the finished query. Call this only after the search has ended!
Get results from search pointer. Results available as a pointer to the output parameter. Pointer to search object has to be deleted via `mdns_query_async_delete` once the query has finished. The results although have to be freed manually.
Query mDNS for host or service asynchronousely. Search has to be tested for progress and deleted manually!
Get the hostname for mDNS server
Set the address to a delegated hostname
Query whether a hostname has been added
Remove TXT item for service TXT record
Register custom esp_netif with mDNS functionality mDNS service runs by default on preconfigured interfaces (STA, AP, ETH). This API enables running the service on any customized interface, either using standard WiFi or Ethernet driver or any kind of user defined driver.
Unregister esp-netif already registered in mDNS service
Set esp_netif to a desired state, or perform a desired action, such as enable/disable this interface or send announcement packets to this netif * This function is used to enable (probe, resolve conflicts and announce), announce, or disable (send bye) mDNS services on the specified network interface. * This function must be called if users registers a specific interface using mdns_register_netif() to enable mDNS services on that interface. * This function could be used in IP/connection event handlers to automatically enable/announce mDNS services when network properties change and/or disable them on disconnection.
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.
Free a browse item (Not free the list).
Start Modbus communication stack
Set Modbus communication parameters for the controller
Destroy Modbus controller and stack
Wait for specific event on parameter change.
Specific interface functions ******************************************** Interface functions below provide basic methods to read/write access to slave devices in Modbus segment as well as API to read specific supported characteristics linked to Modbus parameters of devices in Modbus network. Assign parameter description table for Modbus controller interface.
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.
Set Modbus communication parameters for the controller
Start Modbus communication stack
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.
Destroy Modbus controller and stack
Free search structure (except the results)
Send probe for particular services on particular PCB Tests possible duplication on probing service structure and probes only for new entries. - If pcb probing then add only non-probing services and restarts probing - If pcb not probing, run probing for all specified services
Get the service name of a service
Initialize Modbus Slave controller and stack for TCP port
Initialize Modbus Slave controller and stack for Serial port
Initialize Modbus controller and stack for TCP port
Initialize Modbus Master controller and stack for Serial port
appends answer type, class, ttl and data length to a packet, incrementing the index
Helper to get either ETH or STA if the other is provided Used when two interfaces are on the same subnet
Allocate new packet for sending
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.
The helper function to expose transaction info from modbus layer
Registers a callback handler for a given function code. This function registers a new callback handler for a given function code. The callback handler supplied is responsible for interpreting the Modbus PDU and the creation of an appropriate response. In case of an error it should return one of the possible Modbus exceptions which results in a Modbus exception frame sent by the protocol stack.
Modbus master coils callback function.
Modbus master discrete callback function.
Modbus master input register callback function.
Modbus master holding register callback function.
Modbus master holding register callback function.
Modbus master coils callback function.
Modbus master discrete callback function.
Modbus master input register callback function.
Dispatch interface changes based on system events
Add result to browse, only add when the result is a new one.
Send by for particular services
Send probe on all active PCBs
Send announcement on all active PCBs
Removes saved question from parsed data
schedules a packet to be sent after given milliseconds
Find, remove and free answer from the scheduled packets
finds service from given service type
Called from parser to add PTR data to search result
Called from packet parser to find matching running search
Send announcement on particular PCB
Convert Predefined interface to esp-netif handle
Restart the responder on all active PCBs
Duplicate string or return error
Find, remove and free answers and scheduled packets for service
Check if the parsed name is self-hosted, i.e. we should resolve conflicts
reads and formats MDNS FQDN into mdns_name_t structure
Create linked IP (copy) from parsed one
Called from parser to add A/AAAA data to search result
Send PTR query packet to all available interfaces for browsing.
Called from parser to add A/AAAA data to search result
appends AAAA record to a packet, incrementing the index
Convert Predefined interface to the netif id from the internal netif list
Remove and free service answer from answer list (destination)
Check if the parsed name is ours (matches service or host name)
Create TXT result array from parsed TXT data
reads MDNS FQDN into mdns_name_t structure FQDN is in format: [hostname.|[instance.]_service._proto.]local.
Append answer to packet
Check if IPv6 address is NULL
clear packets scheduled for sending on a specific interface
appends A record to a packet, incrementing the index
Registers a callback handler for a given function code. This function registers a new callback handler for a given function code. The callback handler supplied is responsible for interpreting the Modbus PDU and the creation of an appropriate response. In case of an error it should return one of the possible Modbus exceptions which results in a Modbus exception frame sent by the protocol stack.
Allocate new search structure
Mark search as finished and remove it from search chain
Called from parser to finish any searches that have reached maximum results
Chain new IP to search result
Mark browse as finished, remove and free it from browse chain
Add new browse to the browse chain
Called from packet parser to find matching running search
Called from parser to add TXT data to search result
Called from parser to add SRV data to search result
Called from parser to add SRV data to search result
Called from parser to add TXT data to search result
Send search packet to particular interface
appends one TXT record ("key=value" or "key")
Send by for particular services on particular PCB
Send probe for additional services on particular PCB
Send bye for particular subtypes
Stop the responder on all services without instance
Restart the responder on all services without instance
creates/allocates new text item list
Deallocate the txt linked list
Set interface as duplicate if another is found on the same subnet
Check if parsed name is discovery
Called from parser to check if question matches particular service
appends PTR record for service to a packet, incrementing the index
appends PTR record for a subtype to a packet, incrementing the index
Check if interface is duplicate (two interfaces on the same subnet)
Browse sync result action
Allocate new browse structure
free all packets scheduled for sending
Remove and free answer from answer list (destination)
Check if question is already in the list
the receive callback of the raw udp api. Packets are received here
Low level UDP Multicast membership control
Add new search to the search chain
Create search packet for particular interface
Send search packet to all available interfaces
Convert probe packet to announce
Restart the responder on particular PCB
Restart the responder on all active PCBs
Append question to packet
appends DNS-SD PTR record for service to a packet, incrementing the index
appends TXT record for service to a packet, incrementing the index
Called from service thread to execute given action
Called from timer task to run mDNS responder periodically checks first unqueued packet (from tx head). if it is scheduled to be transmitted, then pushes the packet to action queue to be handled.
Called from timer task to run active searches
the main MDNS service task. Packets are received and parsed here
Start the service thread if not running
Stop the service thread
creates/allocates new service
Detect IPv4 address collision
Detect IPv6 address collision
Adds a delegated hostname to the linked list
read uint32_t from a packet
Get number of items in TXT parsed data
Get the length of TXT item's key name
appends uint32_t in a packet, incrementing the index
appends single string to a packet, incrementing the index
Performs interface changes based on system events or custom commands
get the next packet scheduled for sending on a specific interface
Create answer packet to questions from parsed packet
Create probe packet for particular services on particular PCB
Create announce packet for particular services on particular PCB
appends SRV record for service to a packet, incrementing the index
Check if any of the interfaces is up

Other commonly used symbols

Name
Location
Summary
mDNS query result structure
Asynchronous query handle
mDNS basic text item structure Used in mdns_service_add()
mDNS query linked list IP item
Offset for response data in PDU.
Socket ID of slave
Modbus controller handler structure
Characteristics descriptor type is used to describe characteristic and link it with Modbus parameters that reflect its data.
Modbus controller handler structure
IP address
next result, or NULL for the last result in the list
linked list of IP addresses found
time to live
ip_protocol type of the interface (v4/v6)
ptr to corresponding esp-netif
TCP/UDP IP address
next result, or NULL for the last result in the list
txt record
Device communication structure to setup Modbus controller
Modbus register request type structure
item key name
Offset of function code in PDU.
Modbus area descriptor list item
next result, or NULL for the last result in the list
ID of the transaction
next IP, or NULL for the last IP in the list
protocol stack in illegal state.
srevice protocol
item value string
Characteristic cid
item key name
Slave information index
item value string
mDNS basic subtype item structure Used in mdns_service_subtype_xxx() APIs
number of txt items
Modbus slave addr list item for the master
Modbus slave options
Pointers to information about connected clients
Parameter access event information type
Most modules in the protocol stack are completly optional and can be excluded. This is specially important if target resources are very small and program memory space should be saved. All of these settings are available in the file mbconfig.h
I/O error.
controller event group
Update register values.
item value length
Modbus controller interface structure
communication info
illegal argument.
array of txt value len of each record
Modbus controller semaphore
illegal register address.
master is busy now.
Request mode for parameter to use in data dictionary
buffer active position
The key (name) of the parameter
Modbus controller event group
Master information structure for each connected slave
subtype name
Transaction start flag
Read register values and pass to protocol stack.
illegal argument.
The total slaves in Modbus Master system.
Modbus communication info
Modbus data buffer pointer
Modbus data buffer size
controller notification queue
porting layer error.
Parameter storage area descriptor
Modbus controller parameter description table
Write parameter values.
Size of mb parameter in registers
Client connection count
Receive buffer pointer
Master count of connected slaves
service port
Modbus task handle
Transaction identifier (TID) for slave
Modbus Holding register.
Float, U8, U16, U32, ASCII, etc.
Modbus Input register.
Request process success.
Request receive data error.
Request execute function error.
No error, initial state.
Modbus start address for area descriptor
register area descriptors
TCP/UDP IP address (string)
Receive buffer position
Modbus controller parameter description table size
Interface method destroy
Interface method setup
Interface method start
Interface get_cid_info method
Interface get_parameter method
Interface send_request method
Interface set_descriptor method
Interface set_parameter method
Stack callback discrete rw method
Stack callback input rw method
Stack callback holding rw method
Stack callback coils rw method
Maximum number of Modbus functions codes the protocol stack should support. The maximum number of supported Modbus functions must be greater than the sum of all enabled functions in this file and custom function handlers. If set to small adding more functions will fail.
Interface method destroy
Interface method setup
Interface method start
Interface method check_event
Interface method get_param_info
buffer left bytes to receive transaction
Socket receive error
Send request time stamp
Master connection queue
Receive frame data error.
Number of bytes in the parameter.
Type of storage area descriptor
Slave address information list
Modbus command to send
Modbus transacion info structure
Instance address for storage area descriptor
last TID counter from packet
Master current slave information
Modbus event type
TCP communication mode.
Modbus start address for area descriptor
Device communication parameters for master
Slave address of device in the Modbus segment
TCP IPV4 addressing
event itself.
If master send a frame which is not broadcast,the master will wait sometime for slave. And if slave is not respond in this time,the master will process this timeout error.
Device communication parameters for master
Interface method set_descriptor
Stack callback discrete rw method
Stack callback input rw method
Stack callback holding rw method
Stack callback coils rw method
receive response timestamp
Protocol type used by port
Receive response time stamp
Slave respond timeout.
the characteristic of the device are readable & writable & triggerable
Offset of Modbus-PDU in Ser-PDU.
TCP IPV4 addressing
Instance address for storage area descriptor
Instance size for area descriptor (bytes)
The slave address entry
Interface method init
RTU transmission mode.
Modbus slave address
Modbus start register
Modbus number of registers
Modbus parameter options for description table
illegal register address.
timeout error occurred.
Transaction information structure.
The macro to access arrays of elements for type conversion.
Number of bytes which should be allocated for the Report Slave ID command. This number limits the maximum size of the additional segment in the report slave id function. See eMBSetSlaveID( ) for more information on how to set this value. It is only used if MB_FUNC_OTHER_REP_SLAVEID_ENABLED is set to 1.
Interface method init
Master TCP/UDP handling task handle
represents the IP address of the slave
Callback function for the porting layer when a new byte is available. Depending upon the mode this callback function is used by the RTU or ASCII transmission layers. In any case a call to xMBPortSerialGetByte() must immediately return a new character.
Maximum size of a Modbus frame.
Offset of slave address in Ser-PDU.
Modbus data storage address
Modbus Event Read Holding registers.
Modbus Event Read Input registers.
Modbus Event Read Coils.
Modbus Event Read Discrete bits.
Type of modbus parameter
Startup finished.
Modbus port type serial slave.
Modbus port type serial master.
Timestamp of Modbus Event (uS)
Modbus register offset
Modbus event register size (number of registers)
Modbus Event Write Holding registers.
Modbus Event Write Coils.
Short slave address
Interface method set_descriptor
Read parameter values.
Modbus communication mode
the characteristic of the device are triggerable
Execute function error.
No error, processing completed.
timestamp of event posted
TCP mode.
receive data error.
execute function error.
The option is required for support of RTU over TCP.
Modbus communication mode
The Modbus area descriptor entry
Modbus info index
TCP/UDP port number
IP address to bind
IP protocol version
Master current processing slave index
index of the address info
Execute function.
ASCII transmission mode.
Parameter options used to check limits and etc.
ASCII transmission mode.
The physical units of the parameter
Parameter name (OFFSET in the parameter structure)
Receiver is in idle state.
Transmitter is in idle state.
Modbus UART parity settings
Index of the slave address
IP address string of the slave
Modbus port type
Modbus communication port (UART) number
Modbus port type TCP master.
Modbus port type TCP slave.
TCP IPV6 addressing
common interface method types Interface method init
Interface method destroy
This is the Modbus register address. This is the 0 based value.
the characteristic of the device are readable
the characteristic of the device are writable
Interface method setup
Interface method start
TCP IPV6 addressing
Execute function.
Master wait respond for slave.
insufficient resources.
Timeout to wait in ASCII prior to enabling transmitter. If defined the function calls vMBPortSerialDelay with the argument MB_ASCII_TIMEOUT_WAIT_BEFORE_SEND_MS to allow for a delay before the serial transmitter is enabled. This is required because some targets are so fast that there is no time between receiving and transmitting the frame. If the master is to slow with enabling its receiver then he will not receive the response correctly.
Slave address field
Modbus communication port (UART) number
Modbus UART parity settings
Instance size for area descriptor (bytes)
send request timestamp
Network netif interface pointer for port
Slave short address
Master TCP/UDP port number
Master IP version
Master netif interface pointer
slave unit ID (UID) field for MBAP frame
Startup finished.
Master sent broadcast ,then delay sometime.
RTU transmission mode.
Default CR character for Modbus ASCII.
Transmitter is in transfer finish and wait receive state.
Receiver is in initial state.
Frame is beeing received.
If the frame is invalid.
Transmitter is in transfer state.
Modbus communication mode
Master receive frame T3.5 timeout.
pointer to data structure
Interface get_cid_info method
Interface get_parameter method
Interface send_request method
Interface set_parameter method
Modbus unique transaction identificator
Modbus last transaction error type
Modbus destination short address (or UID)
Modbus last transaction function code
Modbus last transaction exception code returned by slave
the characteristic of the device are readable & writable
timestamp of event get
timeout error occurred.
If master send a broadcast frame, the master will wait time of convert to delay,
Type of storage area descriptor
Interface method get_param_info
Constants which defines the format of a modbus frame. The example is shown for a Modbus RTU/ASCII frame. Note that the Modbus PDU is not dependent on the underlying transport. +-----------+---------------+----------------------------+-------------+ | Address | Function Code | Data | CRC/LRC | +-----------+---------------+----------------------------+-------------+ | | | | (2) (3/2') (3') (4) (1) ... MB_SER_PDU_SIZE_MAX = 256 (2) ... MB_SER_PDU_ADDR_OFF = 0 (3) ... MB_SER_PDU_PDU_OFF = 1 (4) ... MB_SER_PDU_SIZE_CRC = 2 (1') ... MB_PDU_SIZE_MAX = 253 (2') ... MB_PDU_FUNC_OFF = 0 (3') ... MB_PDU_DATA_OFF = 1 Maximum size of a PDU.
TCP/UDP sock error
Master protocol type
Size of LRC field in PDU.
Size of CRC field in PDU.
Default LF character for Modbus ASCII.
Minimum size of a Modbus ASCII frame.
Modbus address table for connection
Modbus network interface
Minimum size of a Modbus RTU frame.
Minimum size of a Modbus RTU frame.
Modbus communication mode
Modbus communication port (UART) number
Modbus UART parity settings
Modbus baudrate
UDP communication mode.
the characteristic of the device are readable & triggerable
the characteristic of the device are writable & triggerable
Access permissions based on mode
Double GHEFCDAB floating point, big endian, reversed register order
Double BADCFEHG floating point, little endian, reversed register order
Unsigned 8, register value
Signed 8, register value
Signed integer 64 size
Unsigned integer 64 size
I8 signed integer in high byte of register
I8 signed integer in low byte of register
U8 unsigned integer written to hi byte of register
U8 unsigned integer written to low byte of register
I16 signed integer, big endian
I16 signed integer, little endian
U16 unsigned integer, big endian
U16 unsigned integer, little endian
I32 ABCD signed integer, big endian
I32 CDAB signed integer, big endian, reversed register order
I32 BADC signed integer, little endian, reversed register order
I32 DCBA signed integer, little endian
U32 ABCD unsigned integer, big endian
U32 CDAB unsigned integer, big endian, reversed register order
U32 BADC unsigned integer, little endian, reversed register order
U32 DCBA unsigned integer, little endian
Float ABCD floating point, big endian
Float CDAB floating point big endian, reversed register order
Float BADC floating point, little endian, reversed register order
Float DCBA floating point, little endian
I64, ABCDEFGH signed integer, big endian
I64, HGFEDCBA signed integer, little endian
I64, GHEFCDAB signed integer, big endian, reversed register order
I64, BADCFEHG signed integer, little endian, reversed register order
U64, ABCDEFGH unsigned integer, big endian
U64, HGFEDCBA unsigned integer, little endian
U64, GHEFCDAB unsigned integer, big endian, reversed register order
U64, BADCFEHG unsigned integer, little endian, reversed register order
Double ABCDEFGH floating point, big endian
Double HGFEDCBA floating point, little endian
#include "mb.h"
This module defines the interface for the application. It contains the basic functions and types required to use the Modbus protocol stack. A typical application will want to call eMBInit() first. If the device is ready to answer network requests it must then call eMBEnable() to activate the protocol stack. In the main loop the function eMBPoll() must be called periodically. The time interval between pooling depends on the configured Modbus timeout. If an RTOS is available a separate task should be created and the task should always call the function eMBPoll().
// Initialize protocol stack in RTU mode for a slave with address 10 = 0x0A eMBInit( MB_RTU, 0x0A, 38400, MB_PAR_EVEN ); // Enable the Modbus Protocol Stack. eMBEnable( ); for( ;; ) { // Call the main polling loop of the Modbus protocol stack. eMBPoll( ); ... }
Use the default Modbus TCP port (502)
#include "mb.h"
This module defines the interface for the application. It contains the basic functions and types required to use the Modbus Master protocol stack. A typical application will want to call eMBMasterInit() first. If the device is ready to answer network requests it must then call eMBEnable() to activate the protocol stack. In the main loop the function eMBMasterPoll() must be called periodically. The time interval between pooling depends on the configured Modbus timeout. If an RTOS is available a separate task should be created and the task should always call the function eMBMasterPoll().
// Initialize protocol stack in RTU mode for a Master eMBMasterInit( MB_RTU, 38400, MB_PAR_EVEN ); // Enable the Modbus Protocol Stack. eMBMasterEnable( ); for( ;; ) { // Call the main polling loop of the Modbus Master protocol stack. eMBMasterPoll( ); ... }
Use the default Modbus Master TCP port (502)
Modbus baudrate
TCP/UDP port number
Modbus slave address field (dummy for master)
Modbus slave address field for UID
Parameter option1
Parameter option2
Parameter option3
Parameter minimum value
Parameter maximum value
Step of parameter change tracking

Dependencies