Heater files
Dependents: LEX-Demo-Firmware-Logging LEX-Demo-Firmware-Logging
Diff: Heater.h
- Revision:
- 7:59ece353eea2
- Parent:
- 2:7f15386fcc90
- Child:
- 8:5da71ae16115
diff -r 7f15386fcc90 -r 59ece353eea2 Heater.h --- a/Heater.h Wed Jul 17 13:55:33 2019 +0000 +++ b/Heater.h Fri Jul 19 09:22:47 2019 +0000 @@ -10,42 +10,48 @@ #include "mbed.h" #include "ADS8568_ADC.h" -#define MEAS_DELAY 50 // measurement delay after turning on FET (us) -#define N_ROLL_AVG 10 // rolling average for R values +#define MEAS_DELAY 100 // measurement delay for ADC +#define N_ROLL_AVG 2 // rolling average for R values #define ALL_CH 15 //value of convst bus to read all chanels simultaneosly class Heater { + //This class provides the interface through which each heater can be controlled public: /** Constructor - * @param MOSI SPI pin - * @param MISO SPI pin - * @param SCLK SPI pin - * @param nCS SPI pin - * @param ADC reset pin - * @param Conv chA pin - * @param Conv chB pin - * @param Conv chC pin - * @param Conv chD pin + * @param i_port, the port for the current in the ADC + * @param v_port, the port for the voltage in the ADC + * @param drive, the motor drive + * @param R_ref, the target value for R */ - Heater(int i_port, int v_port, DigitalOut drive, float R_set = 1); + Heater(int i_port, int v_port, PwmOut drive, float corr_grad, float corr_int, float R_ref = 1); //Public member functions void read(); void hold(int hold_time); + void ramp_R(int ramp_time, float R_final, float R_start); + void ramp_T(int ramp_time, float T_final, float T_start); + + //Conversions between temperature and resistance + float R_to_T(float R); + float T_to_R(float T); //Getters and setters - - void Set_R_set(float R); + void Set_T_ref(float T); + void Set_R_ref(float R); int Get_i(); int Get_v(); float Get_R(); + float Get_T(); + void turn_on(); void turn_off(); + float check_D (); + @@ -55,13 +61,16 @@ int curr; int v; float R; - float R_set; + float R_ref; int i_port; int v_port; - DigitalOut drive; + PwmOut drive; + + //Heater correlations give temperature for a given resistance (assume linear relationship) + float corr_grad; + float corr_int; }; -#endif - \ No newline at end of file +#endif \ No newline at end of file