From cbde63d915eeebcd7ba8e9786269ba6545c41bde Mon Sep 17 00:00:00 2001 From: Avi Levkovich Date: Wed, 27 May 2020 14:05:27 +0300 Subject: Add support for Head Staple spun pressure sensors - orf --- .../Embedded/Drivers/Heater/TemperatureSensor.c | 12 ++- .../Head_Card/PT100/Head_PT100_ADC.c | 113 +++++++++++++-------- .../Embedded/Modules/Control/MillisecTask.h | 2 - .../Embedded/Modules/Stubs_Handler/Progress.c | 1 + 4 files changed, 83 insertions(+), 45 deletions(-) (limited to 'Software/Embedded_SW') diff --git a/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c b/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c index 306e6e6f8..ca2b24eae 100644 --- a/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c +++ b/Software/Embedded_SW/Embedded/Drivers/Heater/TemperatureSensor.c @@ -456,7 +456,17 @@ uint32_t CalculateTemperatures(TEMPERATURE_SENSOR_ID_ENUM SensorId, uint32_t Dat uint32_t NoOfAvrSamples = 5;//TODO - how many Samples Status = Filter_Temparature_Measurement(SensorId, Current_Measurement_C, NoOfAvrSamples); #else - TempSensorResponse[SensorId].Temperature_C_mult_by_100 = Current_Measurement_C; + if((Head_Type == HEAD_TYPE_STAPLE_SPUN) && (( SensorId == HEAD_PT100_ZONE_6_0X84_1) || ( SensorId == HEAD_PT100_ZONE_8_0X86_1)))//pressure sensors + //if((Head_Type == HEAD_TYPE_STAPLE_SPUN) && (( SensorId == HEAD_PT100_ZONE_5_0X84_0) || ( SensorId == HEAD_PT100_ZONE_7_0X86_0)))//pressure sensors + { + //Head Staple spun pressure sensors + TempSensorResponse[SensorId].Temperature_C_mult_by_100 = TempSensorResponse[SensorId].PT100_ADC_Reading_Bits; + Current_Measurement_C = TempSensorResponse[SensorId].PT100_ADC_Reading_Bits; + } + else + { + TempSensorResponse[SensorId].Temperature_C_mult_by_100 = Current_Measurement_C; + } #endif return Current_Measurement_C; diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c index ec798b472..a6db745cd 100644 --- a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c +++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/Head_Card/PT100/Head_PT100_ADC.c @@ -252,43 +252,72 @@ uint8_t HeadADCPT100_InitConfigReg() { for(i=HEAD_PT100_ZONE_1_0X80_0;i < MAX_HEAD_CARD_TEMP_SENS_ID;i++) // for now we are using the same configuration to all of them { - // - - - - - - - - - - Reg0 - - - - - - - - - - - HeadTempSensConfig[i].Reg0.bits.PGA_BYPASS = ADS122X_USE_PGA ;//Bit 0 - HeadTempSensConfig[i].Reg0.bits.GAIN = ADS122X_GAIN_8 ;//Bits 1-3 - //HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 - - // - - - - - - - - - - Reg1 - - - - - - - - - - - - HeadTempSensConfig[i].Reg1.bits.TS = ADS122X_TEMP_SENSOR_OFF ;//Bit 0 - HeadTempSensConfig[i].Reg1.bits.VREF = ADS122X_VREF_EXT_REF0_PINS ;//Bits 1-2 - HeadTempSensConfig[i].Reg1.bits.CM = ADS122X_CONVERSION_CONTINUOUS ;//Bit 3 - HeadTempSensConfig[i].Reg1.bits.MODE = ADS122X_OP_MODE_NORMAL ;//Bit 4 - HeadTempSensConfig[i].Reg1.bits.DR = ADS122X_DATA_RATE_20SPS ;//Bits 5-7 - - // - - - - - - - - - - Reg2 - - - - - - - - - - - - HeadTempSensConfig[i].Reg2.bits.IDAC = ADS122X_IDAC_CURRENT_1000_UA ;//Bits 0-2 - HeadTempSensConfig[i].Reg2.bits.BCS = ADS122X_BCS_CURRENT_SOURCES_OFF ;//Bit 3 - HeadTempSensConfig[i].Reg2.bits.CRC = ADS122X_CRC_DISABLED ;//BitS 4-5 - HeadTempSensConfig[i].Reg2.bits.DCNT = ADS122X_DCNT_CONVERSION_COUNTER_DISABLED ;//Bit 6 - HeadTempSensConfig[i].Reg2.bits.DRDY = ADS122X_DRDY_NO_NEW_CONVERSION ;//Bit 7 + if((Head_Type == HEAD_TYPE_STAPLE_SPUN) && (( i == HEAD_PT100_ZONE_6_0X84_1) || ( i == HEAD_PT100_ZONE_8_0X86_1)))//pressure sensors + //if((Head_Type == HEAD_TYPE_STAPLE_SPUN) && (( i == HEAD_PT100_ZONE_5_0X84_0) || ( i == HEAD_PT100_ZONE_7_0X86_0)))//pressure sensors + { + // - - - - - - - - - - Reg0 - - - - - - - - - - + HeadTempSensConfig[i].Reg0.bits.PGA_BYPASS = ADS122X_PGA_BYPASS ;//Bit 0 + HeadTempSensConfig[i].Reg0.bits.GAIN = ADS122X_GAIN_1 ;//Bits 1-3 + //HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 + + // - - - - - - - - - - Reg1 - - - - - - - - - - + HeadTempSensConfig[i].Reg1.bits.TS = ADS122X_TEMP_SENSOR_OFF ;//Bit 0 + HeadTempSensConfig[i].Reg1.bits.VREF = ADS122X_VREF_AVDD ;//Bits 1-2 + HeadTempSensConfig[i].Reg1.bits.CM = ADS122X_CONVERSION_CONTINUOUS ;//Bit 3 + HeadTempSensConfig[i].Reg1.bits.MODE = ADS122X_OP_MODE_NORMAL ;//Bit 4 + HeadTempSensConfig[i].Reg1.bits.DR = ADS122X_DATA_RATE_20SPS ;//Bits 5-7 + + // - - - - - - - - - - Reg2 - - - - - - - - - - + HeadTempSensConfig[i].Reg2.bits.IDAC = ADS122X_IDAC_CURRENT_OFF ;//Bits 0-2 + HeadTempSensConfig[i].Reg2.bits.BCS = ADS122X_BCS_CURRENT_SOURCES_OFF ;//Bit 3 + HeadTempSensConfig[i].Reg2.bits.CRC = ADS122X_CRC_DISABLED ;//BitS 4-5 + HeadTempSensConfig[i].Reg2.bits.DCNT = ADS122X_DCNT_CONVERSION_COUNTER_DISABLED ;//Bit 6 + HeadTempSensConfig[i].Reg2.bits.DRDY = ADS122X_DRDY_NO_NEW_CONVERSION ;//Bit 7 + + // - - - - - - - - - - Reg3 - - - - - - - - - - + HeadTempSensConfig[i].Reg3.bits.Always_write_0 = ADS122X_RESERVED_WRITE_0 ;//BitS 0-1 Always write 0 + HeadTempSensConfig[i].Reg3.bits.I2MUX = ADS122X_IDAC2_DISABLED ;//Bits 2-4 + HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_DISABLED ;//Bits 5-7 + } + else + { + // - - - - - - - - - - Reg0 - - - - - - - - - - + HeadTempSensConfig[i].Reg0.bits.PGA_BYPASS = ADS122X_USE_PGA ;//Bit 0 + HeadTempSensConfig[i].Reg0.bits.GAIN = ADS122X_GAIN_8 ;//Bits 1-3 + //HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 + + // - - - - - - - - - - Reg1 - - - - - - - - - - + HeadTempSensConfig[i].Reg1.bits.TS = ADS122X_TEMP_SENSOR_OFF ;//Bit 0 + HeadTempSensConfig[i].Reg1.bits.VREF = ADS122X_VREF_EXT_REF0_PINS ;//Bits 1-2 + HeadTempSensConfig[i].Reg1.bits.CM = ADS122X_CONVERSION_CONTINUOUS ;//Bit 3 + HeadTempSensConfig[i].Reg1.bits.MODE = ADS122X_OP_MODE_NORMAL ;//Bit 4 + HeadTempSensConfig[i].Reg1.bits.DR = ADS122X_DATA_RATE_20SPS ;//Bits 5-7 + + // - - - - - - - - - - Reg2 - - - - - - - - - - + HeadTempSensConfig[i].Reg2.bits.IDAC = ADS122X_IDAC_CURRENT_1000_UA ;//Bits 0-2 + HeadTempSensConfig[i].Reg2.bits.BCS = ADS122X_BCS_CURRENT_SOURCES_OFF ;//Bit 3 + HeadTempSensConfig[i].Reg2.bits.CRC = ADS122X_CRC_DISABLED ;//BitS 4-5 + HeadTempSensConfig[i].Reg2.bits.DCNT = ADS122X_DCNT_CONVERSION_COUNTER_DISABLED ;//Bit 6 + HeadTempSensConfig[i].Reg2.bits.DRDY = ADS122X_DRDY_NO_NEW_CONVERSION ;//Bit 7 + + // - - - - - - - - - - Reg3 - - - - - - - - - - + HeadTempSensConfig[i].Reg3.bits.Always_write_0 = ADS122X_RESERVED_WRITE_0 ;//BitS 0-1 Always write 0 + HeadTempSensConfig[i].Reg3.bits.I2MUX = ADS122X_IDAC2_AIN3 ;//Bits 2-4 + HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_AIN0 ;//Bits 5-7 + } - // - - - - - - - - - - Reg3 - - - - - - - - - - - HeadTempSensConfig[i].Reg3.bits.Always_write_0 = ADS122X_RESERVED_WRITE_0 ;//BitS 0-1 Always write 0 - HeadTempSensConfig[i].Reg3.bits.I2MUX = ADS122X_IDAC2_AIN3 ;//Bits 2-4 - HeadTempSensConfig[i].Reg3.bits.I1MUX = ADS122X_IDAC1_AIN0 ;//Bits 5-7 } for(i=HEAD_PT100_ZONE_1_0X80_0;i < HEAD_PT100_ZONE_2_0X80_1;i++) { - HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 + HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_ODD_PT100_MUX ;//Bits 4-7 HeadTempSensConfig[i].SEL = HEAD_CONFIG_ODD_PT100_PT_SEL; } for(i=HEAD_PT100_ZONE_2_0X80_1;i < HEAD_PT100_RESERVE_0X8E_1;i++) { - HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_EVEN_PT100_MUX ;//Bits 4-7 + HeadTempSensConfig[i].Reg0.bits.MUX = HEAD_CONFIG_EVEN_PT100_MUX ;//Bits 4-7 HeadTempSensConfig[i].SEL = HEAD_CONFIG_EVEN_PT100_PT_SEL; } @@ -303,30 +332,30 @@ uint8_t HeadADCPT100_InitConfigReg() for(i=HEAD_PT100_ZONE_1_0X80_0;iamount == 0xdace)//test_dancer_responce_RTFU + //in order to use it unmark the define test_RTFU_dancer !!!!!!!!!!! { test_dancer_flag = true; -- cgit v1.3.1