Your formula does this:
503-483=20
20*8000/65536=2
2>>4=0
It works OK.
I think the formula is wrong.
Your ADC has 12bit resolution, so its output is 0-4095.
But your sensor has an offset of half the power supply since it measures AC and DC currents.
Question: Are measuring ONLY DC currents? If yes then do these:
Scale down the ADC: adc=adc>>3 'From 0-4095 to 0-511
Then subtract the offset that is in the middle our new scale: adc=adc-256
Now it should be OK.
Ioannis
Bookmarks