You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Packet packets[TOTAL_NO_OF_PACKETS]; // array of Packets to be configured
unsigned int regs[TOTAL_NO_OF_REGISTERS]; // master register array
long previousMillis = 0;
long interval = 1000;
unsigned long currentMillis;
unsigned long prev_req;
void setup() {
Serial.begin(9600);
altSerial.begin(9600);
// modbus_construct(packet, id of slave, function, register adress, number of registers, local_start_address);
// Packets initializing:
modbus_construct(&packets[PACKET1], 5, READ_HOLDING_REGISTERS, 0x5000, 2, 0); // L1 Voltage
modbus_construct(&packets[PACKET2], 5, READ_HOLDING_REGISTERS, 0x5008, 2, 2); // Grid freqency
modbus_construct(&packets[PACKET3], 5, READ_HOLDING_REGISTERS, 0x500A, 2, 4); // L1 Current
modbus_construct(&packets[PACKET4], 5, READ_HOLDING_REGISTERS, 0x5012, 2, 6); // Total active power
modbus_construct(&packets[PACKET5], 5, READ_HOLDING_REGISTERS, 0x501A, 2, 8); // Total reactive power
modbus_construct(&packets[PACKET6], 5, READ_HOLDING_REGISTERS, 0x5022, 2, 10); // Total apparent power
modbus_construct(&packets[PACKET7], 5, READ_HOLDING_REGISTERS, 0x502A, 2, 12); // Power factor
modbus_construct(&packets[PACKET8], 5, READ_HOLDING_REGISTERS, 0x6000, 2, 14); // Total active energy
modbus_construct(&packets[PACKET9], 5, READ_HOLDING_REGISTERS, 0x600C, 2, 16); // Forward active energy
modbus_construct(&packets[PACKET10], 5, READ_HOLDING_REGISTERS, 0x6018, 2, 18); // Reverse active energy
modbus_construct(&packets[PACKET11], 5, READ_HOLDING_REGISTERS, 0x6024, 2, 20); // Total reactive energy
modbus_construct(&packets[PACKET12], 5, READ_HOLDING_REGISTERS, 0x6030, 2, 22); // Forward reactive energy
modbus_construct(&packets[PACKET13], 5, READ_HOLDING_REGISTERS, 0x603C, 2, 24); // Reverse reactive energy
modbus_construct(&packets[PACKET14], 5, READ_HOLDING_REGISTERS, 0x6049, 2, 26); // Ressetable day counter
Failed requests: 2
Successful requests:
L1 Voltage: 228.50
Grid Frequency: 49.97
L1 Current: 1.25
Total active Power: 0.29
Total reactive Power: 0.00
Total apparent Power: 0.29
Power factor: 1.00
Which is OK but sometimes happens that these values are shifted by one forward.
What i mean is in place where is Grid Frequency, it passes a value of L1 Voltage and so on.
Like this:
Failed requests: 2
Successful requests:
L1 Voltage: 0.12
Grid Frequency: 229.70
L1 Current: 49.97
Total active Power: 1.26
Total reactive Power: 0.29
Total apparent Power: 0.00
Power factor: 0.29
It is reading Data from electricity meter "Inepro Pro1-Mod".
I have tried to increase and decrease the timeout and polling but it doesn't help so much.
Can you help me why is these values sometimes shifted ?
I think that one register is not red and then its shifts all values.
Can you please help me with a solution? Or what am i doing wrong?
The text was updated successfully, but these errors were encountered:
Hi i have this code:
And this is an example of result:
Which is OK but sometimes happens that these values are shifted by one forward.
What i mean is in place where is Grid Frequency, it passes a value of L1 Voltage and so on.
Like this:
It is reading Data from electricity meter "Inepro Pro1-Mod".
I have tried to increase and decrease the timeout and polling but it doesn't help so much.
Can you help me why is these values sometimes shifted ?
I think that one register is not red and then its shifts all values.
Can you please help me with a solution? Or what am i doing wrong?
The text was updated successfully, but these errors were encountered: