If Holding registers (03) or Input registers (04) displayed:
Press F2 to edit or just start typing a new value
If Coils (01) or Discrete inputs (02) are displayed:
Press F2 to edit or just type 0, 1 or space to toggle.
Double click works like F2
05 = Write single coil
06 = Write single register
15 = Write multiple coils
16 = Write multiple registers
The top line shows the number of polls and errors.
Grid features:
- Cell selection using the mouse, with optional Control and Shift key combinations.
- Auto row or column sizing when dividers are double-clicked.
- Individual cells can have separate text and background colors.
- Individual cells can have separate fonts.
- Ctrl-C, Ctrl-X and Ctrl-V perform clipboard copy, cut and paste, and Ctrl-A for “Select All”
- OLE Drag and drop.
- F2 for edit an alias cell.
- Shift + F10 = context menu
- You can’t paste to value cells
Hints:
- Use “Save workspace” (File menu) to Saves a list of the open windows, their sizes and their positions on the screen to a workspace file so that the screen will look the same the next time you open the workspace file.
- F3 opens the connection dialog.
- F8 opens the Read/Write definition dialog.
Protocol Description
MODBUS® Protocol is a messaging structure, widely used to establish master-slave communication between intelligent devices. A MODBUS message sent from a master to a slave contains the address of the slave, the ‘command’ (e.g. ‘read register’ or ‘write register’), the data, and a check sum (LRC or CRC).
Since MODBUS protocol is just a messaging structure, it is independent of the underlying physical layer. It is traditionally implemented using RS232, RS422, or RS485
The Query
The function code in the query tells the addressed slave device what kind of action to perform. The data bytes contains any additional information that the slave will need to perform the function. For example, function code 03 will query the slave to read holding registers and respond with their contents. The data field must contain the information telling the slave which register to start at and how many registers to read. The error check field provides a method for the slave to validate the integrity of the message contents.
The Response
If the slave makes a normal response, the function code in the response is an echo of the function code in the query. The data bytes contain the data collected by the slave, such as register values or status. If an error occurs, the function code is modified to indicate that the response is an error response, and the data bytes contain a code that describes the error. The error check field allows the master to confirm that the message contents are valid.
Controllers can be setup to communicate on standard MODBUS networks using either of two transmission modes: ASCII or RTU.
ASCII Mode
When controllers are setup to communicate on a MODBUS network using ASCII (American Standard Code for Information Interchange) mode, each eight-bit byte in a message is sent as two ASCII characters. The main advantage of this mode is that it allows time intervals of up to one second to occur between characters without causing an error.
Coding System
Hexadecimal ASCII printable characters 0 … 9, A … F
Bits per Byte
1 start bit
7 data bits, least significant bit sent first
1 bit for even / odd parity-no bit for no parity
1 stop bit if parity is used-2 bits if no parity
Error Checking
Longitudinal Redundancy Check (LRC)
RTU Mode
When controllers are setup to communicate on a MODBUS network using RTU (Remote Terminal Unit) mode, each eight-bit byte in a message contains two four-bit hexadecimal characters. The main advantage of this mode is that its greater character density allows better data throughput than ASCII for the same baud rate. Each message must be transmitted in a continuous stream.
Coding System
Eight-bit binary, hexadecimal 0 … 9, A … F
Two hexadecimal characters contained in each eight-bit field of the message
Bits per Byte
1 start bit
8 data bits, least significant bit sent first
1 bit for even / odd parity-no bit for no parity
1 stop bit if parity is used-2 bits if no parity
Error Check Field
Cyclical Redundancy Check (CRC)
In ASCII mode, messages start with a colon ( : ) character (ASCII 3A hex), and end with a carriage return-line feed (CRLF) pair (ASCII 0D and 0A hex).
The allowable characters transmitted for all other fields are hexadecimal 0 … 9, A … F. Networked devices monitor the network bus continuously for the colon character. When one is received, each device decodes the next field (the address field) to find out if it is the addressed device.
Intervals of up to one second can elapse between characters within the message. If a greater interval occurs, the receiving device assumes an error has occurred. A typical message frame is shown below.
Start | Address | Function | Data | LRC | End |
: | 2 Chars | 2 Chars | N Chars | 2 Chars | CR LF |
RTU Framing
In RTU mode, messages start with a silent interval of at least 3.5 character times. This is most easily implemented as a multiple of character times at the baud rate that is being used on the network (shown as T1-T2-T3-T4 in the figure below). The first field then transmitted is the device address.
The allowable characters transmitted for all fields are hexadecimal 0 … 9, A … F. Networked devices monitor the network bus continuously, including during the silent intervals. When the first field (the address field) is received, each device decodes it to find out if it is the addressed device.
Following the last transmitted character, a similar interval of at least 3.5 character times marks the end of the message. A new message can begin after this interval.
The entire message frame must be transmitted as a continuous stream. If a silent interval of more than 1.5 character times occurs before completion of the frame, the receiving device flushes the incomplete message and assumes that the next byte will be the address field of a new message.
Similarly, if a new message begins earlier than 3.5 character times following a previous message, the receiving device will consider it a continuation of the previous message. This will set an error, as the value in the final CRC field will not be valid for the combined messages. A typical message frame is shown below.
Start | Address | Function | Data | CRC | End |
3.5 Char time | 8 Bit | 8 Bit | N * 8Bit | 16 Bit | 3.5 Char time |
Address Field
The address field of a message frame contains two characters (ASCII) or eight bits (RTU). The individual slave devices are assigned addresses in the range of 1 … 247.
Function Field
The Function Code field tells the addressed slave what function to perform.
The following functions are supported by Modbus poll.
01 READ COIL STATUS
02 READ INPUT STATUS
03 READ HOLDING REGISTERS
04 READ INPUT REGISTERS
05 WRITE SINGLE COIL
06 WRITE SINGLE REGISTER
15 WRITE MULTIPLE COILS
16 WRITE MULTIPLE REGISTERS
22 MASK WRITE REGISTER
23 READ/WRITE REGISTERS
The data field contains the requested or send data.
Contents of the Error Checking Field
Two kinds of error-checking methods are used for standard MODBUS networks. The error checking field contents depend upon the method that is being used.
ASCII
When ASCII mode is used for character framing, the error-checking field contains two ASCII characters. The error check characters are the result of a Longitudinal Redundancy Check (LRC) calculation that is performed on the message contents, exclusive of the beginning colon and terminating CRLF characters.
The LRC characters are appended to the message as the last field preceding the CRLF characters.
LRC Example Code
RTU
When RTU mode is used for character framing, the error-checking field contains a 16-bit value implemented as two eight-bit bytes. The error check value is the result of a Cyclical Redundancy Check calculation performed on the message contents.
The CRC field is appended to the message as the last field in the message. When this is done, the low-order byte of the field is appended first, followed by the high-order byte. The CRC high-order byte is the last byte to be sent in the message.
CRC Example Code
Leave a reply