FreeMODBUS

A portable MODBUS ASCII/RTU and TCP implementation

HW/SW requirements

The hardware requirements are minimal

  • Approximately 5-10Kbytes of FLASH and 300 bytes of SRAM
  • A UART with interrupt support. For standard compliance 2 stop bits are required for no parity mode. 7 data bits are required for MODBUS ASCII
  • A TIMER with a resolution off at least 750 microseconds.

Operation is possible with and without an operating system. If a RTOS is available event queues can be used to avoid busy waiting within the MODBUS task (See STR71X/FreeRTOS). For systems running without RTOS a polling based approach in combination with a global variable can be used (See Atmel AVR port)
The actual memory requirements depend on the used modules. The first table shows the required memory with all supported functions compiled in. Values for the ARM where obtained using the GNUARM compiler collection 3.4.4 with -O1 in ARM mode. The AVR values where obtained using the WinAVR compiler collection 3.4.5 with -Os.

ModuleARM CodeARM RAM (static)AVR CodeAVR RAM (static)
Modbus RTU (Required)1132Byte272Byte1456Byte266Byte
Modbus ASCII (Optional)1612Byte28Byte1222Byte16Byte
Modbus Functions [1]1180Byte34Byte1602Byte34Byte
Modbus Core (Required)924Byte180Byte608Byte75Byte
Porting Layer (Required [2])1756Byte16Byte704Byte7Byte
Totals7304Byte530Byte5592Byte398Byte

[1]: Actual size depends on configued MODBUS functions. Function can be enabled/disable using the header file mbconfig.h.
[2]: Depends on the hardware.