Analog input multiplexing on the ADuCM360

I am trying to continuously sample data from three sources with the ADuCM360. ADC1 is configured to read differential pair AIN1/AIN0 at 60sps (SF=125,AF=0). I want ADC0 to use the same filter settings but alternately sample between AIN3/2 and AIN5/4 pairs. I am using the simultaneous sampling mode by setting ADCCFG[15]=1 which seems to work until I change the ADC0 mux configuration.

To cycle between the two input sources I update pADI_ADC1->CON during the ADC interrupt handler.

void ADC1_Int_Handler() {
    adc0_data = AdcRd(pADI_ADC0);            // read ADC result register
	adc1_data = AdcRd(pADI_ADC1);            // read ADC result register
	
	bSendResultToUART = 1;  // Set flag to indicate ready to send result to UART
	
	if(bADC_mux_state = 0) {
	    con = pADI_ADC1->CON & 0xFFFF00;
	    con |= 0x0000A4; // Change mux to ADC5/4
	    pADI_ADC1->CON = con;
	    bADC_mux_state = 1;
	} else {
		con = pADI_ADC1->CON & 0xFFFF00;
	    con |= 0x000062; // Change mux to ADC3/2
	    pADI_ADC1->CON = con;
	    bADC_mux_state = 0;
	}
}

However, whenever I change the state of pADI_ADC1->CON the simultaneous acquisition stops. How do I cycle between input mux settings on alternate cycles?

Thanks,

Mike

Parents Reply Children
No Data