MODBUS

Embedded Experts speaks MODBUS.

Add MODBUS functionality to your products

MODBUSMODBUS is a request/response protocol where multiple functions provide access to standardized services. The standardized services include a predefined data model based on discrete bits and registers suitable for representing analog and digital information. If not sufficient this services can be extended using custom function code and application specific data models.

MODBUS is located at layer 7 of the Open Systems Interconnection (OSI) model. It supports master / slave communication between devices attached on RS485/RS422 or TCP/IP networks. Add MODBUS to your devices with SILA Embedded Solutions MODBUS stacks within a couple of weeks. Our network stacks are fast, portable and easy to integrate. Furthermore the stack is provided with demo applications for numerous platforms. To protect your investment the stack is delivered as ANSI C sourcecode without any runtime royalties and 6 months of free support.

To further reduce integration time we can also integrate our stack into your hardware and software platform. This services is especially suitable such that your engineers can focus on your application specific problem resulting in a faster time to market.

MODBUS Master

Properties

  • MODBUS RTU/ASCII for RS485/RS422
  • MODBUS TCP/IP and MODBUS UDP
  • Parallel operation of MODBUS TCP and RTU/ASCII
  • Parallel operation of multiple MODBUS RTU/ASCII instances on independent physical interfaces
  • Standard conforming and easily portable ANSI C source code
  • Scale from 8Kbyte to 20Kbyte FLASH. Functions can be configured using compile time directives
  • Low memory requirements of 300-400 Byte for each instance
  • Simultaneous operation with MODBUS Slave
  • Supports MODBUS TCP/IP, MODBUS over UDP, MODBUS RTU/ASCII over RS232, RS485/RS422
  • Supports function codes 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x0F, 0x10, 0x11, 0x14, 0x15, 0x16, 0x17
  • Custom function codes can easily be added

MODBUS Slave

Properties:

  • MODBUS RTU/ASCII for RS485/RS422
  • MODBUS TCP/IP and MODBUS UDP
  • MODBUS TCP Gateway mode (Requires Master license)
  • Statistic interface to analyze and log MODBUS requests
  • Parallel operation of MODBUS TCP and RTU/ASCII
  • Parallel operation of multiple MODBUS RTU/ASCII instances on independent physical interfaces
  • Standard conforming and easily portable ANSI C source code
  • Scale from 8Kbyte to 20Kbyte FLASH. Functions can be configured using compile time directives
  • Low memory requirements of 300-400 Byte for each instance
  • Simultaneous operation with MODBUS Master
  • Supports MODBUS TCP/IP, MODBUS over UDP, MODBUS RTU/ASCII over RS232, RS485/RS422
  • Supports function codes 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x0C, 0x0B, 0x0F, 0x10, 0x11, 0x16, 0x17, 0x2B
  • Custom function codes can easily be added

Supported Platforms

  • Microcontrollers with or without RTOS. Includes demos for AVR, MSP430, PIC32, ARM (Atmel, Freescale, NXP, STM32), 8051 and others
  • Demos for common RTOS like FreeROTS, uCOS-II, Keil-RTX and others
  • Supports two serial API versions for byte wise and blockwide processing

  • Selected example ports:

Description

  • SOC: ATXMEGA-128A4U
  • EvalBoard: n/a
  • Atmel Studio 7.0 / ASF
  • USARTC0
  • RTU / MODBUS @ 19200 NONE
Slave #RegistersStartLength
1Holding0x00001

Notes

Register 0 is an incrementing counter.

History

  • 2014-03-09: Created
  • 2020-03-24: Updated to Atmel Studio 7.0

Status

ProjectCompileLinkingTested on Target
OKOKOK2014-03-09

Description

  • SOC: AVR_ATmega328P
  • EvalBoard: n/a
  • Atmel Studio 7.0 / BARE
  • USART0 and USART1 on PORTC
  • RTU / RS485 @ 19200 NONE
Slave #RegistersStartLength
1Holding0x000010

Notes

This demo demonstrates one slave instance and one master instance of the stack running simultaneously.

History

  • 2008-12-06: Created
  • 2010-02-28: Updated AVR port to work with ICCAVR.
  • 2010-08-19: Added CodeVision AVR support.
  • 2020-05-04: Updated to Atmel Studio 7.0

