Mahesh Phalke / Mbed OS ad7124_mbed_temperature-measure-example

Dependencies:   platform_drivers AD7124_no_OS adi_console_menu tempsensors_prv

Revision:
5:90166c496b01
Parent:
0:08ba94bc5a30
Child:
6:622270f7d476
diff -r a00b216ffd0a -r 90166c496b01 app/ad7124_console_app.c
--- a/app/ad7124_console_app.c	Mon Feb 22 04:57:23 2021 +0000
+++ b/app/ad7124_console_app.c	Fri Mar 19 12:33:00 2021 +0530
@@ -83,6 +83,7 @@
 
 /* Possible sensor configurations (mapped with enum sensor_config_ids) */
 static const char *sensor_configs[NUMBER_OF_SENSOR_CONFIGS] = {
+	"RESET",
 	"2-Wire RTD",
 	"3-Wire RTD",
 	"4-Wire RTD",
@@ -94,12 +95,14 @@
 /* Maximum number of sensors connected to different AD7124 devices */
 static uint8_t max_supported_sensors[NUMBER_OF_SENSOR_CONFIGS] = {
 #if defined (AD7124_8)
+	0,	// RESET config
 	5,	// 2-wire RTDs
 	4,	// 3-wire RTDs
 	5,	// 4-wire RTDs
 	6,	// Thermocouples
 	8	// Thermistors
 #else
+	0,	// RESET config
 	2,	// 2-wire RTDs
 	2,	// 3-wire RTDs
 	2,	// 4-wire RTDs
@@ -121,25 +124,44 @@
 	NUM_OF_SENSOR_CHANNELS
 };
 
+/* Sensor measurement type */
+typedef enum {
+	/* Measurement with averaged ADC samples */
+	AVERAGED_MEASUREMENT,
+	/* Measurement with single ADC sample */
+	SINGLE_MEASUREMENT,
+	/* Continuous measurement with single ADC sample */
+	CONTINUOUS_MEASUREMENT
+} sensor_measurement_type;
+
 /* Curent sensor configuration (pointer to sensor_configs string array)  */
 static const char *current_sensor_config;
 
+/* ADC raw data for n samples */
+static int32_t n_sample_data[NUM_OF_SENSOR_CHANNELS][MAX_ADC_SAMPLES];
+
+/* RTD calibraed IOUT values */
+static float rtd_calib_iout[2][MAX_ADC_SAMPLES]; // Iout0 + Iout1
+
+/* CJC sensor ADC raw data for n samples */
+static int32_t n_cjc_sample_data[MAX_THERMOCOUPLE_SENSORS][MAX_ADC_SAMPLES];
+
 /* Status info (true/false) */
 static const char status_info[] = {
 	'N',
 	'Y'
 };
 
-/* Sensor measurement progress strings */
-static const char *temp_measurement_status[NUM_OF_SENSOR_CHANNELS] = {
-	".       ",
-	"..      ",
-	"...     ",
-	"....    ",
-	".....   ",
-	"......  ",
-	"....... ",
-	"........"
+/* Tab counting strings */
+static const char *tab_cnt_str[NUM_OF_SENSOR_CHANNELS] = {
+	"\t",
+	"\t\t",
+	"\t\t\t",
+	"\t\t\t\t",
+	"\t\t\t\t\t",
+	"\t\t\t\t\t\t",
+	"\t\t\t\t\t\t\t",
+	"\t\t\t\t\t\t\t\t"
 };
 
 /* Sensor enable status */
@@ -151,7 +173,7 @@
 static const char *cjc_sensor_names[NUM_OF_CJC_SENSORS] = {
 	"PT100 4-Wire RTD",
 	"Thermistor PTC KY81/110",
-	"PT1000 4-Wire RTD",
+	"PT1000 2-Wire RTD",
 };
 
 /* Current selected CJC sensor */
@@ -212,6 +234,11 @@
 	 * Requirement, not checked here, is that all the configs are the same size
 	 */
 	switch (config_id) {
+	case AD7124_CONFIG_RESET:
+		memcpy(ad7124_register_map, ad7124_regs,
+		       sizeof(ad7124_register_map));
+		break;
+
 	case AD7124_CONFIG_2WIRE_RTD:
 		memcpy(ad7124_register_map, ad7124_regs_config_2wire_rtd,
 		       sizeof(ad7124_register_map));
@@ -266,6 +293,26 @@
 
 
 /*!
+ * @brief	determines if the Escape key was pressed
+ * @return	bool- key press status
+ */
+static bool was_escape_key_pressed(void)
+{
+	char rxChar;
+	bool wasPressed = false;
+
+	/* Check for Escape key pressed */
+	if ((rxChar = getchar_noblock()) > 0) {
+		if (rxChar == ESCAPE_KEY_CODE) {
+			wasPressed = true;
+		}
+	}
+
+	return (wasPressed);
+}
+
+
+/*!
  * @brief	Enable the multiple sensors for measurement
  * @param	chn_number[in]- Channel number assigned for the sensor
  * @return	MENU_CONTINUE
@@ -295,7 +342,7 @@
 
 	switch (current_cjc_sensor) {
 	case PT100_4WIRE_RTD:
-	case PT1000_4WIRE_RTD:
+	case PT1000_2WIRE_RTD:
 		sensor_enable_status[CJC_RTD_CHN] = true;
 		break;
 
@@ -314,12 +361,15 @@
 /*!
  * @brief	Perform the ADC data conversion for input channel
  * @param	chn[in]- Channel to be sampled
- * @param	data[in]- Variable to store converted result
+ * @param	data[in]- Array to store converted results
+ * @param	measurement_type[in] - Temperature measurement and display type
  * @return	Return 0 in case of SUCCESS, else return negative error code
  * @note	This function gets the averged adc raw value for MAX_ADC_SAMPLES
  *			samples
  */
-static int32_t perform_adc_conversion(uint8_t chn, int32_t *data)
+static int32_t perform_adc_conversion(uint8_t chn,
+				      int32_t (*data)[MAX_ADC_SAMPLES],
+				      sensor_measurement_type measurement_type)
 {
 	int32_t sample_data;
 	int64_t avg_sample_data = 0;
@@ -349,22 +399,19 @@
 		 *  channel that was sampled as well. No need to read STATUS separately
 		 */
 		if (ad7124_wait_for_conv_ready(p_ad7124_dev, CONVERSION_TIMEOUT) != SUCCESS) {
-			return FAILURE;
-		}
-
-		if (ad7124_read_data(p_ad7124_dev, &sample_data) != SUCCESS) {
-			return FAILURE;
+			break;
 		}
 
-		avg_sample_data += sample_data;
-	}
-
-	/* Disable current channel */
-	ad7124_register_map[AD7124_Channel_0 + chn].value &=
-		~AD7124_CH_MAP_REG_CH_ENABLE;
-	if (ad7124_write_register(p_ad7124_dev,
-				  ad7124_register_map[AD7124_Channel_0 + chn]) != SUCCESS) {
-		return FAILURE;
+		if (measurement_type == AVERAGED_MEASUREMENT) {
+			if (ad7124_read_data(p_ad7124_dev, &sample_data) != SUCCESS) {
+				break;
+			}
+			avg_sample_data += sample_data;
+		} else {
+			if (ad7124_read_data(p_ad7124_dev, data[0]+sample) != SUCCESS) {
+				break;
+			}
+		}
 	}
 
 	/* Put ADC into Standby mode */
@@ -376,8 +423,67 @@
 		return FAILURE;
 	}
 
-	/* Calculate the averaged adc raw value */
-	*data = (avg_sample_data / MAX_ADC_SAMPLES);
+	/* Disable current channel */
+	ad7124_register_map[AD7124_Channel_0 + chn].value &=
+		~AD7124_CH_MAP_REG_CH_ENABLE;
+	if (ad7124_write_register(p_ad7124_dev,
+				  ad7124_register_map[AD7124_Channel_0 + chn]) != SUCCESS) {
+		return FAILURE;
+	}
+
+	if (measurement_type == AVERAGED_MEASUREMENT) {
+		/* Calculate the averaged adc raw value */
+		*data[0] = (avg_sample_data / MAX_ADC_SAMPLES);
+	}
+
+	return SUCCESS;
+}
+
+
+/*!
+ * @brief	Perform the 3-wire RTD additional configurations
+ * @param	multiple_rtd_enabled[in,out]- Multiple RTD enable status flag
+ * @return	SUCCESS/FAILURE
+ */
+static int32_t do_3wire_rtd_configs(bool *multiple_rtd_enabled)
+{
+	uint8_t sensor_enable_cnt = 0;
+	uint8_t setup;
+
+	*multiple_rtd_enabled = false;
+
+	/* Check if multiple RTDs are enabled */
+	for (uint8_t chn = SENSOR_CHANNEL0;
+	     chn < max_supported_sensors[AD7124_CONFIG_3WIRE_RTD]; chn++) {
+		if (sensor_enable_status[chn])
+			sensor_enable_cnt++;
+
+		if (sensor_enable_cnt > 1) {
+			*multiple_rtd_enabled = true;
+			break;
+		}
+	}
+
+	for (uint8_t chn = SENSOR_CHANNEL0;
+	     chn < max_supported_sensors[AD7124_CONFIG_3WIRE_RTD]; chn++) {
+		if (sensor_enable_status[chn]) {
+			setup = ad7124_get_channel_setup(p_ad7124_dev, chn);
+			ad7124_register_map[AD7124_Config_0 + setup].value &= (~AD7124_CFG_REG_PGA_MSK);
+
+			if (*multiple_rtd_enabled) {
+				ad7124_register_map[AD7124_Config_0 + setup].value |= AD7124_CFG_REG_PGA(
+							MULTI_3WIRE_RTD_GAIN);
+			} else {
+				ad7124_register_map[AD7124_Config_0 + setup].value |= AD7124_CFG_REG_PGA(
+							SINGLE_3WIRE_RTD_GAIN);
+			}
+
+			if (ad7124_write_register(p_ad7124_dev,
+						  ad7124_register_map[AD7124_Config_0 + setup]) != SUCCESS) {
+				return FAILURE;
+			}
+		}
+	}
 
 	return SUCCESS;
 }
@@ -388,12 +494,16 @@
  * @param	rtd_config_id[in]- RTD type (2/3/4-wire)
  * @param	chn[in] - ADC channel assigned to given RTD sensor
  * @param	adc_raw[out] - ADC raw result
+ * @param	measurement_type[in] - Temperature measurement and display type
+ * @param	multiple_3wire_rtd_enabled[in] - Multiple RTD enable status
  * @return	RTC sensor ADC sampling data
  */
-static bool do_rtc_sensor_adc_sampling(uint32_t rtd_config_id, uint8_t chn,
-				       int32_t *adc_raw)
+static bool do_rtd_sensor_adc_sampling(uint32_t rtd_config_id, uint8_t chn,
+				       int32_t (*adc_raw)[MAX_ADC_SAMPLES], sensor_measurement_type measurement_type,
+				       bool multiple_3wire_rtd_enabled)
 {
 	bool adc_sampling_status = true;
+	int32_t iout0_exc, iout1_exc;
 
 	const uint8_t rtd_iout0_source[][MAX_RTD_SENSORS] = {
 		{
@@ -413,17 +523,26 @@
 		RTD1_3WIRE_IOUT1, RTD2_3WIRE_IOUT1, RTD3_3WIRE_IOUT1, RTD4_3WIRE_IOUT1,
 	};
 
+	/* Select excitation source based on RTD configuration */
+	if (multiple_3wire_rtd_enabled) {
+		iout0_exc = RTD_IOUT0_250UA_EXC;
+		iout1_exc = RTD_IOUT1_250UA_EXC;
+	} else {
+		iout0_exc = RTD_IOUT0_500UA_EXC;
+		iout1_exc = RTD_IOUT1_500UA_EXC;
+	}
+
 	do {
 		/* Enable and direct IOUT0 excitation current source for current RTD sensor measurement */
 		ad7124_register_map[AD7124_IOCon1].value |= (AD7124_IO_CTRL1_REG_IOUT_CH0(
 					rtd_iout0_source[rtd_config_id][chn]) | AD7124_IO_CTRL1_REG_IOUT0(
-					RTD_IOUT0_500UA_EXC));
+					iout0_exc));
 
 		if (rtd_config_id == AD7124_CONFIG_3WIRE_RTD) {
 			/* Enable and direct IOUT1 excitation current source for current RTD sensor measurement */
 			ad7124_register_map[AD7124_IOCon1].value |= (AD7124_IO_CTRL1_REG_IOUT_CH1(
 						rtd_3wire_iout1_source[chn]) | AD7124_IO_CTRL1_REG_IOUT1(
-						RTD_IOUT1_500UA_EXC));
+						iout1_exc));
 		}
 
 		if (ad7124_write_register(p_ad7124_dev,
@@ -432,8 +551,7 @@
 			break;
 		}
 
-		/* Read adc averaged sample result */
-		if (perform_adc_conversion(chn, adc_raw) != SUCCESS) {
+		if (perform_adc_conversion(chn, adc_raw, measurement_type) != SUCCESS) {
 			adc_sampling_status = false;
 			break;
 		}
@@ -461,47 +579,101 @@
 /*!
  * @brief	Perform the multiple RTD sensors measurement
  * @param	rtd_config_id[in]- RTD type (2/3/4-wire)
+ * @param	measurement_type[in] - Temperature measurement and display type
  * @return	MENU_CONTINUE
  */
-static int32_t perform_rtd_measurement(uint32_t rtd_config_id)
+static int32_t perform_rtd_measurement(uint32_t rtd_config_id,
+				       sensor_measurement_type measurement_type)
 {
-	int32_t sample_data[MAX_RTD_SENSORS];
 	bool adc_error = false;
+	bool multiple_3wire_rtd_enabled = false;
+	uint8_t rtd_gain;
+	uint16_t sample_cnt;
+	bool continue_measurement = false;
+	uint8_t tab_cnt = 0;
 	float temperature;
 
+	if (measurement_type == CONTINUOUS_MEASUREMENT) {
+		printf(EOL"Press ESC key once to stop measurement..." EOL);
+		mdelay(1000);
+		continue_measurement = true;
+	}
+
+	/* Print display header */
 	printf(EOL EOL EOL);
+	for (uint8_t chn = SENSOR_CHANNEL0;
+	     chn < max_supported_sensors[rtd_config_id]; chn++) {
+		if (sensor_enable_status[chn]) {
+			printf(VT100_MOVE_UP_1_LINE "%s  RTD%d" EOL,
+			       tab_cnt_str[tab_cnt++], chn + 1);
+		}
+	}
+	tab_cnt = 0;
+	printf("\t-----------------------------------------------" EOL EOL);
+
+	/* Perform additional configs for 3-wire RTD measurement */
+	if (rtd_config_id == AD7124_CONFIG_3WIRE_RTD) {
+		if (do_3wire_rtd_configs(&multiple_3wire_rtd_enabled) != SUCCESS)
+			adc_error = true;
+	}
 
-	/* Sample and Read all enabled RTD channels in sequence */
-	for (uint8_t chn = SENSOR_CHANNEL0; chn < max_supported_sensors[rtd_config_id];
-	     chn++) {
-		if (sensor_enable_status[chn]) {
-			if (!do_rtc_sensor_adc_sampling(rtd_config_id, chn, &sample_data[chn])) {
-				adc_error = true;
-				break;
+	do {
+		/* Sample and Read all enabled NTC channels in sequence */
+		for (uint8_t chn = SENSOR_CHANNEL0;
+		     (chn < max_supported_sensors[rtd_config_id]) & !adc_error; chn++) {
+			if (sensor_enable_status[chn]) {
+				if (!do_rtd_sensor_adc_sampling(rtd_config_id, chn, &n_sample_data[chn],
+								measurement_type, multiple_3wire_rtd_enabled)) {
+					adc_error = true;
+					break;
+				}
+			}
+		}
+
+		if (adc_error) {
+			printf(EOL EOL "\tError Performing Measurement" EOL);
+			break;
+		} else {
+			if (multiple_3wire_rtd_enabled) {
+				/* Store the Iout ratio as 1 (assumption is Iout0=Iout1) and no
+				 * Iout calibration is performed */
+				store_rtd_calibrated_iout_ratio(1, true);
+				rtd_gain = MULTI_3WIRE_RTD_GAIN;
+			} else {
+				rtd_gain = RTD_2WIRE_GAIN_VALUE;
 			}
 
-			printf(VT100_MOVE_UP_1_LINE
-			       "RTD temperature measurement in progress%s" EOL,
-			       temp_measurement_status[chn]);
-		}
-	}
-
-	if (adc_error) {
-		printf(EOL EOL "\tError Performing Measurement" EOL);
-	} else {
-		/* Print the temperature measurement results */
-		printf(EOL EOL "\tRTD Sensor    Temperature (C)" EOL);
-		printf("\t-----------------------------" EOL);
-
-		for (uint8_t chn = SENSOR_CHANNEL0; chn < max_supported_sensors[rtd_config_id];
-		     chn++) {
-			if (sensor_enable_status[chn]) {
-				/* Calculate temperature from the RTD resistence */
-				temperature = get_rtd_temperature(sample_data[chn]);
-
-				printf("\t   RTD%d           %.4f" EOL, chn + 1, temperature);
+			/* Calculate temperature and display result */
+			if (measurement_type == AVERAGED_MEASUREMENT) {
+				for (uint8_t chn = SENSOR_CHANNEL0; chn < max_supported_sensors[rtd_config_id];
+				     chn++) {
+					if (sensor_enable_status[chn]) {
+						temperature = get_rtd_temperature(n_sample_data[chn][0], rtd_gain);
+						printf(VT100_MOVE_UP_1_LINE "%s  %.3f" EOL, tab_cnt_str[tab_cnt++],
+						       temperature);
+					}
+				}
+				tab_cnt = 0;
+			} else {
+				for (sample_cnt = 0; sample_cnt < MAX_ADC_SAMPLES; sample_cnt++) {
+					for (uint8_t chn = SENSOR_CHANNEL0; chn < max_supported_sensors[rtd_config_id];
+					     chn++) {
+						if (sensor_enable_status[chn]) {
+							temperature = get_rtd_temperature(n_sample_data[chn][sample_cnt], rtd_gain);
+							printf(VT100_MOVE_UP_1_LINE "%s  %.3f" EOL, tab_cnt_str[tab_cnt++],
+							       temperature);
+						}
+					}
+					printf(EOL);
+					tab_cnt = 0;
+				}
 			}
 		}
+	} while (continue_measurement && !was_escape_key_pressed());
+
+	if (multiple_3wire_rtd_enabled) {
+		/* Reset the calibration constant value after measurement */
+		store_rtd_calibrated_iout_ratio(1, false);
 	}
 
 	/* Put ADC into standby mode */
@@ -516,6 +688,39 @@
 
 
 /*!
+ * @brief	Perform the 2-wire RTD measurement
+ * @param	measurement_type[in] - Temperature measurement and display type
+ * @return	MENU_CONTINUE
+ */
+static int32_t perform_2wire_rtd_measurement(uint32_t measurement_type)
+{
+	return perform_rtd_measurement(AD7124_CONFIG_2WIRE_RTD, measurement_type);
+}
+
+
+/*!
+ * @brief	Perform the 3-wire RTD measurement
+ * @param	measurement_type[in] - Temperature measurement and display type
+ * @return	MENU_CONTINUE
+ */
+static int32_t perform_3wire_rtd_measurement(uint32_t measurement_type)
+{
+	return perform_rtd_measurement(AD7124_CONFIG_3WIRE_RTD, measurement_type);
+}
+
+
+/*!
+ * @brief	Perform the 4-wire RTD measurement
+ * @param	measurement_type[in] - Temperature measurement and display type
+ * @return	MENU_CONTINUE
+ */
+static int32_t perform_4wire_rtd_measurement(uint32_t measurement_type)
+{
+	return perform_rtd_measurement(AD7124_CONFIG_4WIRE_RTD, measurement_type);
+}
+
+
+/*!
  * @brief	Change the 3-wire RTD calibration type to user selected type
  * @param	calibration_type[in]- 3-wire RTD calibration type
  * @return	MENU_CONTINUE
@@ -529,17 +734,19 @@
 
 /*!
  * @brief	Perform the 3-wire RTD calibration and measurement
- * @param	menu_id[in]- Optional menu ID
+ * @param	measurement_type[in] - Temperature measurement and display type
  * @return	MENU_CONTINUE
  */
-static int32_t calibrate_and_measure_3wire_rtd(uint32_t menu_id)
+static int32_t calibrate_and_measure_3wire_rtd(uint32_t measurement_type)
 {
-	int32_t sample_data[MAX_RTD_SENSORS];
+	int32_t sample_data[2][MAX_ADC_SAMPLES];
 	bool adc_error = false;
 	float temperature;
 	float voltage;
-	int32_t adc_raw[2];	// Iout0 + Iout1
-	volatile static float iout[2]; 		// Iout0 + Iout1
+	bool multiple_3wire_rtd_enabled = false;
+	uint16_t sample_cnt;
+	bool continue_measurement = false;
+	uint8_t tab_cnt = 0;
 
 	const uint8_t rtd_3wire_iout0_source[] = {
 		RTD1_3WIRE_IOUT0, RTD2_3WIRE_IOUT0, RTD3_3WIRE_IOUT0, RTD4_3WIRE_IOUT0
@@ -549,211 +756,281 @@
 		RTD1_3WIRE_IOUT1, RTD2_3WIRE_IOUT1, RTD3_3WIRE_IOUT1, RTD4_3WIRE_IOUT1
 	};
 
-	/* Print the temperature measurement results */
-	printf(EOL EOL "\tRTD Sensor    Temperature (C)" EOL);
-	printf("\t-----------------------------" EOL);
-
-	/* Calibrate, Sample and Read all enabled RTD channels in sequence */
-	for (uint8_t chn = SENSOR_CHANNEL0;
-	     (chn < max_supported_sensors[AD7124_CONFIG_3WIRE_RTD]) && (!adc_error);
-	     chn++) {
-		if (sensor_enable_status[chn]) {
-			/* Change PGA to 32 due to selection of 250uA Iout current for calibration
-			 * Note: For 'Measuring Iout' type calibration, this gain is just used
-			 *       for calibration purpose. For actual measurement, the gain is changed
-			 *       back to default one used for RTD measurement */
-			ad7124_register_map[AD7124_Config_0].value &= (~AD7124_CFG_REG_PGA_MSK);
-			ad7124_register_map[AD7124_Config_0].value |= AD7124_CFG_REG_PGA(
-						RTD_3WIRE_IOUT_CHOPPING_CALIB_TYPE_GAIN);
-
-			if (ad7124_write_register(p_ad7124_dev,
-						  ad7124_register_map[AD7124_Config_0]) != SUCCESS) {
-				adc_error = true;
-			}
-
-			if (rtd_3wire_calibration_type == MEASURING_EXCITATION_CURRENT) {
-				/* Part 1: Perform the calibration on current RTD sensor */
-
-				/* Enable and direct IOUT0 excitation current source */
-				ad7124_register_map[AD7124_IOCon1].value |= (AD7124_IO_CTRL1_REG_IOUT_CH0(
-							rtd_3wire_iout0_source[chn]) | AD7124_IO_CTRL1_REG_IOUT0(
-							RTD_IOUT0_250UA_EXC));
-
-				if (ad7124_write_register(p_ad7124_dev,
-							  ad7124_register_map[AD7124_IOCon1]) != SUCCESS) {
-					adc_error = true;
-					break;
-				}
-
-				/* Read adc averaged sample result for Iout0 excitation */
-				if (perform_adc_conversion(RTD_3WIRE_REF_MEASUREMENT_CHN,
-							   &sample_data[RTD_3WIRE_REF_MEASUREMENT_CHN]) != SUCCESS) {
-					adc_error = true;
-					break;
-				}
+	do {
+		/* Perform additional configurations for 3-wire RTD */
+		if (do_3wire_rtd_configs(&multiple_3wire_rtd_enabled) != SUCCESS) {
+			printf(EOL EOL "\tError Performing Measurement" EOL);
+			adc_error = true;
+			break;
+		}
 
-				/* Get the equivalent ADC voltage */
-				voltage = ad7124_convert_sample_to_voltage(p_ad7124_dev,
-						RTD_3WIRE_REF_MEASUREMENT_CHN,
-						sample_data[RTD_3WIRE_REF_MEASUREMENT_CHN]);
-
-				/* Calculate equivalent Iout0 current flowing through Rref resistance */
-				iout[0] = voltage / RTD_RREF;
-
-				/* Turn off the Iout0 excitation current */
-				ad7124_register_map[AD7124_IOCon1].value &= ((~AD7124_IO_CTRL1_REG_IOUT0_MSK)
-						& (~AD7124_IO_CTRL1_REG_IOUT_CH0_MSK));
-
-				/* Enable and direct IOUT1 excitation current source */
-				ad7124_register_map[AD7124_IOCon1].value |= (AD7124_IO_CTRL1_REG_IOUT_CH1(
-							rtd_3wire_iout1_source[chn]) | AD7124_IO_CTRL1_REG_IOUT1(
-							RTD_IOUT1_250UA_EXC));
-
-				if (ad7124_write_register(p_ad7124_dev,
-							  ad7124_register_map[AD7124_IOCon1]) != SUCCESS) {
-					adc_error = true;
-					break;
-				}
+		if (!multiple_3wire_rtd_enabled) {
+			printf(EOL EOL
+			       "\tError in calibration!! Calibration is recommended only when multiple RTDs are connected"
+			       EOL);
 
-				/* Read adc averaged sample result for Iout1 excitation */
-				if (perform_adc_conversion(RTD_3WIRE_REF_MEASUREMENT_CHN,
-							   &sample_data[RTD_3WIRE_REF_MEASUREMENT_CHN]) != SUCCESS) {
-					adc_error = true;
-					break;
-				}
-
-				/* Get the equivalent ADC voltage */
-				voltage = ad7124_convert_sample_to_voltage(p_ad7124_dev,
-						RTD_3WIRE_REF_MEASUREMENT_CHN,
-						sample_data[RTD_3WIRE_REF_MEASUREMENT_CHN]);
-
-				/* Calculate equivalent Iout1 current flowing through Rref resistance */
-				iout[1] = voltage / RTD_RREF;
-
-				/* Turn off the Iout1 excitation current */
-				ad7124_register_map[AD7124_IOCon1].value &= ((~AD7124_IO_CTRL1_REG_IOUT1_MSK)
-						& (~AD7124_IO_CTRL1_REG_IOUT_CH1_MSK));
-
-				if (ad7124_write_register(p_ad7124_dev,
-							  ad7124_register_map[AD7124_IOCon1]) != SUCCESS) {
-					adc_error = true;
-					break;
-				}
-
-				/* Part 2: Perform the ADC sampling on calibrated RTD sensor channel */
+			adc_error = true;
+			break;
+		}
+	} while (0);
 
-				/* Change PGA to default value for performing measurement */
-				ad7124_register_map[AD7124_Config_0].value &= (~AD7124_CFG_REG_PGA_MSK);
-				ad7124_register_map[AD7124_Config_0].value |= AD7124_CFG_REG_PGA(
-							RTD_GAIN_VALUE);
-
-				if (ad7124_write_register(p_ad7124_dev,
-							  ad7124_register_map[AD7124_Config_0]) != SUCCESS) {
-					adc_error = true;
-				}
-
-				if (!do_rtc_sensor_adc_sampling(AD7124_CONFIG_3WIRE_RTD,
-								chn,
-								&sample_data[chn])) {
-					adc_error = true;
-					break;
-				}
-
-				/* Calculate Iout ratio and store the results */
-				store_rtd_calibrated_iout_ratio((iout[1] / iout[0]), true);
-			} else {
-				/* Calibration by Iout excitation chopping.
-				 * Part1: Direct the Iout excitation currents */
-
-				/* Enable and direct IOUT0 excitation current source */
-				ad7124_register_map[AD7124_IOCon1].value |= (AD7124_IO_CTRL1_REG_IOUT_CH0(
-							rtd_3wire_iout0_source[chn]) | AD7124_IO_CTRL1_REG_IOUT0(
-							RTD_IOUT0_250UA_EXC));
-
-				/* Enable and direct IOUT1 excitation current source */
-				ad7124_register_map[AD7124_IOCon1].value |= (AD7124_IO_CTRL1_REG_IOUT_CH1(
-							rtd_3wire_iout1_source[chn]) | AD7124_IO_CTRL1_REG_IOUT1(
-							RTD_IOUT1_250UA_EXC));
-
-				if (ad7124_write_register(p_ad7124_dev,
-							  ad7124_register_map[AD7124_IOCon1]) != SUCCESS) {
-					adc_error = true;
-					break;
-				}
-
-				/* Read adc averaged sample result for selected RTD sensor channel */
-				if (perform_adc_conversion(chn, &adc_raw[0]) != SUCCESS) {
-					adc_error = true;
-					break;
-				}
+	if (adc_error) {
+		adi_press_any_key_to_continue();
+		return MENU_CONTINUE;
+	}
 
-				/* Reset Iout registers for loading new configs */
-				ad7124_register_map[AD7124_IOCon1].value &= ((~AD7124_IO_CTRL1_REG_IOUT0_MSK)
-						& (~AD7124_IO_CTRL1_REG_IOUT_CH0_MSK) & (~AD7124_IO_CTRL1_REG_IOUT1_MSK)
-						& (~AD7124_IO_CTRL1_REG_IOUT_CH1_MSK));
-
-				/* Part2: Swap the Iout excitation sources and direct currents */
-
-				/* Enable and direct IOUT0 excitation current source */
-				ad7124_register_map[AD7124_IOCon1].value |= (AD7124_IO_CTRL1_REG_IOUT_CH0(
-							rtd_3wire_iout1_source[chn]) | AD7124_IO_CTRL1_REG_IOUT0(
-							RTD_IOUT0_250UA_EXC));
-
-				/* Enable and direct IOUT1 excitation current source */
-				ad7124_register_map[AD7124_IOCon1].value |= (AD7124_IO_CTRL1_REG_IOUT_CH1(
-							rtd_3wire_iout0_source[chn]) | AD7124_IO_CTRL1_REG_IOUT1(
-							RTD_IOUT1_250UA_EXC));
-
-				if (ad7124_write_register(p_ad7124_dev,
-							  ad7124_register_map[AD7124_IOCon1]) != SUCCESS) {
-					adc_error = true;
-					break;
-				}
+	if (measurement_type == CONTINUOUS_MEASUREMENT) {
+		printf(EOL"Press ESC key once to stop measurement..." EOL);
+		mdelay(1000);
+		continue_measurement = true;
+	}
 
-				/* Read adc averaged sample result for selected RTD sensor channel */
-				if (perform_adc_conversion(chn, &adc_raw[1]) != SUCCESS) {
-					adc_error = true;
-					break;
-				}
-
-				/* Turn off the excitation currents */
-				ad7124_register_map[AD7124_IOCon1].value &= ((~AD7124_IO_CTRL1_REG_IOUT0_MSK)
-						& (~AD7124_IO_CTRL1_REG_IOUT_CH0_MSK) & (~AD7124_IO_CTRL1_REG_IOUT1_MSK)
-						& (~AD7124_IO_CTRL1_REG_IOUT_CH1_MSK));
-
-				if (ad7124_write_register(p_ad7124_dev,
-							  ad7124_register_map[AD7124_IOCon1]) != SUCCESS) {
-					adc_error = true;
-					break;
-				}
-
-				/* Get ADC averaged result */
-				sample_data[chn] = (adc_raw[0] + adc_raw[1]) / 2;
-			}
-
-			/* Calculate temperature from the RTD resistence */
-			temperature = get_rtd_temperature(sample_data[chn]);
-
-			printf("\t   RTD%d           %.4f" EOL, chn + 1, temperature);
-
-			/* Reset the calibration constant value after measurement */
-			store_rtd_calibrated_iout_ratio(1, false);
+	/* Print display header */
+	printf(EOL EOL EOL);
+	for (uint8_t chn = SENSOR_CHANNEL0;
+	     chn < max_supported_sensors[AD7124_CONFIG_3WIRE_RTD]; chn++) {
+		if (sensor_enable_status[chn]) {
+			printf(VT100_MOVE_UP_1_LINE "%s  RTD%d" EOL,
+			       tab_cnt_str[tab_cnt++], chn + 1);
 		}
 	}
+	tab_cnt = 0;
+	printf("\t-----------------------------------------------" EOL EOL);
 
-	if (adc_error) {
-		printf(EOL EOL "\tError Performing Measurement" EOL);
-	}
+	do {
+		/* Calibrate, Sample and Read all enabled RTD channels in sequence */
+		for (uint8_t chn = SENSOR_CHANNEL0;
+		     (chn < max_supported_sensors[AD7124_CONFIG_3WIRE_RTD]) && (!adc_error);
+		     chn++) {
+			if (sensor_enable_status[chn]) {
+				if (rtd_3wire_calibration_type == MEASURING_EXCITATION_CURRENT) {
+					/* Part 1: Perform the calibration on current RTD sensor */
+
+					/* Enable and direct IOUT0 excitation current source */
+					ad7124_register_map[AD7124_IOCon1].value |= (AD7124_IO_CTRL1_REG_IOUT_CH0(
+								rtd_3wire_iout0_source[chn]) | AD7124_IO_CTRL1_REG_IOUT0(
+								RTD_IOUT0_250UA_EXC));
+
+					if (ad7124_write_register(p_ad7124_dev,
+								  ad7124_register_map[AD7124_IOCon1]) != SUCCESS) {
+						adc_error = true;
+						break;
+					}
+
+					/* Read adc averaged sample result for Iout0 excitation */
+					if (perform_adc_conversion(RTD_3WIRE_REF_MEASUREMENT_CHN,
+								   &n_sample_data[RTD_3WIRE_REF_MEASUREMENT_CHN],
+								   measurement_type) != SUCCESS) {
+						adc_error = true;
+						break;
+					}
+
+					if (measurement_type == AVERAGED_MEASUREMENT) {
+						/* Get the equivalent ADC voltage */
+						voltage = ad7124_convert_sample_to_voltage(p_ad7124_dev,
+								RTD_3WIRE_REF_MEASUREMENT_CHN, n_sample_data[RTD_3WIRE_REF_MEASUREMENT_CHN][0]);
+
+						/* Calculate equivalent Iout0 current flowing through Rref resistance */
+						rtd_calib_iout[0][0] = voltage / get_rtd_rref();
+					} else {
+						for (sample_cnt = 0; sample_cnt < MAX_ADC_SAMPLES; sample_cnt++) {
+							/* Get the equivalent ADC voltage */
+							voltage = ad7124_convert_sample_to_voltage(p_ad7124_dev,
+									RTD_3WIRE_REF_MEASUREMENT_CHN,
+									n_sample_data[RTD_3WIRE_REF_MEASUREMENT_CHN][sample_cnt]);
+
+							/* Calculate equivalent Iout0 current flowing through Rref resistance */
+							rtd_calib_iout[0][sample_cnt] = voltage / get_rtd_rref();
+						}
+					}
+
+					/* Turn off the Iout0 excitation current */
+					ad7124_register_map[AD7124_IOCon1].value &= ((~AD7124_IO_CTRL1_REG_IOUT0_MSK)
+							& (~AD7124_IO_CTRL1_REG_IOUT_CH0_MSK));
+
+					/* Enable and direct IOUT1 excitation current source */
+					ad7124_register_map[AD7124_IOCon1].value |= (AD7124_IO_CTRL1_REG_IOUT_CH1(
+								rtd_3wire_iout1_source[chn]) | AD7124_IO_CTRL1_REG_IOUT1(
+								RTD_IOUT1_250UA_EXC));
+
+					if (ad7124_write_register(p_ad7124_dev,
+								  ad7124_register_map[AD7124_IOCon1]) != SUCCESS) {
+						adc_error = true;
+						break;
+					}
+
+					/* Read adc averaged sample result for Iout1 excitation */
+					if (perform_adc_conversion(RTD_3WIRE_REF_MEASUREMENT_CHN,
+								   &n_sample_data[RTD_3WIRE_REF_MEASUREMENT_CHN],
+								   measurement_type) != SUCCESS) {
+						adc_error = true;
+						break;
+					}
+
+					if (measurement_type == AVERAGED_MEASUREMENT) {
+						/* Get the equivalent ADC voltage */
+						voltage = ad7124_convert_sample_to_voltage(p_ad7124_dev,
+								RTD_3WIRE_REF_MEASUREMENT_CHN,
+								n_sample_data[RTD_3WIRE_REF_MEASUREMENT_CHN][0]);
+
+						/* Calculate equivalent Iout1 current flowing through Rref resistance */
+						rtd_calib_iout[1][0] = voltage / get_rtd_rref();
+					} else {
+						for (sample_cnt = 0; sample_cnt < MAX_ADC_SAMPLES; sample_cnt++) {
+							/* Get the equivalent ADC voltage */
+							voltage = ad7124_convert_sample_to_voltage(p_ad7124_dev,
+									RTD_3WIRE_REF_MEASUREMENT_CHN,
+									n_sample_data[RTD_3WIRE_REF_MEASUREMENT_CHN][sample_cnt]);
+
+							/* Calculate equivalent Iout1 current flowing through Rref resistance */
+							rtd_calib_iout[1][sample_cnt] = voltage / get_rtd_rref();
+						}
+					}
+
+					/* Turn off the Iout1 excitation current */
+					ad7124_register_map[AD7124_IOCon1].value &= ((~AD7124_IO_CTRL1_REG_IOUT1_MSK)
+							& (~AD7124_IO_CTRL1_REG_IOUT_CH1_MSK));
+
+					if (ad7124_write_register(p_ad7124_dev,
+								  ad7124_register_map[AD7124_IOCon1]) != SUCCESS) {
+						adc_error = true;
+						break;
+					}
+
+					/* Part 2: Perform the ADC sampling on calibrated RTD sensor channel */
+					if (!do_rtd_sensor_adc_sampling(AD7124_CONFIG_3WIRE_RTD,
+									chn, &n_sample_data[chn], measurement_type, multiple_3wire_rtd_enabled)) {
+						adc_error = true;
+						break;
+					}
+				} else {
+					/* Calibration by Iout excitation chopping.
+					 * Part1: Direct the Iout excitation currents */
+
+					/* Enable and direct IOUT0 excitation current source */
+					ad7124_register_map[AD7124_IOCon1].value |= (AD7124_IO_CTRL1_REG_IOUT_CH0(
+								rtd_3wire_iout0_source[chn]) | AD7124_IO_CTRL1_REG_IOUT0(
+								RTD_IOUT0_250UA_EXC));
 
-	/* Change PGA back to default value */
-	ad7124_register_map[AD7124_Config_0].value &= (~AD7124_CFG_REG_PGA_MSK);
-	ad7124_register_map[AD7124_Config_0].value |= AD7124_CFG_REG_PGA(
-				RTD_GAIN_VALUE);
+					/* Enable and direct IOUT1 excitation current source */
+					ad7124_register_map[AD7124_IOCon1].value |= (AD7124_IO_CTRL1_REG_IOUT_CH1(
+								rtd_3wire_iout1_source[chn]) | AD7124_IO_CTRL1_REG_IOUT1(
+								RTD_IOUT1_250UA_EXC));
+
+					if (ad7124_write_register(p_ad7124_dev,
+								  ad7124_register_map[AD7124_IOCon1]) != SUCCESS) {
+						adc_error = true;
+						break;
+					}
+
+					/* Read adc averaged sample result for selected RTD sensor channel */
+					if (perform_adc_conversion(chn, &sample_data[0],
+								   measurement_type) != SUCCESS) {
+						adc_error = true;
+						break;
+					}
+
+					/* Reset Iout registers for loading new configs */
+					ad7124_register_map[AD7124_IOCon1].value &= ((~AD7124_IO_CTRL1_REG_IOUT0_MSK)
+							& (~AD7124_IO_CTRL1_REG_IOUT_CH0_MSK) & (~AD7124_IO_CTRL1_REG_IOUT1_MSK)
+							& (~AD7124_IO_CTRL1_REG_IOUT_CH1_MSK));
+
+					/* Part2: Swap the Iout excitation sources and direct currents */
+
+					/* Enable and direct IOUT0 excitation current source */
+					ad7124_register_map[AD7124_IOCon1].value |= (AD7124_IO_CTRL1_REG_IOUT_CH0(
+								rtd_3wire_iout1_source[chn]) | AD7124_IO_CTRL1_REG_IOUT0(
+								RTD_IOUT0_250UA_EXC));
+
+					/* Enable and direct IOUT1 excitation current source */
+					ad7124_register_map[AD7124_IOCon1].value |= (AD7124_IO_CTRL1_REG_IOUT_CH1(
+								rtd_3wire_iout0_source[chn]) | AD7124_IO_CTRL1_REG_IOUT1(
+								RTD_IOUT1_250UA_EXC));
+
+					if (ad7124_write_register(p_ad7124_dev,
+								  ad7124_register_map[AD7124_IOCon1]) != SUCCESS) {
+						adc_error = true;
+						break;
+					}
+
+					/* Read adc averaged sample result for selected RTD sensor channel */
+					if (perform_adc_conversion(chn, &sample_data[1],
+								   measurement_type) != SUCCESS) {
+						adc_error = true;
+						break;
+					}
+
+					/* Turn off the excitation currents */
+					ad7124_register_map[AD7124_IOCon1].value &= ((~AD7124_IO_CTRL1_REG_IOUT0_MSK)
+							& (~AD7124_IO_CTRL1_REG_IOUT_CH0_MSK) & (~AD7124_IO_CTRL1_REG_IOUT1_MSK)
+							& (~AD7124_IO_CTRL1_REG_IOUT_CH1_MSK));
+
+					if (ad7124_write_register(p_ad7124_dev,
+								  ad7124_register_map[AD7124_IOCon1]) != SUCCESS) {
+						adc_error = true;
+						break;
+					}
 
-	if (ad7124_write_register(p_ad7124_dev,
-				  ad7124_register_map[AD7124_Config_0]) != SUCCESS) {
-		adc_error = true;
-	}
+					/* Get ADC averaged result */
+					if (measurement_type == AVERAGED_MEASUREMENT) {
+						n_sample_data[chn][0] = (sample_data[0][0] + sample_data[1][0]) / 2;
+					} else {
+						for (sample_cnt = 0; sample_cnt < MAX_ADC_SAMPLES; sample_cnt++) {
+							n_sample_data[chn][sample_cnt] = (sample_data[0][sample_cnt] +
+											  sample_data[1][sample_cnt]) / 2;
+						}
+					}
+				}
+			}
+		}
+
+		if (adc_error) {
+			printf(EOL EOL "\tError Performing Measurement" EOL);
+			break;
+		} else {
+			/* Calculate temperature and display result */
+			if (measurement_type == AVERAGED_MEASUREMENT) {
+				for (uint8_t chn = SENSOR_CHANNEL0;
+				     chn < max_supported_sensors[AD7124_CONFIG_3WIRE_RTD];
+				     chn++) {
+					if (sensor_enable_status[chn]) {
+						if (rtd_3wire_calibration_type == MEASURING_EXCITATION_CURRENT) {
+							store_rtd_calibrated_iout_ratio((rtd_calib_iout[1][0] /
+											 rtd_calib_iout[0][0]), true);
+						}
+
+						temperature = get_rtd_temperature(n_sample_data[chn][0], MULTI_3WIRE_RTD_GAIN);
+						printf(VT100_MOVE_UP_1_LINE "%s  %.3f" EOL,
+						       tab_cnt_str[tab_cnt++], temperature);
+					}
+				}
+				tab_cnt = 0;
+			} else {
+				for (sample_cnt = 0; sample_cnt < MAX_ADC_SAMPLES; sample_cnt++) {
+					for (uint8_t chn = SENSOR_CHANNEL0;
+					     chn < max_supported_sensors[AD7124_CONFIG_3WIRE_RTD];
+					     chn++) {
+						if (sensor_enable_status[chn]) {
+							if (rtd_3wire_calibration_type == MEASURING_EXCITATION_CURRENT) {
+								store_rtd_calibrated_iout_ratio((rtd_calib_iout[1][sample_cnt] /
+												 rtd_calib_iout[0][sample_cnt]), true);
+							}
+
+							temperature = get_rtd_temperature(n_sample_data[chn][sample_cnt],
+											  MULTI_3WIRE_RTD_GAIN);
+							printf(VT100_MOVE_UP_1_LINE "%s  %.3f" EOL,
+							       tab_cnt_str[tab_cnt++], temperature);
+						}
+					}
+					printf(EOL);
+					tab_cnt = 0;
+				}
+			}
+		}
+	} while (continue_measurement && !was_escape_key_pressed());
+
+	/* Reset the calibration constant value after measurement */
+	store_rtd_calibrated_iout_ratio(1, false);
 
 	/* Put ADC into standby mode */
 	ad7124_register_map[AD7124_ADC_Control].value &= (~AD7124_ADC_CTRL_REG_MSK);
@@ -768,50 +1045,82 @@
 
 /*!
  * @brief	Perform the multiple NTC thermistor sensors measurement
- * @param	ntc_config_id[in]- NTC Sensor config ID
+ * @param	measurement_type[in]- Temperature measurement and display type
  * @return	MENU_CONTINUE
  */
-int32_t perform_ntc_thermistor_measurement(uint32_t ntc_config_id)
+int32_t perform_ntc_thermistor_measurement(uint32_t measurement_type)
 {
-	int32_t sample_data[MAX_NTC_THERMISTOR_SENSORS];
 	bool adc_error = false;
+	uint16_t sample_cnt;
+	bool continue_measurement = false;
+	uint8_t tab_cnt = 0;
 	float temperature;
 
-	printf(EOL EOL EOL);
-
-	/* Sample and Read all enabled NTC channels in sequence */
-	for (uint8_t chn = SENSOR_CHANNEL0; chn < max_supported_sensors[ntc_config_id];
-	     chn++) {
-		if (sensor_enable_status[chn]) {
-			printf(VT100_MOVE_UP_1_LINE
-			       "Thermistor temperature measurement in progress%s" EOL,
-			       temp_measurement_status[chn]);
-
-			/* Read adc averaged sample result */
-			if (perform_adc_conversion(chn, &sample_data[chn]) != SUCCESS) {
-				adc_error = true;
-				break;
-			}
-		}
+	if (measurement_type == CONTINUOUS_MEASUREMENT) {
+		printf(EOL"Press ESC key once to stop measurement..." EOL);
+		mdelay(1000);
+		continue_measurement = true;
 	}
 
-	if (adc_error) {
-		printf(EOL EOL "\tError Performing Measurement" EOL);
-	} else {
-		/* Print the temperature measurement results */
-		printf(EOL EOL "\tNTC Sensor    Temperature (C)" EOL);
-		printf("\t-----------------------------" EOL);
+	/* Print display header */
+	printf(EOL EOL EOL);
+	for (uint8_t chn = SENSOR_CHANNEL0;
+	     chn < max_supported_sensors[AD7124_CONFIG_THERMISTOR]; chn++) {
+		if (sensor_enable_status[chn]) {
+			printf(VT100_MOVE_UP_1_LINE "%s  NTC%d" EOL,
+			       tab_cnt_str[tab_cnt++], chn + 1);
+		}
+	}
+	tab_cnt = 0;
+	printf("\t-----------------------------------------------" EOL EOL);
 
-		for (uint8_t chn = SENSOR_CHANNEL0; chn < max_supported_sensors[ntc_config_id];
+	do {
+		/* Sample and Read all enabled NTC channels in sequence */
+		for (uint8_t chn = SENSOR_CHANNEL0;
+		     chn < max_supported_sensors[AD7124_CONFIG_THERMISTOR];
 		     chn++) {
 			if (sensor_enable_status[chn]) {
-				/* Get the NTC temperature */
-				temperature = get_ntc_thermistor_temperature(sample_data[chn]);
-
-				printf("\t   NTC%d           %.4f" EOL, chn + 1, temperature);
+				if (perform_adc_conversion(chn, &n_sample_data[chn],
+							   measurement_type) != SUCCESS) {
+					adc_error = true;
+					break;
+				}
 			}
 		}
-	}
+
+		if (adc_error) {
+			printf(EOL EOL "\tError Performing Measurement" EOL);
+			break;
+		} else {
+			/* Calculate temperature and display result */
+			if (measurement_type == AVERAGED_MEASUREMENT) {
+				for (uint8_t chn = SENSOR_CHANNEL0;
+				     chn < max_supported_sensors[AD7124_CONFIG_THERMISTOR];
+				     chn++) {
+					if (sensor_enable_status[chn]) {
+						temperature = get_ntc_thermistor_temperature(n_sample_data[chn][0]);
+						printf(VT100_MOVE_UP_1_LINE "%s  %.3f" EOL,
+						       tab_cnt_str[tab_cnt++], temperature);
+					}
+				}
+				tab_cnt = 0;
+			} else {
+				for (sample_cnt = 0; sample_cnt < MAX_ADC_SAMPLES; sample_cnt++) {
+					for (uint8_t chn = SENSOR_CHANNEL0;
+					     chn < max_supported_sensors[AD7124_CONFIG_THERMISTOR];
+					     chn++) {
+						if (sensor_enable_status[chn]) {
+							temperature = get_ntc_thermistor_temperature(n_sample_data[chn][sample_cnt]);
+							printf(VT100_MOVE_UP_1_LINE "%s  %.3f" EOL,
+							       tab_cnt_str[tab_cnt++], temperature);
+						}
+					}
+					printf(EOL);
+					tab_cnt = 0;
+				}
+			}
+		}
+	} while (continue_measurement && !was_escape_key_pressed());
 
 	/* Put ADC into standby mode */
 	ad7124_register_map[AD7124_ADC_Control].value &= (~AD7124_ADC_CTRL_REG_MSK);
@@ -826,34 +1135,56 @@
 
 /*!
  * @brief	Perform the cold junction compensation (CJC) measurement
- * @param	*data[out]- Pointer to variable to read data into
+ * @param	*data[out]- Pointer to array to read data into
+ * @param	measurement_type[in]- Temperature measurement and display type
  * @return	SUCCESS/FAILURE
  * @note	Both CJCs uses similar excitation and ratiometric measurement
  *			logic
  */
-int32_t perform_cjc_measurement(int32_t *data)
+int32_t perform_cjc_measurement(int32_t (*data)[MAX_ADC_SAMPLES],
+				sensor_measurement_type measurement_type)
 {
 	int32_t iout0_input, iout_exc;
 	int32_t input_chn;
+	int32_t gain;
+	uint8_t setup;
 
 	switch (current_cjc_sensor) {
 	case PT100_4WIRE_RTD:
-	case PT1000_4WIRE_RTD:
-		iout0_input = CJC_4WIRE_RTD_IOUT0;
-		iout_exc = CJC_4WIRE_RTD_IOUT0_EXC;
+		iout0_input = CJC_RTD_IOUT0;
+		iout_exc = CJC_RTD_IOUT0_EXC;
 		input_chn = CJC_RTD_CHN;
+		gain = RTD_4WIRE_GAIN_VALUE;
+		break;
+
+	case PT1000_2WIRE_RTD:
+		iout0_input = CJC_RTD_IOUT0;
+		iout_exc = CJC_RTD_IOUT0_EXC;
+		input_chn = CJC_RTD_CHN;
+		gain = RTD_PT1000_GAIN_VALUE;
 		break;
 
 	case THERMISTOR_PTC_KY81_110:
 		iout0_input = CJC_PTC_THERMISTOR_IOUT0;
 		iout_exc = CJC_PTC_THERMISTOR_IOUT0_EXC;
 		input_chn = CJC_THERMISTOR_CHN;
+		gain = THERMISTOR_GAIN_VALUE;
 		break;
 
 	default:
 		return FAILURE;
 	}
 
+	setup = ad7124_get_channel_setup(p_ad7124_dev, input_chn);
+
+	/* Set the gain corresponding to selected CJC sensor */
+	ad7124_register_map[AD7124_Config_0 + setup].value &= (~AD7124_CFG_REG_PGA_MSK);
+	ad7124_register_map[AD7124_Config_0 + setup].value |= AD7124_CFG_REG_PGA(gain);
+	if (ad7124_write_register(p_ad7124_dev,
+				  ad7124_register_map[AD7124_Config_0 + setup]) != SUCCESS) {
+		return FAILURE;
+	}
+
 	/* Enable and direct IOUT0 excitation current source for CJ sensor measurement */
 	ad7124_register_map[AD7124_IOCon1].value |= (AD7124_IO_CTRL1_REG_IOUT_CH0(
 				iout0_input) | AD7124_IO_CTRL1_REG_IOUT0(iout_exc));
@@ -862,8 +1193,7 @@
 		return FAILURE;
 	}
 
-	/* Read adc averaged sample result */
-	if (perform_adc_conversion(input_chn, data) == FAILURE) {
+	if (perform_adc_conversion(input_chn, data, measurement_type) == FAILURE) {
 		return FAILURE;
 	}
 
@@ -881,14 +1211,18 @@
 
 /*!
  * @brief	Perform the multiple thermocouple sensors measurement
- * @param	tc_config_id[in]- Thermocouple Sensor config ID
+ * @param	measurement_type[in]- Temperature measurement and display type
  * @return	MENU_CONTINUE
  */
-int32_t perform_thermocouple_measurement(uint32_t tc_config_id)
+int32_t perform_thermocouple_measurement(uint32_t measurement_type)
 {
-	int32_t sample_data[MAX_THERMOCOUPLE_SENSORS][2];	// tc + cjc
 	bool adc_error = false;
-	float temperature;
+	uint8_t setup;
+	uint16_t sample_cnt;
+	bool continue_measurement = false;
+	float tc_temperature;
+	float cjc_temperature;
+	uint8_t tab_cnt = 0;
 
 #if defined(AD7124_8)
 	const int32_t tc_vbias_input[] = {
@@ -902,63 +1236,126 @@
 	};
 #endif
 
-	printf(EOL EOL EOL);
+	if (measurement_type == CONTINUOUS_MEASUREMENT) {
+		printf(EOL"Press ESC key once to stop measurement..." EOL);
+		mdelay(1000);
+		continue_measurement = true;
+	}
 
-	/* Sample and Read all enabled Thermocouple channels in sequence */
-	for (uint8_t chn = SENSOR_CHANNEL0; chn < max_supported_sensors[tc_config_id];
-	     chn++) {
+	/* Print display header */
+	printf(EOL EOL EOL);
+	for (uint8_t chn = SENSOR_CHANNEL0;
+	     chn < max_supported_sensors[AD7124_CONFIG_THERMOCOUPLE]; chn++) {
 		if (sensor_enable_status[chn]) {
-			/* Turn on the bias voltage for current thermocouple input (AINP) */
-			ad7124_register_map[AD7124_IOCon2].value |= tc_vbias_input[chn];
-			if (ad7124_write_register(p_ad7124_dev,
-						  ad7124_register_map[AD7124_IOCon2]) != SUCCESS) {
-				adc_error = true;
-				break;
+			if (tab_cnt == 0) {
+				printf("\t  TC%d    CJC" EOL, chn+1);
+			} else {
+				printf(VT100_MOVE_UP_1_LINE "%s%s    TC%d    CJC" EOL,
+				       tab_cnt_str[tab_cnt], tab_cnt_str[tab_cnt-1], chn+1);
 			}
+			tab_cnt++;
+		}
+	}
+	tab_cnt = 0;
+	printf("\t----------------------------------------------------------------------------------------------"
+	       EOL EOL);
 
-			printf(VT100_MOVE_UP_1_LINE
-			       "Thermocouple temperature measurement in progress%s" EOL,
-			       temp_measurement_status[chn]);
+	do {
+		/* Sample and Read all enabled TC channels in sequence */
+		for (uint8_t chn = SENSOR_CHANNEL0;
+		     chn < max_supported_sensors[AD7124_CONFIG_THERMOCOUPLE];
+		     chn++) {
+			if (sensor_enable_status[chn]) {
+				/* Turn on the bias voltage for current thermocouple input (AINP) */
+				ad7124_register_map[AD7124_IOCon2].value |= tc_vbias_input[chn];
+				if (ad7124_write_register(p_ad7124_dev,
+							  ad7124_register_map[AD7124_IOCon2]) != SUCCESS) {
+					adc_error = true;
+					break;
+				}
 
-			/* Read adc averaged sample result */
-			if (perform_adc_conversion(chn, &sample_data[chn][0]) == FAILURE) {
-				adc_error = true;
-				break;
-			}
+				if (perform_adc_conversion(chn, &n_sample_data[chn],
+							   measurement_type) != SUCCESS) {
+					adc_error = true;
+					break;
+				}
 
-			/* Turn off the bias voltage for all analog inputs */
-			ad7124_register_map[AD7124_IOCon2].value = 0x0;
-			if (ad7124_write_register(p_ad7124_dev,
-						  ad7124_register_map[AD7124_IOCon2]) != SUCCESS) {
-				adc_error = true;
-				break;
+				/* Turn off the bias voltage for all analog inputs */
+				ad7124_register_map[AD7124_IOCon2].value = 0x0;
+				if (ad7124_write_register(p_ad7124_dev,
+							  ad7124_register_map[AD7124_IOCon2]) != SUCCESS) {
+					adc_error = true;
+					break;
+				}
+
+				/* Perform measurement for the cold junction compensation sensor */
+				if (perform_cjc_measurement(&n_cjc_sample_data[chn],
+							    measurement_type) != SUCCESS) {
+					adc_error = true;
+					break;
+				}
+
+				setup = ad7124_get_channel_setup(p_ad7124_dev, chn);
+
+				/* Change gain back to thermocouple sensor gain */
+				ad7124_register_map[AD7124_Config_0 + setup].value &= (~AD7124_CFG_REG_PGA_MSK);
+				ad7124_register_map[AD7124_Config_0 + setup].value |= AD7124_CFG_REG_PGA(
+							THERMOCOUPLE_GAIN_VALUE);
+				if (ad7124_write_register(p_ad7124_dev,
+							  ad7124_register_map[AD7124_Config_0 + setup]) != SUCCESS) {
+					adc_error = true;
+					break;
+				}
 			}
-
-			/* Perform measurement for the cold junction compensation sensor */
-			perform_cjc_measurement(&sample_data[chn][1]);
 		}
 
-		if (adc_error)
+		if (adc_error) {
+			printf(EOL EOL "\tError Performing Measurement" EOL);
 			break;
-	}
-
-	if (adc_error) {
-		printf(EOL EOL "\tError Performing Measurement" EOL);
-	} else {
-		/* Print the temperature measurement results */
-		printf(EOL EOL "\tTC Sensor    Temperature (C)" EOL);
-		printf("\t-----------------------------" EOL);
-
-		for (uint8_t chn = SENSOR_CHANNEL0; chn < max_supported_sensors[tc_config_id];
-		     chn++) {
-			if (sensor_enable_status[chn]) {
-				temperature = get_tc_temperature(sample_data[chn][0], sample_data[chn][1],
-								 current_cjc_sensor);
-
-				printf("\t   TC%d           %.4f" EOL, chn + 1, temperature);
+		} else {
+			/* Calculate temperature and display result */
+			if (measurement_type == AVERAGED_MEASUREMENT) {
+				for (uint8_t chn = SENSOR_CHANNEL0;
+				     chn < max_supported_sensors[AD7124_CONFIG_THERMOCOUPLE];
+				     chn++) {
+					if (sensor_enable_status[chn]) {
+						tc_temperature = get_tc_temperature(n_sample_data[chn][0],
+										    n_cjc_sample_data[chn][0], current_cjc_sensor,
+										    &cjc_temperature);
+						if (tab_cnt == 0) {
+							printf("\t %.3f  %.3f" EOL, tc_temperature, cjc_temperature);
+						} else {
+							printf(VT100_MOVE_UP_1_LINE "%s%s    %.3f  %.3f" EOL,
+							       tab_cnt_str[tab_cnt], tab_cnt_str[tab_cnt-1], tc_temperature, cjc_temperature);
+						}
+						tab_cnt++;
+					}
+				}
+				tab_cnt = 0;
+			} else {
+				for (sample_cnt = 0; sample_cnt < MAX_ADC_SAMPLES; sample_cnt++) {
+					for (uint8_t chn = SENSOR_CHANNEL0;
+					     chn < max_supported_sensors[AD7124_CONFIG_THERMOCOUPLE];
+					     chn++) {
+						if (sensor_enable_status[chn]) {
+							tc_temperature = get_tc_temperature(n_sample_data[chn][sample_cnt],
+											    n_cjc_sample_data[chn][sample_cnt], current_cjc_sensor,
+											    &cjc_temperature);
+							if (tab_cnt == 0) {
+								printf("\t %.3f  %.3f" EOL, tc_temperature, cjc_temperature);
+							} else {
+								printf(VT100_MOVE_UP_1_LINE "%s%s    %.3f  %.3f" EOL,
+								       tab_cnt_str[tab_cnt], tab_cnt_str[tab_cnt-1], tc_temperature, cjc_temperature);
+							}
+							tab_cnt++;
+						}
+					}
+					printf(EOL);
+					tab_cnt = 0;
+				}
 			}
 		}
-	}
+	} while (continue_measurement && !was_escape_key_pressed());
 
 	/* Put ADC into standby mode */
 	ad7124_register_map[AD7124_ADC_Control].value &= (~AD7124_ADC_CTRL_REG_MSK);
@@ -1319,6 +1716,13 @@
 	       RTD4_3WIRE_AINM,
 	       status_info[sensor_enable_status[SENSOR_CHANNEL3]]);
 #endif
+
+	printf("\t -------------------------------------------------------------------"
+	       EOL);
+	printf("\tNote: For single   RTD measurement, connect Rref at the higher side"
+	       EOL);
+	printf("\t      For multiple RTD measurement, connect Rref at the lower side"
+	       EOL);
 }
 
 
@@ -1388,13 +1792,6 @@
 		printf("\t ------------------------------------------------------" EOL);
 		rtd_3wire_menu_header();
 	}
-
-	printf("\t -------------------------------------------------------------------"
-	       EOL);
-	printf("\tNote: For single   RTD measurement, connect Rref at the higher side"
-	       EOL);
-	printf("\t      For multiple RTD measurement, connect Rref at the lower side"
-	       EOL);
 }
 
 
@@ -1543,13 +1940,13 @@
 
 	switch (current_cjc_sensor) {
 	case PT100_4WIRE_RTD:
-	case PT1000_4WIRE_RTD:
+	case PT1000_2WIRE_RTD:
 		printf("\t  CJC      %d       AIN%d   AIN%d    AIN%d     Y"
 		       EOL,
 		       CJC_RTD_CHN,
-		       CJC_4WIRE_RTD_IOUT0,
-		       CJC_4WIRE_RTD_AINP,
-		       CJC_4WIRE_RTD_AINM);
+		       CJC_RTD_IOUT0,
+		       CJC_RTD_AINP,
+		       CJC_RTD_AINM);
 		break;
 
 	case THERMISTOR_PTC_KY81_110:
@@ -1677,6 +2074,27 @@
 }
 
 
+/*!
+ * @brief	Display ADC calibration main menu
+ * @param	menu_id[in]- Optional menu ID
+ * @return	MENU_CONTINUE
+ */
+int32_t reset_device_config(uint32_t menu_id)
+{
+	if (init_with_configuration(AD7124_CONFIG_RESET) != SUCCESS) {
+		printf(EOL "\t Error resetting config!!" EOL);
+		adi_press_any_key_to_continue();
+	} else {
+		/* Disable all sensor channels except channel 0 */
+		for (uint8_t chn = SENSOR_CHANNEL1; chn < NUM_OF_SENSOR_CHANNELS; chn++) {
+			sensor_enable_status[chn] = false;
+		}
+	}
+
+	return MENU_CONTINUE;
+}
+
+
 /* =========== Menu Declarations =========== */
 
 static console_menu_item rtd_2wire_menu_items[] = {
@@ -1688,7 +2106,9 @@
 	{ "Enable/Disable RTD5", '5', enable_disable_sensor, SENSOR_CHANNEL4 },
 #endif
 	{ " " },
-	{ "Perform Measurement", 'M', perform_rtd_measurement, AD7124_CONFIG_2WIRE_RTD },
+	{ "Perform Averaged Measurement", 'A', perform_2wire_rtd_measurement, AVERAGED_MEASUREMENT },
+	{ "Perform Single Measurement",   'S', perform_2wire_rtd_measurement, SINGLE_MEASUREMENT },
+	{ "Perform Continuos Measurement",'C', perform_2wire_rtd_measurement, CONTINUOUS_MEASUREMENT },
 };
 
 console_menu rtd_2wire_menu = {
@@ -1708,9 +2128,12 @@
 	{ "Enable/Disable RTD4", '4', enable_disable_sensor, SENSOR_CHANNEL3 },
 #endif
 	{ " " },
-	{ "Calibrate RTD and Perform Measurement",    'A', display_3wire_rtd_calibration_menu },
+	{ "Calibrate RTD and Perform Measurement",    'M', display_3wire_rtd_calibration_menu },
 	{ " " },
-	{ "Perform RTD Measurement (no calibration)", 'B', perform_rtd_measurement, AD7124_CONFIG_3WIRE_RTD },
+	{ "No Calibration Measurement:" },
+	{ "Perform Averaged Measurement", 'A', perform_3wire_rtd_measurement, AVERAGED_MEASUREMENT },
+	{ "Perform Single Measurement",   'S', perform_3wire_rtd_measurement, SINGLE_MEASUREMENT },
+	{ "Perform Continuos Measurement",'C', perform_3wire_rtd_measurement, CONTINUOUS_MEASUREMENT },
 };
 
 console_menu rtd_3wire_menu = {
@@ -1723,10 +2146,12 @@
 };
 
 static console_menu_item rtd_3wire_calibration_menu_items[] = {
-	{ "Change type to Measuring Excitation Current", 'A', change_3wire_rtd_calibration_type, MEASURING_EXCITATION_CURRENT },
-	{ "Change type to Chopping Excitation Current",  'B', change_3wire_rtd_calibration_type, CHOPPING_EXCITATION_CURRENT  },
+	{ "Change type to Measuring Excitation Current", 'E', change_3wire_rtd_calibration_type, MEASURING_EXCITATION_CURRENT },
+	{ "Change type to Chopping Excitation Current",  'P', change_3wire_rtd_calibration_type, CHOPPING_EXCITATION_CURRENT  },
 	{ " " },
-	{ "Perform Measurement", 'M', calibrate_and_measure_3wire_rtd },
+	{ "Perform Averaged Measurement", 'A', calibrate_and_measure_3wire_rtd, AVERAGED_MEASUREMENT },
+	{ "Perform Single Measurement",   'S', calibrate_and_measure_3wire_rtd, SINGLE_MEASUREMENT },
+	{ "Perform Continuos Measurement",'C', calibrate_and_measure_3wire_rtd, CONTINUOUS_MEASUREMENT },
 };
 
 console_menu rtd_3wire_calibration_menu = {
@@ -1747,7 +2172,9 @@
 	{ "Enable/Disable RTD5", '5', enable_disable_sensor, SENSOR_CHANNEL4 },
 #endif
 	{ " " },
-	{ "Perform Measurement", 'M', perform_rtd_measurement, AD7124_CONFIG_4WIRE_RTD },
+	{ "Perform Averaged Measurement", 'A', perform_4wire_rtd_measurement, AVERAGED_MEASUREMENT },
+	{ "Perform Single Measurement",   'S', perform_4wire_rtd_measurement, SINGLE_MEASUREMENT },
+	{ "Perform Continuos Measurement",'C', perform_4wire_rtd_measurement, CONTINUOUS_MEASUREMENT },
 };
 
 console_menu rtd_4wire_menu = {
@@ -1771,7 +2198,9 @@
 	{ "Enable/Disable NTC8", '8', enable_disable_sensor, SENSOR_CHANNEL7 },
 #endif
 	{ " " },
-	{ "Perform Measurement", 'M', perform_ntc_thermistor_measurement, AD7124_CONFIG_THERMISTOR },
+	{ "Perform Averaged Measurement",  'A', perform_ntc_thermistor_measurement, AVERAGED_MEASUREMENT },
+	{ "Perform Single Measurement",    'S', perform_ntc_thermistor_measurement, SINGLE_MEASUREMENT },
+	{ "Perform Continuos Measurement", 'C', perform_ntc_thermistor_measurement, CONTINUOUS_MEASUREMENT },
 };
 
 console_menu ntc_thermistor_menu = {
@@ -1795,9 +2224,11 @@
 	{ " " },
 	{ "Select CJC (PT100 4-wire RTD)",   '7', select_cjc_sensor, PT100_4WIRE_RTD    },
 	{ "Select CJC (PTC KY81/110 Thermistor)", '8', select_cjc_sensor, THERMISTOR_PTC_KY81_110 },
-	{ "Select CJC (PT1000 4-wire RTD)",  '9', select_cjc_sensor, PT1000_4WIRE_RTD   },
+	{ "Select CJC (PT1000 2-wire RTD)",  '9', select_cjc_sensor, PT1000_2WIRE_RTD   },
 	{ " " },
-	{ "Perform Measurement", 'M', perform_thermocouple_measurement, AD7124_CONFIG_THERMOCOUPLE },
+	{ "Perform Averaged Measurement", 'A', perform_thermocouple_measurement, AVERAGED_MEASUREMENT },
+	{ "Perform Single Measurement",   'S', perform_thermocouple_measurement, SINGLE_MEASUREMENT },
+	{ "Perform Continuos Measurement",'C', perform_thermocouple_measurement, CONTINUOUS_MEASUREMENT },
 };
 
 console_menu thermocouple_menu = {
@@ -1833,6 +2264,8 @@
 	{"Thermocouple",	'D',	display_thermocouple_menu    },
 	{"Thermistor",		'E',	display_ntc_thermistor_menu  },
 	{"Calibrate ADC",	'F',	display_adc_calibration_menu },
+	{ " " },
+	{"Reset Config",	'R',	reset_device_config, AD7124_CONFIG_RESET },
 };
 
 console_menu ad7124_main_menu = {