Skip to main content
majd-ghadab
Associate II
June 28, 2018
Question

ADC INJECTED Wrong values reading

  • June 28, 2018
  • 1 reply
  • 1739 views
Posted on June 28, 2018 at 22:18

Hello everyone

i have a question, i am using 3 Ranks ADC injected mode for reading potential resistors..

the problem is when ever i change one value it affects the other channel reading.

example

channel 1

 reading is 1.3v

channel 2

 reading is 1.5v

channel 3 reading is 1.6v

changing only resistor value on channel 1 to 2.9v makes the following:

channel 1

 reading is 2.9v

channel 2

 reading is 1.7v

channel 3 reading is 1.7v

why when i change one value the others are affected !! or the second one affecting the third !

code is :

while (1)

{

HAL_ADCEx_InjectedStart(&hadc1);

HAL_ADC_PollForConversion(&hadc1,100);

u[0]=((float)HAL_ADCEx_InjectedGetValue(&hadc1,ADC_INJECTED_RANK_1))*3.0/4096.0;

u[1]=((float)HAL_ADCEx_InjectedGetValue(&hadc1,ADC_INJECTED_RANK_2))*3.0/4096.0;

u[2]=((float)HAL_ADCEx_InjectedGetValue(&hadc1,ADC_INJECTED_RANK_3))*3.0/4096.0;

HAL_ADCEx_InjectedStop(&hadc1);

sprintf(str, '%.2fv %.2fv %.2fv ', u[0], u[1], u[2]);

LCD_SetPos(0,0);

LCD_String(str);

HAL_Delay(200);

/* USER CODE END WHILE */

/* USER CODE BEGIN 3 */

}

#injected-adc
This topic has been closed for replies.

1 reply

IMaji
Associate II
December 18, 2018

Same problem.

Who knows why and how to fix it?

Tesla DeLorean
Guru
December 18, 2018

Perhaps use a sample time setting commensurate with your ability to change the charge level on the sampling capacitor?

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
IMaji
Associate II
December 19, 2018

Here is the mine configuration. I changed Sample time value but no changes.0690X000006Cs7TQAS.jpg