cancel
Showing results for 
Search instead for 
Did you mean: 

DAC: 8bits vs 12bits

budde2
Associate II
Posted on March 20, 2009 at 06:39

DAC: 8bits vs 12bits

1 REPLY 1
budde2
Associate II
Posted on May 17, 2011 at 13:07

I want to use the DAC to output some audio samples.

I have configure the DAC like this:

----------------------------------------------

DAC_StructInit (&dac_init);

dac_init.DAC_Trigger = DAC_Trigger_T6_TRGO;

dac_init.DAC_WaveGeneration = DAC_WaveGeneration_None;

dac_init.DAC_OutputBuffer = DAC_OutputBuffer_Enable;

DAC_Init (DAC_Channel_1, &dac_init);

----------------------------------------------

I am using DMA to output the samples. I have one version for 8 bit samples:

----------------------------------------------

dma_init.DMA_PeripheralBaseAddr = reinterpret_cast(&(DAC->DHR8R1));

dma_init.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;

dma_init.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;

----------------------------------------------

And one for 12 bit samples.

----------------------------------------------

dma_init.DMA_PeripheralBaseAddr = reinterpret_cast(&(DAC->DHR12R1));

dma_init.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Word;

dma_init.DMA_MemoryDataSize = DMA_MemoryDataSize_Word;

----------------------------------------------

If I output the same samples (the samples are shifted by 4 for the 12 bit version), the 12 bit version is much louder (higher amplitude).

Reading the reference manual I would expect both variants to create the same amplitude.