User`s manual

Western Reserve Controls 1782-JDM User’s Manual
PUB 24.0
9
2.4 How to Read Modbus Device Input Data
1. Set up the poll input data field size in your Master’s scan table to be equal to or greater than the
number of bytes required for the largest Modbus message received from your device(s). (default size is
48 bytes).
2. Set up a Poll Connection (Allocate Connection Instance 2) to the 1782-JDM from the Master.
3. Configure the serial port to read input data by setting the appropriate values in the Parameter Data,
described in Section 3.6.
4. Perform a poll function to the JDM using one of the Modbus read command strings. This will contain the
“record number” in the 1
st
byte (which must be different than the last sent message), followed by the
command string as shown in the Modbus RTU specification, WITHOUT the leading colon, the
checksum, or the carriage return/linefeed. The JDM will translate this command to the proper Modbus
format, compute the checksum, add the colon, carriage return/linefeed (ascii mode), and send the
message out the serial port. The JDM will then wait for a reply from the addressed device.
5. The device’s response will be received by the JDM, which will check the checksum, and if ok will strip
the leading colon, the checksum, and the carriage return/linefeed from the message(in ascii mode), and
produce a poll response.
6. The response will include two extra bytes of data. The first byte of the response will be a “record
counter” which is a counter generated by the JDM to mark the message with a sequential count value.
Each time a new message is received at the JDM from the Modbus network, it will increment the
counter.
7. The second byte of the record will be a status byte. This is the status of the Modbus transaction. It will
be non-zero if an error occurred, or zero if OK. See Table 2-3 for specific values.
8. The response data bytes will be returned in the mapped poll response data field. The data will be in
binary format (ASCII ‘99’ = 99
etc) and will represent the complete Modbus message, less checksum /
carriage return/linefeed and the leading “:” (colon) (for ASCII mode).
A typical response is as follows:
Record count or sequence number (1 byte)
Status / error data (1 byte)
Device’s Modbus address (1 byte)
Modbus command number (1 byte)
Starting Modbus register address (2 bytes)
Number of data bytes (1 byte)
1
st
Register data (2 byes)
2
nd
Register data (2 byes)
3
rd
Register data (2 byes)