Status

ProjectCompileLinkingTested on Target
OKOKOK2008-12-06

Description

  • SOC: AVR_ATmega128
  • EvalBoard: n/a
  • Atmel Studio 7.0 / BARE
  • USART on PORTC
  • RTU / RS485 or RS232 @ 19200 NONE
Slave #RegistersStartLength
1Holding0x000015
1Input0x00024

Notes

Register 0 is an incrementing counter.
Reads holding register from address 5 - 10, increment them by one and store them at address 10.
Reads the input registers from address 2 - 5 and write them to the holding registers at address 1 - 4.
Led is turned on/off depending on the value of the variable bTurnOn.

History

  • 2007-06-23: Created
  • 2008-09-18: Added configuration file for master/slave demo.
    Increased number of software timers.
  • 2008-12-06: Added demo for master/slave stack running at the same time.
  • 2010-02-28: Updated AVR port to work with ICCAVR.
  • 2010-08-19: Added CodeVision AVR support.
  • 2020-05-04: Updated to Atmel Studio 7.0

Status

ProjectCompileLinkingTested on Target
OKOKOK2007-06-23

Description

  • SOC: AVR_ATmega2561
  • EvalBoard: n/a
  • Atmel Studio 7.0 / BARE
  • USART1
  • RTU / RS485 @ 19200 NONE
Slave #RegistersStartLength
1Holding0x000015
1Input0x00024

Notes

Register 0 is an incrementing counter.
Reads holding register from address 5 - 10, increment them by one and store them at address 10.
Reads the input registers from address 2 - 5 and write them to the holding registers at address 1 - 4.
Led is turned on/off depending on the value of the variable bTurnOn.

History

  • 2007-06-23: Created
  • 2008-09-18: Added configuration file for master/slave demo.
    Increased number of software timers.
  • 2008-12-06: Added demo for master/slave stack running at the same time.
  • 2010-02-28: Updated AVR port to work with ICCAVR.
  • 2010-08-19: Added CodeVision AVR support.
  • 2020-05-04: Updated to Atmel Studio 7.0

Status

ProjectCompileLinkingTested on Target
OKOKOK2007-06-23

Description

  • SOC: AVR_ATmega32
  • EvalBoard: n/a
  • Atmel Studio 7.0 / BARE
  • USART on PORTC
  • RTU / RS485 or RS232 @ 19200 NONE
Slave #RegistersStartLength
1Holding0x000015
1Input0x00024

Notes

Register 0 is an incrementing counter.
Reads holding register from address 5 - 10, increment them by one and store them at address 10.
Reads the input registers from address 2 - 5 and write them to the holding registers at address 1 - 4.
Led is turned on/off depending on the value of the variable bTurnOn.

History

  • 2007-06-23: Created
  • 2008-09-18: Added configuration file for master/slave demo.
    Increased number of software timers.
  • 2008-12-06: Added demo for master/slave stack running at the same time.
  • 2010-02-28: Updated AVR port to work with ICCAVR.
  • 2010-08-19: Added CodeVision AVR support.
  • 2020-05-04: Updated to Atmel Studio 7.0

Status

ProjectCompileLinkingTested on Target
OKOKOK2007-06-23

Description

  • SOC: AVR_ATmega64
  • EvalBoard: n/a
  • Atmel Studio 7.0 / BARE
  • USART on PORTC
  • RTU / RS485 or RS232 @ 19200 NONE
Slave #RegistersStartLength
1Holding0x000015
1Input0x00024

Notes

Register 0 is an incrementing counter.
Reads holding register from address 5 - 10, increment them by one and store them at address 10.
Reads the input registers from address 2 - 5 and write them to the holding registers at address 1 - 4.
Led is turned on/off depending on the value of the variable bTurnOn.

History

  • 2007-06-23: Created
  • 2008-09-18: Added configuration file for master/slave demo.
    Increased number of software timers.
  • 2008-12-06: Added demo for master/slave stack running at the same time.
  • 2010-02-28: Updated AVR port to work with ICCAVR.
  • 2010-08-19: Added CodeVision AVR support.
  • 2020-05-04: Updated to Atmel Studio 7.0

Status

