2018-05-18 01:27 PM
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 #stm32f103rb2018-05-18 02:07 PM
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