cancel
Showing results for 
Search instead for 
Did you mean: 

ADC multi mode operation. Please help :)

eergi
Associate II

I have a circuit, using stm32f100c6t, and there are 8 analog channels which I have to poll every 100 ms. one of the channels is rectified and filtered AC voltage, if this value is acceptable for operation, the circuit has a backup battery supply (lead acid, 12 volts) , and when the rectified value is greater than battery voltage, in every 5 minutes, I disconnect the battery from the system with a mosfet, and sink some current from the battery for 1 ms. this is for measuring the battery, if the battery is good, the current from the battery does not cause a sudden voltage drop, because the internal resistance of battery is low, some mili ohms. when the battery is bad, the voltage drop is more than 2 volts, and this means the battery is not reliable. the circuit turns on a led for signaling. I set the conversion for dma operation and 8 channels are scanned succesfully. when the 5 minute timer overflowed, I have to do a single scan for the battery connected to the an4 input via a voltage resistor. how can I interrupt the dma conversion and read a value for an4? the used channels are an1 thru an8. If the rectified ac voltage is low, that means the system is supplied by backup power source, and the health check should not run.

11 REPLIES 11

in another example I found in web,

here is a callback function

void HAL_ADCEx_InjectedConvCpltCallback ( ADC_HandleTypeDef * hadc )

{

ADC_Data [ 0 ] = HAL_ADCEx_InjectedGetValue ( hadc , ADC_INJECTED_RANK_1 ) ;

HAL_ADC_Start_IT ( & hadc1 ) ;

}

should we manually start the conversion again?

eergi
Associate II
  • in another example I found in web,
  •  
  • here is a callback function
  •  
  •  
  •  
  • void HAL_ADCEx_InjectedConvCpltCallback ( ADC_HandleTypeDef * hadc )
  • {
  • ADC_Data [ 0 ] = HAL_ADCEx_InjectedGetValue ( hadc , ADC_INJECTED_RANK_1 ) ;
  •  
  • HAL_ADC_Start_IT ( & hadc1 ) ;
  • }
  •  
  • should we manually start the conversion again?
  • Like
  • Reply
    • Select as Best
  •