cancel
Showing results for 
Search instead for 
Did you mean: 

i want to reading multiple ADC channel on interrupt based how can i read that?

Hiren
Associate III
 
1 ACCEPTED SOLUTION

Accepted Solutions
Cristian Gyorgy
Senior III

Well, I can think of at least a dosen of ways to do that - you will have to be more explicit if you want an answer.

Depending on the MCU you have, you could use the ADC in continuous conversion mode, where the ADC scans multiple channels and the DMA transfers automatically the results into SRAM. Than, in the DMA interrupt you can process your results. This is a very efficient solution, and a great thing on an 8-bit MCU.

Reading and understanding the Reference Manual would be the best thing for you to do, like this you get a good idea of what you could do and how.

View solution in original post

4 REPLIES 4
Cristian Gyorgy
Senior III

Well, I can think of at least a dosen of ways to do that - you will have to be more explicit if you want an answer.

Depending on the MCU you have, you could use the ADC in continuous conversion mode, where the ADC scans multiple channels and the DMA transfers automatically the results into SRAM. Than, in the DMA interrupt you can process your results. This is a very efficient solution, and a great thing on an 8-bit MCU.

Reading and understanding the Reference Manual would be the best thing for you to do, like this you get a good idea of what you could do and how.

Hiren
Associate III

Thanks for reply

i use stm8s003 controller

i want use  ADC for voltage and current measurement.

so we required example code which read TWO adc channel read continuously on interrupt .

Please provide example code step of multiple ADC channel read on interrupt based.

Cristian Gyorgy
Senior III

Hi!

The STM8S003 does not have a DMA controller, so you'll have to manually handle each ADC conversion result (or set of results).

You can use it in single scan mode, or continuous scan mode - probably the continuous scan mode is appropriate if you want to monitor voltage and current.

You ask for sample code: this is not easy to get, as it depends a lot on the programming environment you use and how you want your software to work, but it's all very easy: setup the ADC in continuous conversion mode with the enabled channels that you need, enable the ADC interrupt and start the conversion. Than, the interrupt informs you when a new conversion set is ready.

Try reading and understanding the RM0016 manual, write your own code and if you encounter problems, just ask.

Hiren
Associate III

Thanks so much for provide a guidance.

we use two ADC channel 5 and 6 but i confuse how to read buffer 

and how to clear interrupt flag.

i required sample code only read multiple channel in continuous mode on interrupt based if it have this type of sample please provide us