7 #ifndef _FRONIUS_request_H_
8 #define _FRONIUS_request_H_
17 unsigned char startByte0;
18 unsigned char startByte1;
19 unsigned char startByte2;
21 unsigned char deviceOption;
22 unsigned char deviceNumber;
23 unsigned char command;
24 unsigned char checksum;
26 const unsigned char static FRONIUS_START_VALUE;
27 const unsigned char static FRONIUS_INTERFACE_CARD;
28 const unsigned char static FRONIUS_SENSORBOX;
29 const unsigned char static FRONIUS_INVERTOR;
35 startByte0 = FRONIUS_START_VALUE;
36 startByte1 = FRONIUS_START_VALUE;
37 startByte2 = FRONIUS_START_VALUE;
40 deviceOption = (command==FRONIUS::FRONIUS_CMD_GET_ACTIVE_INVERTOR_NUMBER ||
41 command==FRONIUS::FRONIUS_CMD_GET_VERSION)
42 ? FRONIUS_INTERFACE_CARD
43 : (command==FRONIUS::FRONIUS_CMD_GET_TEMPERATURE_1 ||
44 command==FRONIUS::FRONIUS_CMD_GET_TEMPERATURE_2 ||
45 command==FRONIUS::FRONIUS_CMD_GET_IRRADIANCE)
49 deviceNumber = (command==FRONIUS::FRONIUS_CMD_GET_ACTIVE_INVERTOR_NUMBER ||
50 command==FRONIUS::FRONIUS_CMD_GET_VERSION)
54 checksum = calculateChecksum();
57 unsigned char calculateChecksum() {
58 unsigned char checksum = 0;
60 checksum += deviceOption;
61 checksum += deviceNumber;
FRONIUS_request(unsigned char invertor, unsigned char cmd)
Initialize request with constant values;.
Structure of fronius request sent to invertor over serial line.