ProjectCompileLinkingTested on Target
OKOKOK2007-06-23

Description

  • SOC: LPC1758
  • EvalBoard: n/a
  • LPCXpresso v8.2.2_650 / FreeRTOS
  • master 1: TCP
  • master 2: RTU @ 38400 NONE, UART0
Master #Slave #RegistersStartLength
1192.168.0.200:502Holding0x000010
21Holding0x000010

Notes

  • Reads holding register from address 0 - 10 for both masters.
  • LED0 is a blinking LED.
  • Make sure to use the Release configuration for this demo.

History

  • 2011-01-02: Created
  • 2014-08-23: Added new lwIP port
  • 2020-06-02: Updated to LPCXpresso v8.2.2_650

Status

ProjectCompileLinkingTested on Target
OKOKOK2011-01-02

Description

  • SOC: MSP430F169
  • EvalBoard: n/a
  • IAR Embedded Workbench 8.4
  • USART0
  • RTU / MODBUS @ 19200 NONE
Slave #RegistersStartLength
1Holding0x000015
1Input0x00024

Notes

Register 0 is an incrementing counter.
Reads holding register from address 5 - 10, increment them by one and store them at address 10.
Reads the input registers from address 2 - 5 and write them to the holding registers at address 1 - 4.
Led is turned on/off depending on the value of the variable bTurnOn.

History

  • 2010-11-28: Created
  • 2020-05-05: Updated to IAR Embedded Workbench 8.4

Status

ProjectCompileLinkingTested on Target
OKOKOK2010-11-28

Description

  • SOC: PIC18F45K22
  • EvalBoard: n/a
  • MPLAB X IDE v5.35
  • EUSART on PORTA
  • ASCII / MODBUS @ 19200 NONE
Slave #RegistersStartLength
1Holding0x000015
1Input0x00024

Notes

Register 0 is an incrementing counter.
Reads holding register from address 5 - 10, increment them by one and store them at address 10.
Reads the input registers from address 2 - 5 and write them to the holding registers at address 1 - 4.
Led is turned on/off depending on the value of the variable bTurnOn.

History

  • 2008-02-26: Created
  • 2008-04-03: - Added support for disabling the additional API checks.
    • Fixed bug with coil/discrete registers.
  • 2020-05-05: Updated to MPLAB X IDE v5.35

Status

ProjectCompileLinkingTested on Target
OKOKOK2008-02-26

Description

  • SOC: S5D9
  • EvalBoard: n/a
  • e² studio/ ThreadX
  • UART0
  • RTU / RS232 or RS485 @ 38400 ODD
Slave #RegistersStartLength
1Holding0x000010

Notes

Using SSP 1.7.5.
Register 0 is an incrementing counter.
Reads holding register from address 0 - 9, increment them by one and store them at their same address.

History

  • 2019-07-11: Created
  • 2020-06-04: Updated to latest verison of e² studio

Status

ProjectCompileLinkingTested on Target
OKOKOK2019-07-11

Description

  • SOC: STM32-L072
  • EvalBoard: STM32-L072
  • Keil MDK-ARM 5.29 / FreeRTOS
  • USART4 using DMA
  • RTU / MODBUS @ 38400 ODD
Slave #RegistersStartLength
1Input0x00024

Notes

Reads the input registers from address 2 - 5

History

  • 2016-08-27: Created
  • 2017-03-07 : Added STM32/CubeMx bugfixes
  • 2020-03-24: Updated to Keil ARM 5.29

Status

ProjectCompileLinkingTested on Target
OK1 WarningOK2016-08-27

Description

  • SOC: n/a ( WIN32 )
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • COM1
  • RTU / MODBUS @ 19200 NONE
  • Implements a custom function code
Slave #RegistersStartLength
1Input--
1Holding--

Notes

  • Multiple demos available
  • demo-custom.c shows implementation of a custom function code (fc=65)

History

  • 2008-07-20: Created
  • 2008-09-02: Synced with changes from improved Windows and Windows CE port
  • 2009-12-20: - Added new serial mode slow computers.
    • Fixed porting layer so that it works with master/slave at same time.
  • 2015-06-14: Added new WIN32 port with improved performance
  • 2020-05-06: Updated to Visual Studio 2019

