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

The software design achieves 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. Control purpose is generally expressed with where information is written. Control values are expressed by the values written to those locations. For example, to perform a move by a certain distance, a value is written to register 181h and the move commences based on the values already in the speed and acceleration registers. Writing to the speed register during the move will dynamically change to the new speed setting during motion.

Some Modbus Master methods, such as a library for use with a PC application, are very deliberate in the sense that every modbus transaction is specified by the application program. We can refer to motion produced by this type of master communication as transaction-initiated. 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. There may be other cases where registers are written without deliberate intention. To suppress the effects of these unintentional writes there's a register at location 01h named "Communication State". If the value of this register is 0 all other register writes are ignored. A value of 1 must first be written to this register to enable writes operations of the rest of the memory map. Registers can always be read regardless of the Communication State.