Browse Source

10bit version

git-svn-id: https://bucket.mit.edu/svn/nilm/zoom@8044 ddd99763-3ecb-0310-9145-efcb8ce7c51f
tags/zoom-1.0
jim 12 years ago
parent
commit
a2921bf297
4 changed files with 11 additions and 4 deletions
  1. +3
    -3
      firmware/calibrate.c
  2. +5
    -1
      firmware/dac.c
  3. +3
    -0
      firmware/dac.h
  4. BIN
      firmware/zoom.mcw

+ 3
- 3
firmware/calibrate.c View File

@@ -7,7 +7,7 @@
#include "timer.h"
#include "uart.h"
#define DEBUG_CALIBRATION
//#define DEBUG_CALIBRATION
float g_scale; /* delta(DAC) / delta(ADC) */
@@ -36,8 +36,8 @@ float calculate_scale(uint16_t d1, float a1, uint16_t d2, float a2)
float a = a2 - a1;
/* Correct for known errors */
// d1 = dac_get_actual(d1);
// d2 = dac_get_actual(d2);
d1 = dac_get_actual_float(d1);
d2 = dac_get_actual_float(d2);
if (a < 0.1 && a > -0.1)
scale = 1.0;


+ 5
- 1
firmware/dac.c View File

@@ -57,4 +57,8 @@ uint16_t dac_get_actual(uint16_t val)
return __dac_actual(val);
}
/* Get actual output voltage from DAC_LOW to DAC_HIGH, as a float */
float dac_get_actual_float(uint16_t val)
{
return __dac_actual(val) * (DAC_RANGE / 65536.0);
}

+ 3
- 0
firmware/dac.h View File

@@ -37,4 +37,7 @@ void dac_write(uint16_t val);
*/
uint16_t dac_get_actual(uint16_t val);
/* Get actual output voltage from DAC_LOW to DAC_HIGH, as a float */
float dac_get_actual_float(uint16_t val);
#endif

BIN
firmware/zoom.mcw View File


Loading…
Cancel
Save