Status

ProjectCompileLinkingTested on Target
OKOKOK2008-07-20

Description

  • SOC: n/a ( WIN32 )
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • Master 1: RTU / MODBUS @ 19200 NONE, COM2, Slave address : 1
  • Master 2: RTU / MODBUS @ 38400 NONE, COM5, Slave address : 1
Master #RegistersStartLength
1Holding0x00002
2Holding0x00002

Notes

  • Multiple demos available
  • demo-multi.c demonstrates two instances of the stack running simultaneously.
  • Holding register 0 for both masters is an incrementing counter
  • Reads holding register 1 for both masters

History

  • 2008-07-20: Created
  • 2008-09-02: Synced with changes from improved Windows and Windows CE port
  • 2009-12-20: - Added new serial mode slow computers.
    • Fixed porting layer so that it works with master/slave at same time.
  • 2015-06-14: Added new WIN32 port with improved performance
  • 2020-05-06: Updated to Visual Studio 2019

Status

ProjectCompileLinkingTested on Target
OKOKOK2008-07-20

Description

  • SOC: n/a ( WIN32 )
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • master 1: TCP 127.0.0.1:502
  • master 2: RTU @ 19200 NONE, COM1
For both masters:Slave #RegistersStartLength
1Holding0x00002

Notes

  • Multiple demos available
  • demo-tcp-multi.c shows running both TCP and RTU in parallel in the same application
  • Holding register 0 for both masters is an incrementing counter
  • Reads holding register 1 for both masters

History

  • 2008-10-29: Created
  • 2008-09-02: Synced with changes from improved Windows and Windows CE port
  • 2009-12-20: - Added new serial mode slow computers.
    • Fixed porting layer so that it works with master/slave at same time.
  • 2015-06-14: Added new WIN32 port with improved performance
  • 2020-05-06: Updated to Visual Studio 2019

Status

ProjectCompileLinkingTested on Target
OKOKOK2008-10-29

Description

  • SOC: n/a ( WIN32 )
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • TCP master : 213.129.231.174:502
Slave #RegistersStartLength
1Holding0x00001

Notes

  • Multiple demos available
  • demo-tcp-single.c shows usage of modbus/TCP.
  • This demo connects/disconnects to the stack 5 times and then disconnects automatically.
  • Holding register 0 is an incrementing counter

History

  • 2016-06-09: Created
  • 2020-05-06: Updated to Visual Studio 2019

Status

ProjectCompileLinkingTested on Target
OKOKOK2016-06-09

Description

  • SOC: n/a ( WIN32 )
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • TCP master : 192.168.3.2:502
Slave #RegistersStartLength
1Holding0x000011

Notes

  • Multiple demos available.
  • demo-tcp.c shows usage of modbus/TCP.
  • This demo connects/disconnects to the stack 5 times and then disconnects automatically.
  • Holding register 0 is an incrementing counter.
  • Reads holding register from adress 5 - 10, increment them by one and store them at address 10.

History

  • 2008-10-29: Created
  • 2009-12-20: - Added new serial mode slow computers.
    • Fixed porting layer so that it works with master/slave at same time.
  • 2015-06-14: Added new WIN32 port with improved performance
  • 2020-05-06: Updated to Visual Studio 2019

    Status

ProjectCompileLinkingTested on Target
OKOKOK2008-10-29

Description

  • SOC: n/a ( WIN32 )
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • TCP master : 127.0.0.1:502
Slave #RegistersStartLength
1Holding0x000011

Notes

  • Multiple demos available.
  • demo-tcp2.c shows usage of modbus/TCP.
  • This demo connects to the stack, achieves 100 poll cycles and then disconnects automatically.
  • Holding register 0 is an incrementing counter.
  • Reads holding register from adress 5 - 10, increment them by one and store them at address 10.

History

  • 2009-12-19: Created
  • 2009-12-20: - Added new serial mode slow computers.
    • Fixed porting layer so that it works with master/slave at same time.
  • 2015-06-14: Added new WIN32 port with improved performance
  • 2020-05-06: Updated to Visual Studio 2019

    Status

ProjectCompileLinkingTested on Target
OKOKOK2009-12-19

