Skip to content

dadahellohello/Modbus

Repository files navigation

Modbus Protocol

Copyright (c) 2016 - 2017 Keith Cullen

Test Applications

To test the PDU library

$ cd test_mb_pdu

$ make

$ ./test_mb_pdu

To test the RTU ADU library

$ cd test_mb_rtu_adu

$ make

$ ./test_mb_rtu_adu

To test the TCP ADU library

$ cd test_mb_tcp_adu

$ make

$ ./test_mb_tcp_adu

To test the IP authentication library

$ cd test_mb_ip_auth

$ make

$ ./test_mb_ip_auth

To test the RTU master/slave

$ socat -d -d pty,raw,echo=0 pty,raw,echo=0

(In a different terminal)

$ cd test_mb_rtu_slave

$ make

$ ./test_mb_rtu_slave /dev/pts/2

(In a different terminal)

$ cd test_mb_rtu_master

$ make

$ ./test_mb_rtu_master /dev/pts/3

To test the TCP client/server

$ cd test_mb_tcp_server

$ make

$ ./test_mb_tcp_server

(In a different terminal)

$ cd test_mb_tcp_client

$ make

$ ./test_mb_tcp_client

Supported Protocol Versions

Protocol VersionSupported
Modbus TCPyes
Modbus RTUyes
Modbus ASCIIno

Supported Function Codes

Function CodeSupported
(0x01) Read Coilsyes
(0x02) Read Discrete Inputsyes
(0x03) Read Holding Registersyes
(0x04) Read Input Registersyes
(0x05) Write Single Coilyes
(0x06) Write Single Registeryes
(0x07) Read Exception Status (Serial Line Only)yes
(0x08) Diagnostics (Serial Line Only)yes
(0x0b) Get Comm Event Counter (Serial Line Only)yes
(0x0c) Get Comm Event Log (Serial Line Only)yes
(0x0f) Write Multiple Coilsyes
(0x10) Write Multiple Registersyes
(0x11) Report Server ID (Serial Line Only)yes
(0x14) Read File Recordyes
(0x15) Write File Recordyes
(0x16) Mask Write Registeryes
(0x17) Read/Write Multiple Registersyes
(0x18) Read FIFO Queueyes
(0x2b) Encapsulated Interface Transportyes

Validation History

v0.1

BeagleBone Black

Debian 9.1

Linux beaglebone 4.4.88-ti-r125 #1 SMP Thu Sep 21 19:23:24 UTC 2017 armv7l GNU/Linux

HP Pavilion

Ubuntu 16.04

Linux HighCreekLinux 4.13.0-38-generic #43~16.04.1-Ubuntu SMP Wed Mar 14 17:48:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

About

An implementation of the Modbus protocol.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C99.2%
  • Makefile0.8%