Chapter 6. Serial I/O, SNP & RTU Protocols
GFK-2222AD
April 2018
239
Message (04): Read Analog Inputs
Format:
Address
Starting
Analog Input
No.
Number of
Analog
Inputs
Error
Check
Func
04
Query
Hi
Hi
Lo
Lo
Address
Data
Error
Check
Func
04
Normal Response
Byte
Count
First
Analog
Input
No.
Hi
Hi
Lo
Lo
Figure 55: RTU Read Analog Inputs Message Format
Query:
▪
An Address of 0 is not allowed as this request cannot be a broadcast request.
▪
The function code is equal to 4.
▪
The Starting Analog Input Number is two bytes in length. The Starting Analog Input Number may be
any value less than the highest analog input number available in the attached CPU. It is equal to one
less than the number of the first analog input returned in the normal response to this request.
▪
The Number of Analog Inputs value is two bytes in length. It must contain a value from 1 to 125
inclusive. The sum of the Starting Analog Input value and the Number of Analog Inputs value must
be less than or equal to the highest analog input number available in the at-attached CPU. The high
order byte of the Starting Analog Input Number and Number of Analog Inputs fields is sent as the
first byte in each of these fields. The low order byte is the second byte in each of these fields.
Response:
▪
The Byte Count is a binary number from 2 to 250 inclusive. It is the number of bytes in the normal
response following the byte count and preceding the error check. Note that the Byte Count is equal
to two times the number of analog inputs returned in the response. A maximum of 250 bytes (125)
analog inputs is set so that the entire response can fit into one 256-byte data block.
▪
The analog inputs are returned in the Data field in order of number with the lowest number analog
input in the first two bytes and the highest number analog input in the last two bytes of the Data
field. The number of the First Analog Input in the Data field is equal to the Starting analog input
number plus one. The high order byte is sent before the low order byte of each analog input.