Operating Manual V8.2/03.2017
Non Invasive Road Sensor
42
G. Lufft Mess- und Regeltechnik GmbH, Fellbach, Germany
19.3.3 Example for Creating Addresses
If, for example, you want to address a NIRS31-UMB device with the device ID 001, this takes
place as follows:
The class IDfor theNIRS31-UMB is5d = 5h
The device ID is e.g. 001d = 01h
Putting the class and device IDs together gives the address 5001h (20481d).
19.3.4 Example of a Binary Protocol Request
If, for example, a NIRS31-UMB device with the device ID 001 is to be polled from a PC for
the current road surface temperature, this takes place as follows:
Sensor:
The class ID for theNIRS31-UMB is5 = 5h
The device ID is 001 = 01h
Putting the class and device IDs together gives a target address of 5001h.
PC:
The class ID for the PC (master unit
)
is 15 = Fh
The PC ID is e.g. 001d = 01h
Putting the class and device IDs together gives a sender address of F001h.
The length <len> for the online data request command is 4d = 04h
The command for the online data request is 23h
The version number of the command is 1.0 = 10h
The channel number is in <payload>; as can be seen from the channel list (page39); the
current road surface temperature in °C in the channel is 100d = 0064h.
The calculated CRC is 75D4h.
The request to the device:
SOH <ver>
<to>
<from>
<len> STX <cmd> <verc> <channel> ETX
<cs>
EOT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
01h
10h
01h 50h 01h F0h 04h
02h
23h
10h
64h 00h 03h D4h 75h 04h
The response from the device:
SOH <ver>
<to>
<from>
<len> STX <cmd> <verc> <status> <channel> <typ>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
01h
10h
01h F0h 01h 50h 0Ah
02h
23h
10h
00h
64h 00h
16h
<value>
ETX
<cs>
EOT
15
16
17
18
19
20
21
22
8Fh 00h 45h 41h 03h 38h B1h 04h
Interpretation of the response:
<status>
= 00h device o.k. (
≠ 00h signifies error code; see page43)
<typ>
= Data type of the following value; 16h = float (4 bytes, IEEE format)
<value>
= 4145008Fh corresponds to a float value of 1.0001 = 12.3
The road surface temperature is therefore 12.3°C.
Correct data transmission can be checked with the aid of the check sum (B138h).
Note:
Little Endian (Intel, low byte first) applies when transmitting word and float variables of
addresses or the CRC, for example. This means first the low byte and then the high byte.