Address
3X
(F04)
Address
4X
(F03)
Number of
measuring
channel
Data address
for measuring
channel
Data description
Attribute
Value
30656
40656
63
655
serial number SN-C63-B0-B1
R
16-bit register
7.2. FRAME STRUCTURE OF MODBUS-RTU PROTOCOL
Device address (1-byte)
Function (1-byte) Data (n-bytes)
CRC-16Lo (1-byte)
CRC-16Hi (1-byte)
7.3. USED FUNCTIONS OF MODBUS-RTU PROTOCOL
Function code
Description
03 (0x03)
Readout of measurement value and measuring channel condition
04 (0x04)
Readout of measurement value and measuring channel condition
7.3.1. READOUT OF THE VALUES FROM THE MEASUREMENT CHANNELS
7.3.1.1. FUNCTION 0x03 / 0x04 – READOUT OF TEMPERATURE FROM MEASURING
CHANNEL [4X / 3X-REFERENCES]
Function 0x03 / 0x04 are used for readout of the value from measuring channel (sensor).
The mesurement value from measuring channel (sensor) is presented by a 16-bit register.
The registers with measuring value are in the format of 16-bit signed integer (C/C++ type short int).
The real value of temperature in °C (-55 – +125 [°C]) obtained from the read register according to below algorithm by use appropriate
factor value
DW=100
(table below):
Measured/ adjusted Value
Unit of
measurement
DW factor
value
Measured/ adjusted Value
Unit of
measurement
DW factor
value
Temperature
°C
100
PT1000 sensor's temperature
°C PT1000
10
Relative humidity
%RH
10
0-10VDC transducer
V U10
100
Lighting (natural or unnatural)
%Lux
10
0-20mADC transducer
mA A20
100
Sunlight
%SLux
10
Circuit DS2401 serial number S/N
non
Temperature adjuster
(TA)°C
10
Percentage adjuster
(PA)%
10
Atmospheric pressure
hPa
10
CO2 concentration (in preparation)
CO2 ppm
1
PT100 sensor's temperature
°C PT100
10
PT500 sensor's temperature
°C PT500
10
Algorithm 1.
Readout register is saved to regular type variable (float) and then divide it by the factor
DW
// Fragment of code in C language (VS6.0) presenting above algorithm
short int siMeasurementReg;
float fMeasurmentValue
......
fMeasurmentValue = (float)siMeasurementRegister;
fMeasurmentValue = fMeasurmentValue /
DW
;
Algorithm 2.
Readout register is saved to regular type variable 16-bit (short int) and then divide by the factor
DW
, received change
of the dividing it is a number of the hundredth parts of the measurement value.
// Fragment of code in C language (VS6.0) presenting above algorithm
short int siMeasurementReg;
div_t div_MeasurmentValue;
......
div_MeasurmentValue = div((int)siMeasurementRegister,
DW
)
printf( "Total measurement value = %d\n, hundredth parts of the measurement value = %d\n",
div_MeasurmentValue.quot, div_MeasurmentValue.rem );
Query
Byte no
Designation
Size
Value [hex]
00
Module address
1 byte
01 [ 01 to F7]
01
Function code
1 byte
03 / 04
02
Registry address Hi
1 byte
00
03
Registry address Lo
1 byte
00
22
ADA-401WP