AnsweredAssumed Answered

Two questions about the A/D

Question asked by webjorn.gullik on Nov 13, 2013
Latest reply on Nov 16, 2014 by webjorn.gullik
Hi,

I am successfully running most of my software, and I am now debugging the A/D.

I first used the examples verbatim, to understand what I am setting up. I gave now
modified the code, and have two questions:

This is from the example:
   
ADC_SoftwareStartConv(ADC2);
       while(ADC_GetSoftwareStartConvStatus(ADC2) != RESET){ADC_Convert = 0;}
            ADC_Convert = ADC_GetConversionValue(ADC2);

I am now *assuming* conversion is done, since conversion parameters are set such that conversion is much faster than use/access.

Thus I have a 8 khz interrupt for audio sampling and just the

ADC_Convert = ADC_GetConversionValue(ADC2);
ADC_SoftwareStartConv(ADC2);

in the interrupt routine, i.e. I do not test for "DONE". What problems would you expect this to cause me, or is all fine as the AD always completes befor int is hit again?

Second thing: I can see no "format" specifiers, I can get left or right alignment, but want signed 16-bit data. Is there something I can do to get this, or should I:

Audiobuffer[i] = (unsigned short) Adresult - 2048;

To get a "16 bit" signed int?

Regards
G

Outcomes