Description

  • SOC: n/a ( WIN32 )
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • TCP master : 127.0.0.1:503
  • UDP bind address : 0.0.0.0
  • UDP listen port : -1
Slave #RegistersStartLength
255Holding0x000110

Notes

  • Multiple demos available
  • demo-udp.c shows usage of MODBUS/UDP protocol
  • This demo connects to the stack, achieves 5 poll cycles and then disconnects automatically.
  • Holding register 1 is an incrementing counter
  • Reads holding register from adress 5 - 10, increment them by one and store them at address 10.

History

  • 2011-11-17: Created
  • 2015-06-14: Added new WIN32 port with improved performance
  • 2020-05-06: Updated to Visual Studio 2019

Status

ProjectCompileLinkingTested on Target
OKOKOK2011-11-17

Description

  • SOC: n/a ( WIN32 )
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • COM7
  • RTU @ MODBUS 19200 NONE
Slave #RegistersStartLength
1Holding0x000026
1Input0x00024

Notes

  • Multiple demos available
  • This README is for demo.c project
  • Holding register 0 is an incrementing counter
  • Reads the input registers from address 2 - 5 and writes them to the holding registers at address 1 - 4
  • Reads holding register from adress 5 - 25, increment them by one and store them at address 10

History

  • 2008-06-08: Created
  • 2008-09-02: Synced with changes from improved Windows and Windows CE port
  • 2009-12-20: - Added new serial mode slow computers.
    • Fixed porting layer so that it works with master/slave at same time.
  • 2015-06-14: Added new WIN32 port with improved performance
  • 2020-05-06: Updated to Visual Studio 2019

Status

ProjectCompileLinkingTested on Target
OKOKOK2008-10-29

Description

  • SOC: n/a ( WIN32 )
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • TCP master : 127.0.0.1:503
Slave #RegistersStartlength
255Holding0x000110

Notes

  • This demo shows usage of MODBUS/UDP protocol using Dynamic Link Library ( DLL ).
  • This demo connects to the stack, achieves 5 poll cycles and then disconnects automatically.
  • Holding register 1 is an incrementing counter
  • Reads holding register from adress 5 - 10, increment them by one and store them at address 10.

History

  • 2020-06-02: Created

Status

ProjectCompileLinkingTested on Target
OKOKOK-

Description

  • SOC: ATXMEGA-128A4U
  • EvalBoard: n/a
  • Atmel Studio 7.0 / AFS
  • USARTC0 and PORTC 2/3
  • RTU / MODBUS @ 19200 NONE / Slave address : 1
RegistersStartLength
Input0x000016
Holding0x000016

Notes

Holding register 0x0000 will be reset to 0 if written, others keep their values.
Input registers 0x0000 contains 0x4545, others will contain 0x0000.

History

  • 2014-03-09: Created
  • 2020-03-24: Updated to Atmel Studio 7.0

Status

ProjectCompileLinkingTested on Target
OKOKOK2014-03-09

Description

  • SOC: AVR_ATmega168
  • EvalBoard: n/a
  • Atmel Studio 7.0
  • USART on PORTB
  • RTU / MODBUS @ 19200 NONE / Slave address : 1
RegistersStartLength
Input0x010016
Holding0x02003
Discrete0x010016

Notes

Discrete and Input registers are mirrored.
Led 0 is turned on/off when holding register 1 has a value > 0.

History

  • 2010-08-19: Created
  • 2020-04-21: Updated to Atmel Studio 7.0

    Status

ProjectCompileLinkingTested on Target
OKOKOK2010-08-19

Description

  • SOC: AVR_ATmega2560
  • EvalBoard: Arduino Atmega2560
  • Atmel Studio 7.0
  • USART on PORTB
  • RTU / MODBUS @ 19200 NONE / Slave address : 1
RegistersStartLength
Input0x010016
Holding0x02003
Discrete0x010016

Notes

Discrete and Input registers are mirrored.
Led 0 is turned on/off when holding register 1 has a value > 0.

History

  • 2020-04-23: Created

Status

ProjectCompileLinkingTested on Target
OKOKOK2020-04-23

Description

  • SOC: AVR_ATmega2561
  • EvalBoard: n/a
  • Atmel Studio 7.0
  • USART on PORTA
  • RTU / MODBUS @ 19200 NONE / Slave address : 1
