cancel
Showing results for 
Search instead for 
Did you mean: 

16 bit result from ADC

seba881
Associate
Posted on January 07, 2012 at 17:13

The original post was too long to process during our migration. Please click on the attachment to read the original post.
4 REPLIES 4
infoinfo989
Associate III
Posted on January 07, 2012 at 17:42

Why do you believe you have 16-bit results? The A/D is a 12-bit converter and you have it setup for 12-bit results, right-justified. So the 16-bit data you're looking at should have the top 4 bits being zeros, and the lower 12 bits being ADC data.

seba881
Associate
Posted on January 07, 2012 at 17:47

Because i add LCD function which display results from ADC and results are about 65000 to 4000.

raptorhal2
Lead
Posted on January 07, 2012 at 19:43

You are missing:

  /* Enable ADC1 DMA since ADC1 is the Master*/

  ADC_DMACmd(ADC1, ENABLE);

This can cause the results you are seeing.

To verify all is well, apply known test voltages on one or more pins. If the pins are left floating, the answers will float also, within the 0 to 4095 range if the code is correct.

Cheers, Hal

raptorhal2
Lead
Posted on January 13, 2012 at 15:03

Perhaps you have discovered this already, but if not:

The ADC_InitStructure has 7 parameters. Your code initializes only 6 of them. Add the following:

  ADC_InitStructure.ADC_ExternalTrigConv=0x00;

Cheers, Hal