Temperature calibration control program

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
justinbuckland
Date:
Tue Jun 25 11:45:10 2019 +0000
Parent:
0:147db0900012
Commit message:
5 resistance setpoint steps for calibration

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 147db0900012 -r 68515313ce3e main.cpp
--- a/main.cpp	Mon Jun 24 08:48:22 2019 +0000
+++ b/main.cpp	Tue Jun 25 11:45:10 2019 +0000
@@ -1,31 +1,13 @@
 #include "mbed.h"
 
-// thermal cycling settings
-#define N_CYCLES            40     // number of thermal cycles (ramp-hold-ramp-hold)
-#define R_SETPOINT_LOW    2.129     // heater resistance at low temp
-#define T_LOW_RAMP           0     // low temperature ramp time (ms)
-#define T_LOW_HOLD       30000     // low temperature hold time (ms)
-#define R_SETPOINT_MID    2.211    // heater resistance at mid temp 
-#define T_MID_RAMP           0     // mid temperature ramp time (ms)
-#define T_MID_HOLD           0     // mid temperature hold time (ms)
-#define R_SETPOINT_HIGH   2.35   // heater resistance at high temp 
-#define T_HIGH_RAMP          0     // high temperaure ramp time (ms)
-#define T_HIGH_HOLD      10000     // high temperature time (ms)
-#define T_HIGH_START     60000     // hotstart time(ms)
-#define R_LYSE            1.99     // lyse temperature setpoint
-#define T_LYSE               0     // lyse time (ms)
-#define R_RT              2.3     // RT temperature setpoint
-#define T_RT            300000     // RT time (ms)
-#define T_FLUIDICS           0     // nominal time for fluidics post lyse
-#define T_HOLD           60000
-#define T_RAMP           15000
+// select heater
+#define HEATER               1     // inner heater = 1, outer heater = 2
 
-#define T_FORM_DSNA          0     // form dsna post thermocycling
-#define R_FORM_DSNA        2.8     // temperature to form dsna post thermocycling
-
-#define T_MELT_CURVE     50000     // melt curve ramp time
-#define R_MELT_LOW        1.82     // low end melt curve temperature
-#define R_MELT_HIGH       2.08     // high end melt curve temperature
+// temperature calibration settings
+#define N_STEPS              5     // number of temperature calibration points
+#define R_SET_START      1.900     // heater resistance at lowest temp
+#define R_SET_STEP       0.100     // heater resistance at highest temp
+#define T_HOLD          100000     // temperature hold time (ms)
 
 // temperature measurement settings
 #define N_SAMPLES            1     // number of samples to acquire for I and V measurements
@@ -33,7 +15,7 @@
 #define PULSE_WIDTH       5000     // heat or cool pulse width (us)
 #define MEAS_DELAY          50     // measurement delay after turning on FET (us)
 #define CAM_TRIG            20     // camera trigger pulse width (us)
-#define LOG_INTERVAL       500     // log file interval (ms)
+#define LOG_INTERVAL      1000     // log file interval (ms)
 
 // ADC channels to read
 #define CH_A                 1     // value of convst bus to read channel A only
@@ -132,7 +114,8 @@
     if (i2 > 0) r2 = v2/i2;
         
     // select heater (inner or outer)
-    r = r1; // r1 is inner, r21 is outer
+    if (HEATER == 1) r = r1; 
+    if (HEATER == 2) r = r2; 
 }
     
 void tempControl(int endTime){
@@ -186,6 +169,7 @@
 
 int main() {
     int endTime = 0;
+    int iStep = 0;
      
     rLED = 0;
     yLED = 0;
@@ -194,18 +178,11 @@
     drive = 0;
        
     pc.baud(115200);
-    //Reset ADC sequence
     
     sprintf(outString,"    iCycle,  Time(ms),         r,      rSet\n");  
     pc.printf("%s", outString);
     fprintf(fp, outString);
 
- //   while(userButton == 0)
- //  {
- //       wait_ms(1);
- //   };
-        
-        
     reset = 1;
     wait_ms(1);
     reset = 0;
@@ -220,35 +197,15 @@
     yLED = 0;  // heater off
     gLED = 1;  // microprocessor power on
     
-  
     timer.start();
 
-    if (T_HOLD > 0) {
-          endTime = endTime + T_HOLD;
-          rSet = R_SETPOINT_LOW;
-          tempControl(endTime);
-    }   
-    if (T_RAMP > 0) {
-          endTime = endTime + T_RAMP;
-          tempControlRamp(R_SETPOINT_LOW, R_SETPOINT_MID, endTime);
-            
+    while (iStep < N_STEPS) {
+        endTime = endTime + T_HOLD;
+        rSet = R_SET_START + R_SET_STEP*iStep;
+        tempControl(endTime);
+        iStep++;
     }
-    if (T_HOLD > 0) {
-          endTime = endTime + T_HOLD;
-          rSet = R_SETPOINT_MID;
-          tempControl(endTime);
-    }
-    if (T_RAMP > 0) {
-          endTime = endTime + T_RAMP;
-          tempControlRamp(R_SETPOINT_MID, R_SETPOINT_HIGH, endTime);
-            
-    }
-    if (T_HOLD > 0) {
-          endTime = endTime + T_HOLD;
-          rSet = R_SETPOINT_HIGH;
-          tempControl(endTime);
-    }
-    
+
     // extinguish rLED (thermocycling complete), ensure heater is off and close log file for access
     drive = 0;
     rLED = 0;