SAM C21 Harmony3 ADC configuration

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

I'm trying to get the ADC to periodically read 2 ADC inputs with Harmony 3 on ATSAMC21E18A.

The ADC in harmony is configured as in the attached image - AIN6 and AIN7 shall be read.

 

When I do no automatic sequencing either pin can be read by itself.

 

On automatic sequencing it reads the first pin AIN6 once and from then on it's stuck to AIN7.

 

How can I get it to read both pins periodically?

 

  ADC0_Enable();
  ADC0_ConversionStart();

  while ( true )

    {

        /* Wait till ADC conversion result is available */

        while(!ADC0_ConversionStatusGet())

        {

          //  SERCOM1_USART_Write("X", 1);

        };

 

        /* Read the ADC result */

        adc_count = ADC0_ConversionResultGet();

 

       // SERCOM3_USART_Write(&text[0], sizeof(text)-1);

  

        sprintf(txData, "ADC Count = 0x%03x, ADC Input Voltage = %d.%02d V \r\n", adc_count, adc_count,adc_count);

        SERCOM1_USART_Write(txData, strlen(txData));

 

        ADC0_ConversionStart();

        SYSTICK_DelayMs(500);

        /* Maintain state machines of all polled MPLAB Harmony modules. */

        SYS_Tasks ( );

}

 

 

Attachment(s):