2017-02-15 12:56 AM
Hi,
for my project I use external port interrupt. When it come, I have to do an ADC conversion. The interrupt come every 5 us....is it possible to have an ADC conversion after interrupt every 5us?
I'm using discovery kit with STM8S003K3 MCU for test
m
y software
. Can I use the stm8s library? Because from my last test I see that interrupt can not pass 15us....do you have some advice?
Thank you.
Paolo
#stm8-discovery #stm8 #adc #interrupt2017-02-21 06:48 PM
Hello,
For this function, you should be using the external trigger feature of the ADC:
Look at chapter 24.5.7 Conversion on external trigger of
.The SPL allows to use this mode.
BR
Max
2018-01-10 04:45 AM
If the interrupt comes EVERY 5us I'm afraid you cannot keep the pace. Suppose you work on internal 16MHz clock. With this clock you need to divide by 3 to get the ADC clock 5.33MHz (it must be max. 6MHz at 5V, 4MHz at 3V). A conversion takes 14 adc clks that means 14*3 = 42 cpu clock. Interrupt overhead is 11+11 = 22 cpu clocks. You have already a 64 clks total. 5us is 80 cpu clocks. There are only 16 cpu clks left for your work, both inside and outside the ISR! And you must read the conversion result, store it somewhere or do some usefull work with it, etc.