Specify how Winmodbus should reply to specific functions
You can add, delete and modify Function Ranges by right clicking in the top left window and selecting from the popup menu.
The function range setup window defines what messages WinModbus will attempt to answer. Each function range requires a Modbus function.
Optionally you can specify a range of addresses to restrict this message to. This is useful if you have an address map that returns data formatted differently depending on the address. e.g. you may have 100 integers followed by 100 floats, all available via function 3. As these are represented differently, they will need to be packed in the message differently and WinModus supports this by allowing you to add several Function Ranges per function. If you just have one data type no matter what the address, tick the “Any” box and this function range will be used to reply to all messages with the selected modbus function code.
When a message is received, it is tested against the function ranges from top to bottom so if more than 1 could potentially match, the topmost is used. To this end, you can move each range up and down in the list. You may want to have a resticted address range for a function, say 0 -> 1000, and then below that you could have a catch all with "Any" address set.
The address in the actual message can be between 0 and 65535 but you may want to map that to a different address in your data map. By default, address 0 in a message indicates address 0 in the data map. You can change this offset, specifying what address 0 in the message should map to in the data map, by putting that value in the “Address Offset” field.
Finally, you need to specify the format of the data you expect in the message. There are several commonly used formats in the Format Presets chooser so you should probably pick one of those. Each format has an implied byte ordering. e.g. SHORT10 expects a two byte short, MSB* first. SHORT01 is the same but LSB first. FLOAT3210 is a 4 byte float MSB first down to LSB. If none of the presets are suitable, you can manually specify the data format, addresses per item and whether to use the Count field in the message to specify the number of data items in the message, or the number of 2-byte modbus registers. e.g. If a message contains 3 floats, the count field may be set to 3 (Tick the box) or, because a float takes up two modbus registers, it may be set to 6. (Untick the box)
WinModbus recognises functions 1, 2, 3, 4, 5, 6, 15, 16, 65, 66, 67, 68. Winmodbus is currently unable to decode any function other than these and will show an error. If you poll it with one of these functions but don't have a message range defined for it, WinModbus will reply with a function exception (e.g. the function with the top bit set followed by the exception code 1)
* Most Significant Byte