Read analog inputs (function 4) – BECKHOFF BC7300 User Manual
Page 29
BC7300
29
Query
Byte Name
Example
RTU
ASCII
Start frame
„:“
0x3A
Slave address 11
0x0B
„0B“
0x30, 0x42
Function code 3
0x03
„03“
0x30, 0x33
Start address high 8
0x08
„08“
0x30, 0x38
Start address low 0
0x00
„00“
0x30, 0x30
Count high 0
0x00
„00“
0x30, 0x30
Count low 2
0x02
„02“
0x30, 0x32
Error Check
LRC / CRC
0xC6
0xC1
„E8“
0x45, 0x38
End of frame
t1-t2-t3
CRLF
0xD, 0xA
Response
The Bus Terminal Controller answers with byte count 4, i.e. 4 bytes of data
are returned. The query was for 2 analog channels, and these are now
distributed over 2 words. In the analog output process image, the first
channel has the value 0x3FFF, while the second channel has the value
0x0.
Byte Name
Example
RTU
ASCII
Start frame
„:“
0x3A
Slave address 11
0x0B
„0B“
0x30, 0x42
Function code 3
0x03
„03“
0x30, 0x31
Count byte 4
0x04
„04“
0x30, 0x30
Data 1 high byte 63
0x3F
„3F“
0x33, 0x46
Data 1 low byte 255
0xFF
„FF“
0x46, 0x46
Data 2 high byte 0
0x00
„00“
0x30, 0x30
Data 2 low byte 0
0x00
„00“
0x30, 0x30
Error Check
LRC / CRC
0xC6
0xC1
„B0“
0x42, 0x30
End of frame
t1-t2-t3
CRLF
0xD, 0xA
Read Analog Inputs (Function 4)
READ INPUT REGISTER
Function 4 is used to read the analog inputs.
In this example the first two analog inputs of slave number 11 are read.
The analog outputs begin at offset 0x0000 (hex). The length indicates the
number of words to be read. A KL3002 has 2 words of input data, which is
why the value to be entered in "Count low" is two.
Query
Byte Name
Example
RTU
ASCII
Start frame
„:“
0x3A
Slave address 11
0x0B
„0B“
0x30, 0x42
Function code 4
0x04
„04“
0x30, 0x34
Start address high 0
0x00
„00“
0x30, 0x30
Start address low 0
0x00
„00“
0x30, 0x30
Count high 0
0x00
„00“
0x30, 0x30
Count low 2
0x02
„02“
0x30, 0x32
Error Check
LRC / CRC
0x71
0x61
„EF“
0x45, 0x46
End of frame
t1-t2-t3
CRLF
0xD, 0xA
Response
The Bus Terminal Controller answers with byte count 4, i.e. 4 bytes of data
are returned. The query was for 2 analog channels, and these will now be