FabyaVisionUser Manual
/

Modbus drivers (TCP, RTU, ASCII)

14 min readCommunication

Reading and writing coils and registers with Modicon addresses in Modbus TCP (Ethernet), Modbus RTU and Modbus ASCII (RS-485 / RS-232 serial line) devices; unit ID, byte order and serial port settings.

When to use it

There are three Modbus drivers. Addresses, data types, byte order and read / write rules are the same in all three; only the transport differs:

DriverWhenConnection address
Modbus TCPThe device is a Modbus TCP server over Ethernet (or there is a gateway that converts the serial line to Ethernet)IP address, port 502
Modbus RTU (serial)The device speaks Modbus RTU on an RS-485 / RS-232 line (the most common serial format)COM port (COM3), no port
Modbus ASCII (serial)The device speaks Modbus ASCII on a serial line (the frame starts with : and ends with CR LF)COM port, no port

Addresses are written in Modicon notation: 40001 is the first holding register; its address in the protocol is 0.

Prerequisites on the device side

  • For Modbus TCP, the Modbus TCP server must be enabled on the device (default port 502).
  • Find out the device's unit ID (Unit ID, slave address) and its address map. Each device behind a gateway or on a serial line is distinguished by its own address; for a single device it is usually 1.
  • Does the address in the device documentation give a 1-based Modicon address (40001) or a 0-based protocol address (0)? If it is the latter, enter the table digit and documentation address + 1 in Studio: a holding register with protocol address 100 becomes 40101.
  • Find out the order in which 32-bit values are held in the two registers (32-bit byte order below).
  • For a serial line, also find out the device's baud rate, parity, data bits and stop bits.

Setting up a Modbus TCP connection

  1. Add a connection

    In the Connections section: Add, driver Modbus TCP. Enter the IP address; port 502 is filled in.

  2. Unit ID and byte order
    Parameters of the Modbus TCP connection: unit ID and 32-bit byte order.
    Parameters of the Modbus TCP connection: unit ID and 32-bit byte order.

    Unit ID 0 – 255 (default 1). Options of 32-bit byte order: ABCD — big-endian (default), CDAB — word swapped, BADC — byte swapped, DCBA — little-endian. 16-bit values are always big-endian, as in the Modbus standard.

  3. Add a tag

    Enter the Modicon address as the tag address. The address is validated against the data type of the tag (Tag addresses).

  4. Test the byte order

    If the value of a 32-bit Real or DInt tag differs greatly from what is expected (e.g. a very large or very small number), change the byte order. To do this, store a known value (e.g. 1.0) in the device and try the options until the correct value appears.

Modbus RTU and ASCII (serial line)

The serial drivers use a COM port of the Live computer: the computer's own serial port or a USB – RS-485 / RS-232 converter. The Live computer is the master of the line; the devices answer the requests.

  1. Find the COM port

    In Windows, look up the port number of the converter under Device Manager›Ports (COM and LPT) (e.g. COM3).

  2. Add a connection

    Add, driver Modbus RTU (serial) or Modbus ASCII (serial). Enter the serial port in the IP address / computer name cell (COM3; com 3 is also corrected to COM3). The Port cell is locked.

  3. Device address and serial settings

    Device address (slave ID) 1 – 247 (default 1). Speed (baud) 1200 – 115200 (default 9600), Parity None (N), Even (E) (default) or Odd (O), Data bits 7 or 8, Stop bits 1 or 2. The default setting is 9600 8E1 for RTU and 9600 7E1 for ASCII. With RTU the data bits must be 8. All values must match the setting in the device.

    Modbus RTU connection: address COM3, device address 1, 9600 8E1; the Target card summarizes the serial settings.1234
    Modbus RTU connection: address COM3, device address 1, 9600 8E1; the Target card summarizes the serial settings.
    1. Address — for a serial driver, the COM port (COM3); the port field is locked.
    2. Device address (slave ID) — 1 – 247; different for each device on the line.
    3. Speed, parity, data bits, stop bits — the same as on the device and on all connections on the same port.
    4. Target — port · serial settings · device address.
  4. Set the timeout

    Timeout (ms) is the time allowed for the device to start responding; Live adds the transmission time of the request and the response on the line. Long blocks at low speed therefore do not time out.

  5. Add a tag

    Addresses and types are the same as for Modbus TCP (tables below).

Several devices on one line

Create a separate connection for each device on the same RS-485 line: their address is the same COM port, their Device address values differ. Live opens the port once and shares it among the connections; only one query is on the line at a time, and requests are sent one after another. Therefore, the more devices on a line, the longer the read interval of each device.

Connections that use the same port must have the same Modbus type (RTU or ASCII), speed, parity, data bits and stop bits. If they differ, Studio reports an error in Problems; in Live the second connection is not established and shows the error message. A connection with Enabled off does not open the port and is not checked.

A second connection that uses the same COM3 port at a different speed gives an error in the Problems list.
A second connection that uses the same COM3 port at a different speed gives an error in the Problems list.
  • RTU frames are checked with a CRC; between two frames the line is kept silent for at least 3.5 character times (1.75 ms above 19200 baud). ASCII frames are checked with an LRC.
  • When a corrupt frame arrives, the remaining bytes on the line are discarded and the connection is re-established. If the USB converter is unplugged, all connections on the same port drop and Live tries to reopen the port.
  • Online›Test connections… does not test serial connections; it counts them as skipped. A serial connection can only be tried in Live.

Address ranges and register usage

FormatTableData typeWrite
0xxxx (e.g. 00001)CoilBoolPerformed
1xxxx (e.g. 10001)Discrete inputBoolRead-only
3xxxx (e.g. 30001)Input registerregister typesRead-only
4xxxx (e.g. 40001)Holding registerregister typesPerformed
4xxxx.b (e.g. 40001.5)Bit of the register (b = 0 – 15)BoolPerformed (the register is read, the bit is changed and the register is written back)
4xxxxx (e.g. 400001)Six-digit notation: 400001 – 465536register typesPerformed

The first digit gives the table; the remaining four or five digits give the sequence number (1 – 65536). Each type occupies the following number of registers; the address of the tag is the first register:

TypeNumber of registers
Bool, Int, UInt1
DInt, UDInt, Real2 (e.g. 40001 and 40002)
LReal4
String2 characters per register: half the number of characters in the Length field (rounded up); default length 32, maximum 254

No bit number is written in coil and discrete input addresses; if Bool is given for a register address, the bit number is mandatory. The Byte and SInt types do not exist in the Modbus drivers.

Read and write

  • Nearby tags in the same table are read in a single request: at most 125 registers or 2000 coils; gaps of at most 8 registers (64 for coils) between them are merged. If the device rejects a read with gaps, the driver from then on merges only adjacent tags.
  • If the device rejects a request, the tags in that block are read one by one; only the problematic tag gets an error.
  • Writing is done with a write single coil request for a coil, a write single register request for a single register, and a write multiple registers request for multi-register values.

Driver reference

The parameters, address formats and examples of Modbus ASCII are the same as for Modbus RTU; the driver ID is modbus-ascii and the default for Data bits is 7.

Modbus TCP

Addresses are written in Modicon notation: 40001 is the first holding register (protocol address 0). 32-bit types use two consecutive registers.

Driver ID
modbus (name in the project file)
Connection
An IP address / computer name and a port are required (default port 502)
Data types
Bool Int UInt DInt UDInt Real LReal String

Connection parameters

Appears in the Inspector window when a connection is selected.

ParameterTypeDefaultDescription
Unit IDnumber (0 – 255)1
32-bit byte orderchoiceABCD — big-endian
ABCD — big-endian · CDAB — word-swapped · BADC — byte-swapped · DCBA — little-endian
Arbiter address (Int)text—In a redundant server pair the master writes an incrementing counter to this address every second. It must be a writable Int address not used for anything else in the PLC program. Empty = this PLC is not an arbiter.

Address formats

FormatMeaning
0xxxxCoil — Bool
1xxxxDiscrete input — Bool, read-only
3xxxxInput register — read-only
4xxxxHolding register
4xxxx.bBit of a register (b = 0 – 15) — Bool
4xxxxxSix-digit notation: 400001 – 465536

Sample addresses

Data typeExamples
Bool00001   10001   40001.0
Other types40001   30001   400001

Modbus RTU (serial)

Modbus RTU over an RS-485 / RS-232 serial port. The connection's address is the serial port (e.g. COM3). A separate connection is opened for each device on the same line; connections that use the same port must have the same serial port settings. Tag addresses are the same as in Modbus TCP: 40001 is the first holding register.

Driver ID
modbus-rtu (name in the project file)
Connection
The COM port is entered in the address column (e.g. COM3); speed, parity, data bits and stop bits are connection parameters
Data types
Bool Int UInt DInt UDInt Real LReal String
Same port
Connections with the same settings share a COM port (several devices on an RS-485 line); a second connection with different settings gives an error.

