You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

49 lines
2.0 KiB

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