This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I'm using a MSP430F5638 in a custom SBC and am having difficulty finding definitions for some of the constants.
Where are ADC12REF_0 to _7 defined? Nothing in DS or UG, just listed as ADC12 Select Ref 0 to 7 in msp430f5638.h
Same question for ADC12SHT0_0 to _15
Of the four internal ADC channels, what do A8 and A9 do? Only found descriptions for A10 Temperature, and A11 Voltage = (AVcc - AVss)/2.
ADC12REF_0 etc. are defined in the header file. They are just a shorthand way of dealing with ADC12SREF0-2. Instead of writing ADC12SREF0|ADC12SREF1|ADC12SREF2 you just write ADC12REF_7. You will find this sort of thing for pretty much every multi-bit special function register field.
As for A8 and A9, the block diagram shows them connected to VeREF+ and VeREF-. Which is of course what the register description says for ADC12INCH.
David,
Thanks for responding. Ok, I get that ADC12REF_0 is a shorthand reference to a longer sequence of constants, but where is it defined? What is the page number in either the UG or DS, or the line number in msp430f5638.h? I can't find it in the header file.
I did see the ADC12INCH chart in the UG, p. 755, so that is resolved.
It isn't in the user guide. From the header:
#define ADC12SREF_0 (0x0000) /* ADC12 Select Reference 0 */ #define ADC12SREF_1 (0x0010) /* ADC12 Select Reference 1 */ #define ADC12SREF_2 (0x0020) /* ADC12 Select Reference 2 */ #define ADC12SREF_3 (0x0030) /* ADC12 Select Reference 3 */ #define ADC12SREF_4 (0x0040) /* ADC12 Select Reference 4 */ #define ADC12SREF_5 (0x0050) /* ADC12 Select Reference 5 */ #define ADC12SREF_6 (0x0060) /* ADC12 Select Reference 6 */ #define ADC12SREF_7 (0x0070) /* ADC12 Select Reference 7 */
I previously found ADC12SREF_0 in msp430f5638.h and that prompted my original post. There aren't any ADC12SREF0 or ADC12SREF1 registers. If this is just a shorthand way to do a bunch of bitwise OR's on single bits, it's a terrible way of writing code. You would have to be clairvoyant to figure out the intent. Add comments to the header file so we know what the intent and sequence is.
Sure there are:
#define ADC12SREF0 (0x0010) /* ADC12 Select Reference Bit 0 */ #define ADC12SREF1 (0x0020) /* ADC12 Select Reference Bit 1 */ #define ADC12SREF2 (0x0040) /* ADC12 Select Reference Bit 2 */
It has always been obvious to me.
Hi Ted
There are 8 kinds of ADC reference selection according to UG: slau208q
There are 3 register bits for 8 kinds of reference options on header file
I think MSP430F5638 header file definition is matched with the register description on UG.
Thanks!
Thanks Xiaodong,
I saw these in the UG and header file. Looking at the 8 voltage reference settings selected by ADC12SREFx, what is the difference between VREF and VeREF for both + and - references?
Hi Ted
VeREF is the external voltage reference and VREF is the internal voltage reference in F5638
Thanks!
**Attention** This is a public forum