RegistersStartLength
Input0x010016
Holding0x02003
Discrete0x010016

Notes

Discrete and Input registers are mirrored.
Led 0 is turned on/off when holding register 1 has a value > 0.

History

  • 2020-04-23: Created

Status

ProjectCompileLinkingTested on Target
OKOKOK2020-04-23

Description

  • SOC: AVR_ATmega32
  • EvalBoard: n/a
  • Atmel Studio 7.0
  • USART on PORTA
  • RTU / MODBUS @ 19200 NONE / Slave address : 1
RegistersStartLength
Input0x010016
Holding0x02003
Discrete0x010016

Notes

Discrete and Input registers are mirrored.
Led 0 is turned on/off when holding register 1 has a value > 0.

History

  • 2010-08-19: Created
  • 2020-04-21: Updated to Atmel Studio 7.0

    Status

ProjectCompileLinkingTested on Target
OKOKOK2010-08-19

Description

  • SOC: AVR_ATmega644P
  • EvalBoard: n/a
  • Atmel Studio 7.0
  • USART on PORTA
  • RTU / MODBUS @ 19200 NONE / Slave address : 1
RegistersStartLength
Input0x010016
Holding0x02003
Discrete0x010016

Notes

Discrete and Input registers are mirrored.
Led 0 is turned on/off when holding register 1 has a value > 0.

History

  • 2010-08-19: Created
  • 2020-04-21: Updated to Atmel Studio 7.0

    Status

ProjectCompileLinkingTested on Target
OKOKOK2010-08-19

Description

  • SOC: MKE06Z128VLK4
  • EvalBoard: NXP FRDM-KE06Z
  • Kinetis Design Studio 3.X / FreeRTOS
  • PE UART
  • RTU / RS485 @ 38400 odd / Slave address : 1
RegistersStartLength
Input0x000032
Holding0x000032

Notes

  • On startup a new thread defined in modbus.cpp is started.
    It creates a new instance of a subclass of mbrtuslave. The subclass
    implements the appropriate register callbacks which are called whenever
    a MODBUS master reads or writes a specific set of registers. The
    default implementation return an exception.
  • For adapting to a specific platform the following steps have to be
    taken :

    • mbportserial.c: If required add direction pin control for the RS485
      driver enable pin. The demo already contains this and the pin is
      mapped to PTE5.
    • mbportserial.c: The function uses the port argument
      to initialize the appropriate serial device.

History

  • 2019-07-14: Created
  • 2019-12-29:
    • Fixed bug with 7 databits
    • Fixed bug with return value in timer callback missing
    • Fixed missing return value in poll
    • Update PE Components to Components

Status

ProjectCompileLinkingTested on Target
OKOKOK2019-07-14

Description

  • SOC: LPC1758
  • EvalBoard: n/a
  • LPCXpresso v8.2.2_650 / FreeRTOS
  • TCP slave 1 : 0.0.0.0:502
  • RTU slave 2: UART1 / @ 38400 NONE / Slave address : 1
RegistersStartLength
Holding0x02003
Input0x010016

Notes

  • Input register 0 is an incrementing counter.
  • LED0 is a blinking LED.

History

  • 2010-12-19: Created
  • 2014-08-18: Merged with new lwIP port supporting TCP keepalive
  • 2020-06-05: Updated to LPCXpresso v8.2.2_650

Status

ProjectCompileLinkingTested on Target
OKOKOK2010-12-19

Description

  • SOC: MSP430F169
  • EvalBoard: n/a
  • IAR Embedded Workbench 8.4
  • USART0
  • RTU / MODBUS @ 38400 NONE / Slave address : 1
RegistersStartLength
Input0x010016
Holding0x02003
Discrete0x010016

Notes

Discrete and Input registers are mirrored.

History

  • 2008-09-21: Created
  • 2020-04-24: Updated to IAR Embedded Workbench 8.4

Status

ProjectCompileLinkingTested on Target
OKOKOK2008-09-21

Description

  • SOC: PIC18F45K22
  • EvalBoard: n/a
  • MPLAB X IDE v5.35
  • EUSART on PORTA
  • RTU / MODBUS @ 19200 NONE / Slave address : 1
