cancel
Showing results for 
Search instead for 
Did you mean: 

How to setup ADC for specific period of time and then stop taking readings??

jsoda.1
Associate III

Dear all, I am relatively new to STM 32 ADC setup. I am using STM32 L0 series

I want to read data from one ADC channel for 5 minutes, 15 minutes and 8 hours.

Duration will be set by user according to needs.

I Don't know where to start and is it even possible??

If yes then can you please explain steps??

I am really looking forward for reply. Thank you so much in advance (:

3 REPLIES 3
raptorhal2
Lead

Use the RTC for time of day hours, minutes and seconds.

Use while { } loop in main to read clock and turn ADC on and off.

User control can be via USART to PC USB adapter transmit and receive.

USART, RTC and ADC examples are provided with the HAL and Standard Peripheral Libraries.

Cheers, Hal

Thank you... I am using multiple ADC inputs with ​DMA... Is it okay??

I tried what you said but I want to display timer too. For example, if user sets 5 minutes then I want to show 5 minutes count down on display. Same things goes for 15 minutes, 1 hour and 8 hours.

Do you have any solution or idea for this?​

It would be a great help. Thanks again ​

raptorhal2
Lead

DMA is the preferred method for multiple ADC inputs.

Save the current RTC hour, minutes and seconds with each sample.

To progress further, read the STM32LO User Manual and the L0 Data Sheet documents and the USART, RTC and ADC examples provided with the L0 HAL and Standard Peripheral Libraries available on the ST website.

Cheers, Hal