Given out scaling and that n=200 on the secondary for the LA-55, and a 16-bit DAC value, each LSB cancels out 600 µA of current on the primary, for a maximum range of DAC 0000h ≈ -20 A (-600 µA * 2^15) DAC 8000h ≈ 0 A DAC ffffh ≈ 20 A (600 µA * 2^15) Assume LA-55 is accurate to 500 µA. Then we're screwed because we already get 600 µA granularity out of the compensation current! Any bits we steal from the DAC to put on the LEM side don't gain us anything, and we're stuck at 16-17 bits. Let's assume instead that the LA-55 is accurate to 50 µA. Now if we want 7-8 bits from that, we need LA-55 to handle range up to around 5 mA. That steals 5 mA / 600 µA ≈ 3 bits from the DAC, so we use a 13-bit value on the DAC. So LA-55 value should only ever reach ± 5 mA. Let R = 100 (max in spec), remember scaling in LA-55, and our max output voltage is about ± 0.5 mV. Crap. That's just around the resolution of the PIC ADC so we'd need to scale that up by a factor of 2^8 to get 8 bits out of it. Not good! For now, I have the LEM output going into a fixed gain of 11. Then it gets subtracted from 1.25 V and fed into the PIC ADC, with clamps to -0.6V to +3.9V to avoid damaging the PIC if our code is broken. On firmware: With scaling factor of 11, PIC input should reach ±5.5mV if LA-55 reaches ± 5mA. Again let's scale by 20 arbitrarily to make this not completely unworkable, so our window extends to ±110mV around 1.25V which is min = (1.14V / 2.50V * 0x0fff) = 0x074b max = (1.36V / 2.50V * 0x0fff) = 0x08b3 ADC value is inverted due to subtraction, but current output is inverted too, so we can ignore that. So our ADC window is actually ±100 mA. Step DAC by 100 mA/600 μA = 166 to account for that (we'll use 128). --- 1 bit change on DAC is 600 μA LA-55 output voltage is x/1000 * 100 = 0.06 mV ADC input changes by x*11 = 0.66 mV which is a count of x / (2.50 / 2^12) = 1.08 So to counteract a change of X on the ADC, change dac by (X/1.08).