RegistersStartLength
Input0x010016
Holding0x02003
Discrete0x010016

Notes

Discrete and Input registers are mirrored.
Led 0 is turned on/off when holding register 1 has a value > 0.

History

  • 2010-12-08: Created
  • 2010-12-27: Updated Configuration Bits and Project file.
  • 2020-04-24: Updated to MPLAB X IDE v5.35

Status

ProjectCompileLinkingTested on Target
OKOKOK2010-12-08

Description

  • SOC: PIC18F8722
  • EvalBoard: n/a
  • MPLAB X IDE v5.35
  • EUSART on PORTA
  • RTU / MODBUS @ 19200 NONE / Slave address : 1
RegistersStartLength
Input0x010016
Holding0x02003
Discrete0x010016

Notes

Discrete and Input registers are mirrored.
Led 0 is turned on/off when holding register 1 has a value > 0.

History

  • 2010-12-08: Created
  • 2010-12-27: Updated Configuration Bits and Project file.
  • 2020-04-24: Updated to MPLAB X IDE v5.35

Status

ProjectCompileLinkingTested on Target
OKOKOK2010-12-08

Description

  • SOC: PIC32MX795F512L
  • EvalBoard: n/a
  • MPLAB X IDE v5.35
  • UART2
  • RTU / MODBUS @ 19200 NONE / Slave address : 1
RegistersStartLength
Input0x010016
Holding0x02003
Discrete0x010016

Notes

Discrete and Input registers are mirrored.
Led 0 is turned on/off when bTurnOn variable has a value > 0.

History

  • 2010-11-14: Created
  • 2020-04-27: Updated to MPLAB X IDE v5.35

Status

ProjectCompileLinkingTested on Target
OKOKOK2010-11-14

Description

  • SOC: PIC32MX795F512L
  • EvalBoard: n/a
  • MPLAB X IDE v5.35 / FreeRTOS
  • Gateway
    • Master : UART2 / RTU / MODBUS @ 38400 NONE
    • Slave : TCP / Slave address : 0.0.0.0 : 502
RegistersStartLength
Input0x010032
Holding0x020032

Notes

Led is regularily toggled. Device acts as gateway.

History

  • 2011-05-01: Created
  • 2012-06-21: Made locking works with interrupt priorities
  • 2020-04-27: Updated to MPLAB X IDE v5.35

Status

ProjectCompileLinkingTested on Target
OKOKOK2011-05-01

Description

  • SOC: STM32F429ZI
  • EvalBoard: NUCLEO-STM32F429ZI
  • Zephyr SDK
  • USART6 using IRQ
  • RTU @ 19200 EVEN / Slave address : 1
RegistersStartLength
Input0x010016
Holding0x020016

Notes

Install Zephyr-SDK using:
https://docs.zephyrproject.org/latest/getting_started/

Compile with:
west build -p auto ./

Flash with:
west flash

Running on other boards:
change set(BOARD nucleo_f429zi) in CMakeLists.txt to your board
change prj.conf for UART support on the new board
change port/mbportserial.c:86 to the correct UART label

History

  • 2020-09-25: Created

Status

ProjectCompileLinkingTested on Target
OKOKOK2020-09-25

Description

  • SOC: STM32L072
  • EvalBoard: n/a
  • Keil MDK-ARM 5.29 / FreeRTOS
  • USART4 using DMA
  • RTU / ASCII @ 38400 ODD / Slave address : 1
RegistersStartLength
Input0x010016
Holding0x020016

Notes

Please use ARM Compiler Toolchain V4.0.677 or later!
The project is reinitialized when a 0 value is written in holding register 0.

History

  • 2016-08-27: Created
  • 2017-03-07 : Added STM32/CubeMx bugfixes
  • 2020-03-24: Updated to Keil ARM 5.29

Status

ProjectCompileLinkingTested on Target
OKOKOK2016-08-27

Description

  • SOC: n/a
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • COM1
  • RTU / MODBUS @ 19200 NONE / Slave address : 1
  • Implements a custom function code
RegistersStartLength
---

Notes

  • Multiple demos available
  • demo-custom.c shows implementation of a custom function code (fc=65)

