If the default options are not suitable the file mbsconfig.h
should be created. This file can then be used for customization.
|
If we want advanced startup/shutdown locking. Advanced startup/shutdown locking might be necessary if the MODBUS stack should be embedded as a DLL and the porting layers needs specials hooks for startup, i.e. when the first instance is created and when the last instance is shut down. If for the first time an MODBUS serial or TCP init function is called the stack calls vMBPLibraryLoad( ). If the stack is shutdown the function calls vMBPLibraryUnload( ). Because the init and the close functions could be mixed due to threading a second locking primitive MBP_ENTER_CRTICIAL_INIT and MBP_EXIT_CRITICAL_INIT have to be provided. They default to empty macros but should be defined. for safe startup/shutdown behaviour is this can not be enforced by the application. |
|
Backof time milliseconds for MODBUS SERIAL to introduce an additional delay after the frame has been received and before the reply is sent.
|
|
The character timeout value for Modbus ASCII. The character timeout value is not fixed for Modbus ASCII and is therefore a configuration option. It should be set to the maximum expected delay time of the network. |
|
If the ASCII layer should wait some time before enabling the receiver. This function is most useful for toggling the driver enable lines of RS485 transceivers if there is no support in the UART for doing this. |
|
If the MODBUS handle should be passed to the callback functions.
|
|
If debugging code should be built into the MODBUS stack.
|
|
If the API should check arguments for errors. This has a small performance impact and one might not use this on very small systems. |
|
If the MODBUS slave should support gateway mode. If enabled the MODBUS slave processes all slave requests. This can be used to implement request forwarding to other devices. |
|
Enable protocol analyzer.
|
|
Enable serial diagnosis functions.
|
|
Enable statistics interface.
|
|
If the Read/Write Multiple Registers function should be enabled.
|
|
If the Read Coils function should be enabled.
|
|
If the Read Discrete function should be enabled.
|
|
brief If the Read Holding Registers function should be enabled. |
|
If the Read Input Registers function should be enabled.
|
|
If the Mask Write Registers function should be enabled.
|
|
If the Report Slave ID function should be enabled.
|
|
If the Write Multiple Coils function should be enabled.
|
|
If the Read Input Registers function should be enabled.
|
|
If the Write Single Coil function should be enabled.
|
|
If the Write Single Register function should be enabled.
|
|
If this is an evaluation build.
|
|
Number of custom function handlers which are supported.
|
|
If enabled eMBSPoll internally executes any required poll cycles to fully process a pending frame. This macro should be enabled if eMBSPoll is not called often enough. It makes sure that a frame is fully processed, i.e. parsed, callbacks executed and response sent. |
|
If the MODBUS stack handle is passed to lower layers.
|
|
Makes the MODBUS handle available internal within the frame handlers.
|
|
If the RTU layer should wait some time before enabling the receiver. This function is most useful for toggling the driver enable lines of RS485 transceivers if there is no support in the UART for doing this. |
|
Choose the API of the serial read/write callbacks. There are two different versions.
|
|
Serial timeout for RTU frame reception computed dynamically on the baudrate. Only usef in V2 serial API. This function should return the timeout to use for end of frame transmission. You should set this to match the internal buffer size of your serial device. For example if you can buffer 32 bytes and the speed is 9600 you would return approx. 11/9600 * 32 + 5ms where the 5ms is an additional safety margin and 11/9600 is for 8 databits, 1 stopbit and parity. |
|
Serial timeout for RTU frame reception if the serial API version 2 is used. Most operating systems using the API version 2 do not support very tight timeouts. Therefore we do not use the t3.5 timers in MODBUS RTU but use a higher timeout. The best value depend on the operating system and its realtime characteristics as well as the serial driver interface. |
|
The timeout to wait when wait after send timeouts are used in ASCII transmission mode. This macro should be defined if the default wait after send timeouts are not useful. It is only used when either MBS_ASCII_WAITAFTERSEND_ENABLED is defined. |
|
Number of serial ASCII instances supported.
|
|
Normally a frame is processed within the frame receive callback. This function allows processing non local frames within the timer callback. Normally frames are processed within the RTU callbacks. This can be problematic in case of RTU because it implies that the slave must handle all frames, even not then ones sent to itself. This function checks in the callback if the request is either a broadcast or for the slave. If not it drops it silently. |
|
The timeout to wait when wait after send timeouts are used in RTU transmission mode. This macro should be defined if the default wait after send timeouts are not useful. It is only used when either MBS_RTU_WAITAFTERSEND_ENABLED is defined. |
|
Number of serial RTU instances supported.
|
|
Ignore MBAP unit ID field in TCP slave.
|
|
Number of TCP clients allowed.
|
|
Number of TCP instances supported.
|
|
If the slave ID of a request should be tracked. If enabled this macro allows the register callback functions to get the slave address for this MODBUS request. |
|
If MODBUS ASCII support is enabled. If MODBUS RTU support is enabled. If MODBUS TCP support is enabled. If MODBUS TCP support is enabled.
|
|
Number of TCP instances supported.
|