0

I am trying to use an example Atmel code on ADCs. It is posted here. http://asf.atmel.com/docs/latest/sam.drivers.adc.adc_example.sam4s_ek2/html/sam_adc_quickstart.html

However, the code:

void ADC_IrqHandler(void)
{
    // Check the ADC conversion status
    if ((adc_get_status(ADC).isr_status & ADC_ISR_DRDY) ==   ADC_ISR_DRDY)
    {
        // Get latest digital data value from ADC and can be used by application
        uint32_t result = adc_get_latest_value(ADC);
    }
}

produces the error:

request for member 'isr_status' in something not a structure or union

using the ASF wizard I have added the ADC modules to the project. Is there something else I am missing?

Much appreciated, Jesse

Jesse RJ
  • 217
  • 4
  • 17
  • It looks like you have your answer, but I want to note something. This error is very common when declaring a struct pointer and then accessing it with the dot operator instead of deferencing it with the `->` operator. E.G. `struct dat { int data; } *pointer_to_struct;` `pointer_to_struct = malloc(sizeof(dat));` `pointer_to_struct.data = 0;` – GRAYgoose124 Apr 26 '13 at 15:52

1 Answers1

1

For anyone who gets this same error:

I found bug report http://asf.atmel.com/bugzilla/show_bug.cgi?id=3002

which replaces:

void ADC_IrqHandler(void)
   {
       //Check the ADC conversion status 
       if ((adc_get_status(ADC).isr_status & ADC_ISR_DRDY) ==   ADC_ISR_DRDY)
       {
       //Get latest digital data value from ADC and can be used by application
           uint32_t result = adc_get_latest_value(ADC);
       }
   }

with:

void ADC_IrqHandler(void)
   {
       //Check the ADC conversion status 
       if (adc_get_status(ADC) & ADC_ISR_DRDY) 
       {
       //Get latest digital data value from ADC and can be used by application
           uint32_t result = adc_get_latest_value(ADC);
       }
   }

I guess eventually the example code will be updated

Jesse RJ
  • 217
  • 4
  • 17