The TI MSP430F20XX series has a 12-bit internal ADC output, which is right-justified.
What is the difference between a left-justified output and a right-justified output? What are their pros and cons?
The TI MSP430F20XX series has a 12-bit internal ADC output, which is right-justified.
What is the difference between a left-justified output and a right-justified output? What are their pros and cons?
On this processor, the register that holds the conversion result is 16 bits wide.
A right-justified result means that bits [(N-1):0] (where N is the number of bits of precision) of the register contain the ADC value and the most-significant bits of the register are set to zero.
A left-justified result means that bits [15:(16-N)] of the register hold the result, and bits [(15-N):0] are set to zero.
For example, if your actual conversion result is 0x123, it would be read as 0x0123 if the register was right-justified, and as 0x1230 if it was left-justified.
An advantage of left-justified results (on processors that support it) is that you can take just the most-significant byte of the register, giving you 8-bits of precision instead of the native precision. This can be useful if you don't need the extra precision, or have RAM constraints and want to store a large number of samples.
On the other hand, a right-justified value can be used directly without the scaling that a left-justified value would need.