ADC logging for temperature calibration
Dependencies: mbed MODSERIAL FastPWM ADS8568_ADC
Diff: main.cpp
- Revision:
- 25:bd29d673e5d3
- Parent:
- 24:899071abfc14
- Child:
- 26:dd4f3ef421d1
--- a/main.cpp Wed Oct 09 12:46:23 2019 +0000 +++ b/main.cpp Thu Oct 10 16:24:24 2019 +0000 @@ -3,7 +3,7 @@ #include "FastPWM.h" #include "MODSERIAL.h" -#define MEAS_DELAY 120 // measurement delay after turning on FET (us) +#define MEAS_DELAY 60 // measurement delay after turning on FET (us) #define LOG_INTERVAL 5000 // log file interval (ms) #define START_DELAY 1000 // pause for startup (ms) #define N_STEPS 100 @@ -29,11 +29,10 @@ {0x00570060, 0x32375101, 0x32363531}}; float drive_board_cal[UID_TABLE_LENGTH][2][2] = - {{{0.096724353, 10.1817431}, {0.056098807, 10.19962849}}, - {{0.0596907336847412, 10.1550084867437}, {0.0320376283698263, 10.2580153464834}}, - // {{0.059473025, 10.14814327}, {0.03200058, 10.25073923}}, - {{0.01887149, 10.39360225}, {0.03115874, 10.28199855}}, - {{0.052545339, 10.06008621}, {0.094239471, 10.11983777}}}; + {{{0.0908347476278717, 10.1921343711427}, {0.0497613470164513, 10.2109327517567}}, + {{0.0596907336847412, 10.1550084867437}, {0.0320376283698263, 10.2580153464834}}, + {{0.0119648730956925, 10.4065902688349}, {0.0256785142683800, 10.2921134395920}}, + {{0.0482969653247984, 10.0688110602909}, {0.0882102280729402, 10.1322703041679}}}; MODSERIAL pc(PA_9, PA_10, BUFFER_SIZE); //mcu TX, RX, BUFFER_SIZE byte TX and RX buffers ADS8568_ADC adc(PB_15, PB_14, PB_13, PB_12, PC_15, PC_0, PC_1, PC_2, PC_3); @@ -109,8 +108,7 @@ for (int iStep=0; iStep<N_STEPS; iStep++) { eTime = timer.read_ms(); - pc.printf("%5d, %10d,", iStep, eTime); - + for (int iHeater=0; iHeater <2; iHeater++) { // measure heater if (iHeater==0) @@ -144,15 +142,12 @@ else r_ohm[iHeater] = 0.0; - - //Write output for iHeater - pc.printf("%10d, %10d, %10.6f, %10.6f,", curr[iHeater], v[iHeater], r_adc[iHeater], r_ohm[iHeater]); - //Wait before drivinng other heater wait_ms(LOG_INTERVAL/2); } - pc.printf("\n"); + //Write output for iHeater + pc.printf("%5d, %10d, %10d, %10d, %10.6f, %10.6f, %10d, %10d, %10.6f, %10.6f \n", iStep, eTime, curr[0], v[0], r_adc[0], r_ohm[0], curr[1], v[1], r_adc[1], r_ohm[1]); }