ADC Interrupt Timer Frequency

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

In using the ADC Del-Sigma Converter component, I'd like to have a lower sampling rate - 500 Hz - so sampling every 2 mS. The internal and external clock components don't allow this. Is there a way to implement a delay in the interrupt routine to achieve that sampling rate? I'm pretty new to coding and am not sure how to implement either a delay or some sort of loop to have the interrupt sample at the lower frequency. Any suggestions would be greatly appreciated!

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum!

   

Interrupt routines should not implement delays as a general rule. The complete system may stall.

   

Easiest would be to implement a timer that fires every 2 ms, The handler should remove the interrupt cause and set a flag that indicates the situation. in the main loop when the flag is set, reset it and read a value from ADC which must be configured for single conversion.

   

 

   

Happy coding!

   

Bob

0 Likes
Anonymous
Not applicable

Would you know of a good example of sample code for a timer firing and reset? I have been following the ADC and UART example that comes with the 059 Psoc 5lp kit. The project goal is to sample analog readings from a pulse sensor, convert them to digital, calculate a heart rate, and send through a UART.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Creator -> Start page -> Find code example -> PSoC5LP, Timer.

   

Same with UART

   

 

   

Bob

0 Likes