Function 16: Writing a number of analog outputs
Function 16 can be used to write a number of analog outputs. The first 2 analog output words are written in this example. The analog outputs start at an offset of 0x0800. Here the offset always describes a word. Offset 0x0003 writes to the fourth word in the output process image. The length indicates the number of words, and the Byte count is formed from the combination of all the bytes that are to be written.
Example: 4 words - correspond to byte count 8
The data bytes contain the values for the analog outputs. In this example, two words are to be written. The first word is to receive the value 0x7FFF, and the second word is to receive the value 0x3FFF.
Query
Byte Name | Modbus RTU | Modbus ASCII | ||
---|---|---|---|---|
Start - frame | - | - | ":" | 0x3A |
Address | 11 | 0x0B | "0B" | 0x30, 0x42 |
Function code | 16 | 0x10 | "10" | 0x31, 0x30 |
Start address high | 8 | 0x08 | "08" | 0x30, 0x38 |
Start address low | 0 | 0x00 | "00" | 0x30, 0x30 |
Length high | 0 | 0x00 | "00" | 0x30, 0x30 |
Length low | 2 | 0x02 | "02" | 0x30, 0x32 |
Byte Count | 4 | 0x04 | "04" | 0x30, 0x34 |
Date 1 byte 1 | 127 | 0x7F | "7F" | 0x37, 0x46 |
Date 1 byte 2 | 255 | 0xFF | "FF" | 0x46, 0x46 |
Date 2 byte 1 | 63 | 0x3F | "3F" | 0x33, 0x46 |
Date 2 byte 2 | 255 | 0xFF | "FF" | 0x46, 0x46 |
Error check, LRC/CRC |
| 0xCD, 0xE3 | "1B" | 0x31, 0x42 |
End - frame |
| t1-t2-t3 | CRLF | 0x0D, 0x0A |
Response
The Bus Coupler/Fieldbus Box responds with the start address and the length of the sent words.
Byte Name | Modbus RTU | Modbus ASCII | ||
---|---|---|---|---|
Start - frame | - | - | ":" | 0x3A |
Address | 11 | 0x0B | "0B" | 0x30, 0x42 |
Function code | 16 | 0x10 | "10" | 0x31, 0x30 |
Start address high | 8 | 0x08 | "08" | 0x30, 0x38 |
Start address low | 0 | 0x00 | "00" | 0x30, 0x30 |
Length high | 0 | 0x00 | "00" | 0x30, 0x30 |
Length low | 2 | 0x02 | "02" | 0x30, 0x32 |
Error check, LRC/CRC |
| 0x43, 0x02 | "DB" | 0x44, 0x42 |
End - frame |
| t1-t2-t3 | CRLF | 0x0D, 0x0A |