![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
ADC logging with demo drive board for calibration
Dependencies: mbed MODSERIAL FastPWM ADS8568_ADC
Diff: main.cpp
- Revision:
- 10:a64434365090
- Parent:
- 9:3c5a43ce68bb
- Child:
- 11:8e6c8e654004
diff -r 3c5a43ce68bb -r a64434365090 main.cpp --- a/main.cpp Wed Jun 26 08:55:30 2019 +0000 +++ b/main.cpp Fri Jun 28 08:23:36 2019 +0000 @@ -3,9 +3,11 @@ #define CH_A 1 // value of convst bus to read channel A only #define CH_AC 5 // value of convst bus to read channels A and C #define CH_ABCD 15 // value of convst bus to read all chanels simultaneously -#define MEAS_DELAY 1000 // measurement delay after turning on FET (us) (themocycling control programme uses 50 us) -#define LOG_INTERVAL 1000 // log file interval (ms) +#define MEAS_DELAY 1000 // measurement delay after turning on FET (us) (themocycling control programme uses 50 us) +#define LOG_INTERVAL 5000 // log file interval (ms) + +#define CAM_TRIG 20 // camera trigger pulse width (us) Serial pc(USBTX, USBRX); // tx, rx @@ -13,6 +15,8 @@ DigitalOut yLED(p27); DigitalOut gLED(p28); DigitalOut rLED(p26); +DigitalOut camTrig(p24); +DigitalOut mbedIO(p25); // MBED IO AnalogIn battVolt(p19); AnalogIn auxVolt(p20); @@ -103,9 +107,15 @@ pc.printf("%s", outString); for (int x=0; x<n_samples; x++) { + // trigger measurement drive = 1; yLED = 1; - wait_us(MEAS_DELAY); + camTrig = 1; + mbedIO = 1; + wait_us(CAM_TRIG); + camTrig = 0; + mbedIO = 0; + wait_us(MEAS_DELAY - CAM_TRIG); readChannels (buffer16, val_array); drive = 0; yLED = 0; @@ -137,19 +147,19 @@ r2_sd = sqrt(r2_mean2-(r2_mean*r2_mean)); r2_cv = r2_sd/r1_mean; - pc.printf("Statistics:\r\n"); - pc.printf("n_samples : %d\r\n", n_samples); - pc.printf("r1_mean : %f\r\n", r1_mean); - pc.printf("r1_min : %f\r\n", r1_min); - pc.printf("r1_max : %f\r\n", r1_max); - pc.printf("r1_sd : %f\r\n", r1_sd); - pc.printf("r1_cv : %f\r\n", r1_cv); + //pc.printf("Statistics:\r\n"); + //pc.printf("n_samples : %d\r\n", n_samples); + //pc.printf("r1_mean : %f\r\n", r1_mean); + //pc.printf("r1_min : %f\r\n", r1_min); + //pc.printf("r1_max : %f\r\n", r1_max); + //pc.printf("r1_sd : %f\r\n", r1_sd); + //pc.printf("r1_cv : %f\r\n", r1_cv); - pc.printf("r2_mean : %f\r\n", r2_mean); - pc.printf("r2_min : %f\r\n", r2_min); - pc.printf("r2_max : %f\r\n", r2_max); - pc.printf("r2_sd : %f\r\n", r2_sd); - pc.printf("r2_cv : %f\r\n", r2_cv); + //pc.printf("r2_mean : %f\r\n", r2_mean); + //pc.printf("r2_min : %f\r\n", r2_min); + //pc.printf("r2_max : %f\r\n", r2_max); + //pc.printf("r2_sd : %f\r\n", r2_sd); + //.printf("r2_cv : %f\r\n", r2_cv); rLED = 0;