I have followed the equations 1) and 2)
Calculated current_LSB, CAL value..
loaded CAL value to register-5
But reported current on register read multiplied with Current_LSB doesn't seem correct
Appreciate suggestions how to fix it
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I have followed the equations 1) and 2)
Calculated current_LSB, CAL value..
loaded CAL value to register-5
But reported current on register read multiplied with Current_LSB doesn't seem correct
Appreciate suggestions how to fix it
Cal = round( (0.00512 * (2**15)) / ( shunt_ohms * maxcur_amps) )
Current_LSB = maxcur_amps/(2**15)
load reg-5 with CAL
Read reg-1 shunt-voltage
RdData_S = RdData * 0.0025 ## mV
Read reg-2 Bus voltage
RdData_B = RdData * .00125 ## Volts
Read Reg-3 Current
Current = RdData * Current_LSB
Read Reg-4 Power
Power = RdData * 25 * Current_LSB
Hi,
Sorry to hear that you’re experiencing trouble.
In the code you provided about, could you please put some numbers to both the parameters (shunt_ohms, maxcur_amp…) and readings (RdData…)? It would be helpful if you can quantify why the readings don’t seem to be correct.
Regards, Guang