Connection parameters

Appears in the Inspector window when a connection is selected.

ParameterTypeDefaultDescription
Device address (slave ID)number (1 – 247)1The device's Modbus address. Each device on the same RS-485 line has a different address; a separate connection is opened for each device.
32-bit byte orderchoiceABCD — big-endian
ABCD — big-endian · CDAB — word-swapped · BADC — byte-swapped · DCBA — little-endian
Speed (baud)choice9600Baud rate, parity, data bits and stop bits must match the device settings. They are also the same in all connections that use the same serial port.
1200 · 2400 · 4800 · 9600 · 19200 · 38400 · 57600 · 115200
ParitychoiceEven (E)
None (N) · Even (E) · Odd (O)
Data bitschoice8
7 · 8
Stop bitschoice1
1 · 2
Arbiter address (Int)text—In a redundant server pair the master writes an incrementing counter to this address every second. It must be a writable Int address not used for anything else in the PLC program. Empty = this PLC is not an arbiter.

Address formats

FormatMeaning
0xxxxCoil — Bool
1xxxxDiscrete input — Bool, read-only
3xxxxInput register — read-only
4xxxxHolding register
4xxxx.bBit of a register (b = 0 – 15) — Bool
4xxxxxSix-digit notation: 400001 – 465536

Sample addresses

Data typeExamples
Bool00001   10001   40001.0
Other types40001   30001   400001

Common errors

The marker at the start of each line tells where the message will appear in Live: [connection] in the Connections section of the system menu; [write] in the notification window of the operator who performed the write; [Studio] in the address cell in Studio or in the Problems list. [tag] is a tag error during reading: the tag is left with bad quality, the text of the message is not shown in Live in this version (Tag errors); read the text to understand the cause.

MessageCause and solution
[tag] This address does not exist in the device (Modbus exception 02: illegal address).The device does not recognize this register or coil. Check the address map and the 0-based / 1-based difference.
[tag] The device does not support this function (Modbus exception 01).The device does not offer this type of access (e.g. writing a coil).
[write] The device did not accept the value (Modbus exception 03: illegal value).The value written is not within the range the device allows.
[tag] Ağ geçidi hedef cihaza ulaşamadı (Modbus istisnası 0A). (or 0B)The gateway cannot reach the device with the unit ID; check the unit ID and the serial line.
[write] Giriş yazmacı salt okunurdur; yazılamaz. · Ayrık giriş salt okunurdur; yazılamaz.1xxxx and 3xxxx addresses cannot be written to; use 4xxxx for a value that has to be writable.
[Studio] For the Bool type, specify a register bit (e.g. 40001.0) or use a coil address (0xxxx).Studio address cell: the register address for a Bool tag was given without a bit number.
[connection] Cihaz 2000 ms içinde yanıt vermedi (192.168.0.20:502). … · The device did not respond (timeout).On TCP: the network, the port or the device; for devices behind a gateway, increase the Timeout. On a serial line: the device address, baud rate / parity, the cable (A / B wires on RS-485) or the device being switched off.
[connection] Geçersiz Modbus yanıtı (…)The response does not match the frame; the connection is closed and re-established. On a serial line (CRC hatalı), (LRC hatalı) or (cihaz adresi uyuşmuyor): wrong baud rate / parity, interference on the line, or two devices at the same address.
[connection] COM3 bulunamadı: bu bilgisayarda böyle bir seri port yok. Aygıt Yöneticisi › Bağlantı noktaları (COM ve LPT) listesine bakın.The port number is wrong or the converter is not plugged in.
[connection] COM3 açılamadı: port başka bir programda açık ya da erişim reddedildi.Close any other program that is using the port (the device's configuration software, a terminal program).
[connection] COM3 başka bir bağlantıda farklı ayarla açık (RTU 9600 8E1; bu bağlantı: RTU 19200 8E1). …The connections on the same port have different serial settings; make them all the same.
[connection] COM3 seri portu ile bağlantı koptu (kablo ya da USB seri çevirici çıkarılmış olabilir).Plug the converter in; the driver retries automatically.
[Studio] Modbus RTU requires 8 data bits (7 data bits are used only in Modbus ASCII).Data bits 7 is selected on an RTU connection. In the same situation, Live does not establish the connection.

Tips and limits

Related topics

FabyaVision 1.2.1 User Manual · 2 November 2026© Fabyatek Yazılım Bilişim Teknolojileri Ltd. Şti.