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 of register Usol
Byte no
Designation
Size
Value [hex]
00
Inverter address
1 byte
11 [ 11 to F7]
01
Function code
1 byte
03 / 04
02
Registry address Hi
1 byte
00
03
Registry address Lo
1 byte
02
04
Registry number Hi
1 byte
00
05
Registry number Lo
1 byte
01
06
CRC-Lo
1 byte
---
07
CRC-Hi
1 byte
---
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.
14
ADA-4040PC3