fork download
  1. #include <stdio.h>
  2.  
  3. #define NUM_AGC_BOXCAR (20)
  4. int main(void) {
  5. // your code goes here
  6. float dacOffsetCurrent_Amps = 0.0001;
  7. const float factor = 3.3 / 65536 / NUM_AGC_BOXCAR / 2 / 16000;
  8. int agcboxsum = -1231282;
  9. int posAdc = -32000;
  10. const float fb_current =
  11. ((32768 * NUM_AGC_BOXCAR * 2) - agcboxsum) * factor;
  12. const float det_cur = fb_current + dacOffsetCurrent_Amps;
  13. const float pos =
  14. (posAdc * 0.0003) / det_cur;
  15. printf("factor=%.16f\n", factor);
  16. printf("%.10f", pos);
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
factor=0.0000000000786781
-32000.0039062500