Fixed time ADC sampling | Cypress Semiconductor
Fixed time ADC sampling
I am trying to sample 12 ADC channels and 8 I2C sensors at specific time periods. The timing is like this:
A - 10ms - ADC 0, 1, 2
B - 50ms - I2C 0, 1, 2, 3
C - 100ms - ADC 3,4,5,6,7
D - 1000ms - ADC 8,9,10,11 and I2C 4,5,6,7
I am using a 12ch MUX, DelSig ADC, I2C bloc and for the specific timing generation multiple Frequency Dividers from the 1Khz ILO clock.
The two ways I tried were: either read in each ISR all the relevant sensors OR set flags and execute in main using IFs ( if(ISR_flagSet -> read sensors)
Both are suboptimal solutions as the execution time varies, A is much faster than C and they don't work very well. An ideas are more than welcome. I need to read the sensors at fixed time to be able to integrate and differentiate them.
I'm not sure this is possible using a single core MCU.