Overview

Purpose

The Modbus Register Map method of use directs motion behavior from a Modbus Master such as a PC or PLC. Modbus Master libraries are available across a broad number of devices and operating systems making the Modbus Register Map method the most versatile way to direct the motion controller from an external master. Support is provided to manage controller-resident procedures that can be added to the stock application using SnapTrack software.

Modbus Background

The modbus protocol was originally published by Modicon in 1979 and has become a popular industrial communication standard for many automation component vendors. Additional in- formation can be found at Modbus.org. Modbus provides a number of shared arrays between a master and slave device. To simplify the interface the only shared array used is the "holding register" array, an array of shared 16 bit registers. Adjacent array elements can be combined to form larger data types. The following data types are used in the Modbus Register Map.

- Booleans are represented by a single 16 bit register, 0 means false and nonzero is true.

- 16 bit values are represented by a single register

- 32 bit longints and 32 bit single precision numbers are held in two adjacent registers

- 64 bit double precision floating point values are held in 4 adjacent registers

It is assumed that the master API library being used has the ability to read and write to a 16 bit modbus holding register (commonly called the 4XXXX area). It is common for these libraries to also support directly reading and writing singles and doubles. Not all masters can support the larger data types. To support masters with data size limitations the Modbus Register Map program is also available in forms with reduced resolutions that support maximum data sizes of 32 bits and 16 bits.

There are sometimes implementation differences regarding register order for multiple register data types. This method uses the "little Endian" convention where the low register is at the indicated address and the high registers are at the higher addresses.

There are sometimes convention differences between vendors regarding address notation. Modbus documentation usually indicates that a register is at address N, but the underlying address sent in the actual modbus data packet is N-1. Some vendors refer to address N and some refer to address N-1 creating an offset. This Modbus Register Map uses the N convention. Addresses for mulit-register data types, expressed in hexadecimal, all start on odd rather than even numbers. To help identify alignment issues there are constant registers for each data type that can be checked. If when read the value is the indicated value the register maps are aligned. If there is a discrepency then the master address may have to shift to be properly aligned.

Architectural Approach

Some Modbus Masters, such as a PC, can be very deliberate regarding register operations. The only operations that occur are ones specifically requested. Other Modbus Masters, such as PLCs, can perform register operations prior to any ladder logic intention, such as initializing all of the registers to zero before starting. This difference prompts two different policies the first being transaction based and the second being value based.

Transaction based communication accomplishes the design goal of achieve control functions with the minimum number of transactions for maximum efficiency. Although less important for the TCP/IP version, efficiency is important to the RTU serial port version. In Transaction based communication control purpose is generally expressed with where information is written. Control values are expressed by the values written to those locations. The effect of the command is immediate occurring as soon as the transaction is complete. For example, to perform a move by a certain distance, a value is written to register 181h and the move commences. However if a PLC is the master and performs an unintentional transaction, such as register initialization, then registers will be written with the value 0. Register 185h is used to initiate an absolute move. The initialization procedure would create inadvertent motion. To resolve this issue value based communication can be used where registers are loaded but nothing happens until a specific value is written into the Go register. Accomplishing a move in this method requires writing parameters and then writing the Go value, several transactions to do what can be done with a single transaction in transaction based control.

An important consideration for this transaction-initiated approach in contrast to a value initiated approach is that some PLCs manipulate modbus registers prior to any ladder program intention, such as initializing all of the registers to zero. Writing a zero to register 0185h, the absolute move register, commences a move to coordinate 0. To suppress the effects of these unintended transactions there's a register at location 01h named "Communication State". If the value of this register is 0 all other register commands are ignored. A value of 1 must first be written to this register to enable operation of the rest of the memory map.