|
The M850 has the facility to re-order its Modbus
3X registers to suit an existing Modbus network.
The integrated register re-ordering function ('Registers' button)
in the System Monitor Program
provides an easy method of achieving this.
If System Monitor isn't going to be used, Modbus function code 42h
(66) can be used to request this data and Modbus function code 41h
(65) can be used to send a string of data to set the order of the
registers. The order will automatically be saved in FLASH.
UNLIKE THE 3X AND 4X REGISTERS, THESE DATA ARE WORD WIDE INTEGER.
It is important to remember that each register in the packet's
data field contains two references to the registers to be re-ordered.
A sample read packet will look like this:-
[Node][42][start address(always 0000h)][No. of Double Registers
Required][CRC(2 bytes)]
e.g. To read the 41 Modbus registers in node 23h a request to send
21 (15h) registers is made:-
[23h][42h][0000h][0015h][CRC(2 bytes)]
A sample write packet will look like this:-
[Node][41][start address(always 0000h)][No. of Double Registers][Data
length in bytes] [REGISTERS][CRC(2 bytes)]
e.g. To set the 41 Modbus registers to their default order in node
23h:-
[23h][41h][0000h][0015h][29h][0102h][0304h][0506h][0708h][090Ah][0B0Ch][0D0Eh]
[0F10h][1112h][1314h][1516h][1718h][191Ah][1B1Ch][1D1Eh][1F20h][2122h]
[2324h][2526h][2728h][29xx][CRC(2 bytes)]
N.B. xx
= don't care.
Sample Coding
WRITE
1) Set the default order
Slave Address = 1
Writing - code 65 (41 hex)
Message Packet To SLAVE
01 41 00 00 00 15 29 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E
0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21
22 23 24 25 26 27 28 29 6E 58
Response Packet From SLAVE
01 41 00 00 00 15 FC 0A
2) Move registers W Sum (position 10), VAr Sum (position
12) and VA Sum (position 11) into the first three positions in the
table so that the measurements can be retrieved from the slave by
reading just the first three registers (30001-30003 or 42001-42003).
Slave Address = 1
Writing - code 65 (41 hex)
Message Packet To SLAVE
01 41 00 00 00 15 29 0A 0C 0B 01 02 03 04 05 06 07 08
09 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
20 21 22 23 24 25 26 27 28 29 74 1E
Response Packet From SLAVE
01 41 00 00 00 15 FC OA
READ
N.B. Asking for more registers than the M850 supports will not result
in an error.
A read command will always return the maximum number of registers.
|