History

  • 2016-03-22: Created
  • 2018-06-24: Updated to Visual Studio 2017
  • 2020-03-18: Updated to Visual Studio 2019

Status

ProjectCompileLinkingTested on Target
OKOKOK2016-03-22

Description

  • SOC: n/a
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • COM8
  • RTU / MODBUS @ 19200 NONE / Slave address : 1
RegistersStartLength
Input0x0100128
Holding0x0200128
Coils0x000016

Notes

  • Multiple demos available
  • demo-diag.c implements MODBUS Diagnostics (fc=0x08)
  • Input Register 0 is an incrementing counter

History

  • 2016-03-22: Created
  • 2018-06-24: Updated to Visual Studio 2017
  • 2020-03-18: Updated to Visual Studio 2019

Status

ProjectCompileLinkingTested on Target
OKOKOK2016-03-22

Description

  • SOC: n/a
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • TCP slave 1: 127.0.0.1:501
  • RTU slave 2: COM1 / RS232 @ 19200 NONE / Slave address : 1
For both slaves:RegistersStartLength
Input0x010016
Holding0x02003

Notes

  • Multiple demos available
  • demo-multi-tcp-rtu.c shows running a TCP and a RTU in parallel in the same application
  • Input Register 0 for both slaves are incrementing counters

History

  • 2016-03-22: Created
  • 2018-06-24: Updated to Visual Studio 2017
  • 2020-03-18: Updated to Visual Studio 2019

Status

ProjectCompileLinkingTested on Target
OKOKOK2016-03-22

Description

  • SOC: n/a
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • TCP slave 1: 127.0.0.1:501
  • TCP slave 2: 127.0.0.1:502
For both slaves:RegistersStartLength
Input0x010016
Holding0x02003

Notes

  • Multiple demos available
  • demo-multi.c demonstrates two instances of the stack running simultaneously.
  • Input Register 0 for both slaves are incrementing counters

History

  • 2016-03-22: Created
  • 2018-06-24: Updated to Visual Studio 2017
  • 2020-03-18: Updated to Visual Studio 2019

Status

ProjectCompileLinkingTested on Target
OKOKOK2016-03-22

Description

  • SOC: n/a
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • TCP slave : 127.0.0.1:502
RegistersStartLength
Input0x010016
Holding0x02003
Discrete0x010016

Notes

  • Multiple demos available.
  • demo-tcp-context.c shows using an API extension where you can pass context through the stack
  • Input register 0 is an incrementing counter.
  • Discrete and Input registers are mirrored.

History

  • 2016-03-22: Created
  • 2018-06-24: Updated to Visual Studio 2017
  • 2020-03-18: Updated to Visual Studio 2019

Status

ProjectCompileLinkingTested on Target
OKOKOK2016-03-22

Description

  • SOC: n/a
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • TCP slave : 0.0.0.0:502
RegistersStartLength
Input0x010016
Holding0x02003
Discrete0x010016

Notes

  • Multiple demos available.
  • demo-tcp.c shows usage of modbus/TCP.
  • Input register 0 is an incrementing counter.
  • Discrete and Input registers are mirrored.

History

  • 2016-03-22: Created
  • 2018-06-24: Updated to Visual Studio 2017
  • 2020-03-18: Updated to Visual Studio 2019

Status

ProjectCompileLinkingTested on Target
OKOKOK2016-03-22

Description

  • SOC: n/a
  • EvalBoard: n/a
  • Visual Studio 2019 / Windows
  • COM20
  • RTU / MODBUS @ 19200 NONE / Slave address : 1
RegistersStartLength
Input0x0100128
Holding0x0200128
Discrete0x0100128

Notes

  • Multiple demos available.
  • demo.c shows most basic usage of the stack.
  • Discrete and Input registers are mirrored.
  • Input register 0 is an incrementing counter.

History

  • 2016-03-22: Created
  • 2018-06-24: Updated to Visual Studio 2017
  • 2020-04-28: Updated to Visual Studio 2019

Status

ProjectCompileLinkingTested on Target
OKOKOK2016-03-22

Licence agreement and documentation

License Agreement


MODBUS Master Documentation
 
MODBUS Slave Documentation

Do you have questions?

  • This field is for validation purposes and should be left unchanged.