cancel
Showing results for 
Search instead for 
Did you mean: 

Left and Right alignment in DOR (DAC STM32F103RB)

Muzahir Hussain
Associate III
Posted on May 18, 2018 at 22:27

What is the purpose of Left and Right Alignment of data in DAC?

Secondly, In DAC_DHR12L1 do we need to manually shift the bits to the left to get them to right place or does it happen automatically?

#dac #stm32f103rb
1 REPLY 1
Posted on May 18, 2018 at 23:07

The options give you the ability to load data without manually shifting it.

Data placed in the most significant bits allows the output size to be some what variable. ie if the sample is 12-bit wide, but your DAC only takes the 8 most significant bits, the DAC just does a natural truncation, and the least significant bits aren't used.

On the STM32 side you carry the 16-bit size around, as that's a natural size for the processor.

Left aligned  MSB to LSB

XXXX XXXX XXXX XXXX 16-bit sample

XXXX XXXX XXXX 0000 12-bit sample

XXXX XXXX 0000 0000 8-bit sample

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..