Go Down

Topic: Arduino M0 multi channel ADC scanning (Read 383 times) previous topic - next topic

parsec326

I've been trying to configure the ADC on the M0 for multi-channel ADC scanning. My requirement is three channels, single ended. So I know that from the datasheet, I need to configure the INPUTCTRL reg for number of channels and type of channel (POSMUX):
Code: [Select]

ADC->INPUTCTRL.reg = ADC_INPUTCTRL_GAIN_1X | // ADC gain factor x1
                         ADC_INPUTCTRL_INPUTSCAN(0x0)| // Number of channels included in scan
                         ADC_INPUTCTRL_MUXPOS_PIN0 | // Positive MUX input selection
                         ADC_INPUTCTRL_MUXPOS_PIN2 |
                         ADC_INPUTCTRL_MUXPOS_PIN3 |
                         ADC_INPUTCTRL_MUXNEG_GND;

My question is how do I control the process of next channel that's going to be scanned. The only interrupt I can set is RESRDY which indicates the ADC result is ready but does not indicate which ADC channel the result is from.  I did'nt understand this process from the datasheet, so can somebody share their insight on implementing this function?

Go Up