Example Of A Modbus Tcp Server - WAGO 750 Series Manual

Linux fieldbus coupler
Hide thumbs Also See for 750 Series:
Table of Contents

Advertisement

8.3 Example of a Modbus TCP Server

Program name: mb_tcp
Installation directory: /bin/mb_tcp
Source code files:
~/uclinux-dist/user/modbus/mb_tcp.h
~/uclinux-dist/user/modbus/mb_tcp.c
~/uclinux-dist/user/modbus/mbfunc.h
~/uclinux-dist/user/modbus/mbfunc.c
~/uclinux-dist/user/modbus/mbtypes.h
~/uclinux-dist/user/modbus/mbserver.h
~/uclinux-dist/user/modbus/mb_udp.c
Driver/Kernel modules: kbus.o (internal bus support)
Note
This example for a Modbus implementation does not completely comply with
the Modbus specification. It is only an example for the implementation of a
more complex program. Please find more information on MODBUS and
MODBUS definitions under:
In this example, a remote Modbus master can establish only one Modbus
TCP connection. The user space server can only manage one connection at
the same time.
Function description
This example program allows to read the state of the input modules and to set
outputs via Ethernet. The data can be accessed byte by byte or bit by bit.
The following Modbus TCP function codes are available:
Function code
FC1:
FC2:
FC3
FC4:
FC5:
FC6:
WAGO-I/O-SYSTEM 750
Linux Fieldbus Coupler
http://www.modbus.org/.
Function name
hex
0x01
Read Coils
0x02
Read Input
0x03
Read Multiple Registers
0x04
Read InputRegisters
0x05
Write Coil
0x06
Write SingleRegister
Application Examples • 175
Example of a Modbus TCP Server
Function description
Reading one single bit
Discrete reading of several input bits
Reading several input registers
Reading several input registers
Writing a single output bit
Writing a single output register

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

750-860

Table of Contents