Example.
Query of solar panel voltage
Usol
from registry address 40003 / address 30003
11-03-00-02-00-01-CRCLo-CRCHi
11-04-00-02-00-01-CRCLo-CRCHi
Response with register value
Usol
Byte no
Designation
Size
Value [hex]
00
Inverter address
1-byte
11 [ 11 to F7]
01
Function code
1-byte
03 / 04
02
Number of data bytes N-byte
02
03
Dane1-Hi
1-byte
09
04
Dane1-Lo
1-byte
60
05
CRC-Lo
1-byte
---
06
CRC-Hi
1-byte
---
Example.
Readout of solar panel voltage
Usol
from registry address 40003 / address 30003
11-03-02-09-60-CRCLo-CRCHi
11-04-02-09-60-CRCLo-CRCHi
In respond solar panel voltage
Usol
is presented as 2-byte with values:
Usol = 0x0960 => 2400/100 => 24,00 V
Response - in case of error
Byte no
Designation
Size
Value [hex]
00
Inverter address
1-byte
11 [ 11 to F7]
01
Function code
1-byte
83 / 84
02
Error code
1-byte
01 – unknown function
02 – unknown data address
03 – unknown data value
04 – SunMaster inverter not respond or is faulty
03
CRC-Lo
1-byte
04
CRC-Hi
1-byte
8.3.1.2. READOUT OF CURRENT MEASURED VALUE STORED IN TWO 16-BIT REGISTERS
[4X / 3X-REFERENCES]
Function 0x03 / 0x04 are used for readout of status and measurement values from the INVERTER.
The measurement values readout form MODBUS-RTU register is presented by two 16-bit registers.
The registers with the measurement value are in the integer format of 32-bit sign (in C/C++ type int).
The actual measurement value is obtained from the read register using the following algorithms, using the appropriate factor value
DW
(see table above)
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
int
iMeasurementReg;
float fMeasurmentValue
......
fMeasurmentValue = (float)iMeasurementRegister;
fMeasurmentValue = fMeasurmentValue /
DW
;
Algorithm 2.
Readout register is saved to regular type variable 32-bit (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
int
iMeasurementReg;
div_t div_MeasurmentValue;
......
div_MeasurmentValue = div((int)iMeasurementRegister,
DW
)
printf( "Total measurement value = %d\n, hundredth parts of the measurement value = %d\n",
div_MeasurmentValue.quot, div_MeasurmentValue.rem );
16
ADA-1040PC3
Содержание ADA-1040PC3
Страница 23: ...23 ADA 1040PC3...