SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on how to get your MSP JTAG programmer up and running.
By LookashR
#73330
Hi, everybody. I am solving very easy task, but I am not able to achive the results...

It is simple. All I need is get the internal ADC reference of MSP430F2132 at the output pins Vref+ and Vref- (P2.4 resp. P2.3). I have tried almost everything including I/O pin function selection, ADC10AE0 analog (input) register, but nothing works. I believe there is nothing difficult about it, but I can not see it...

Relevant code part: (assume nothing else was done considering this issue)
Code: Select all
mov.w #1011000000000000B, &ADC10CTL1
	
                ; input (Vcc-Vss)/2 (1011), sample clock inter. (00),
                ; straight binary output (0), not invert sample (0),
                ; clock divider /1 (000), ADC clock internal (00),
                ; single channel, single conversion (00),
                ; ADC busy 0 (0)
		     
mov.w #0010001001110000B, &ADC10CTL0	    
						
                ; VR+ = Vref, VR- = Vss (001), sample = 4 (00),	
                ; sampl. rate 50ksps (0), reference output (1), 
                ; ref. buffer all the time (0), not needed (0),
                ; Vref = 2,5V (1), ref. generator on (1),
                ; ADC10 on (1), interrupt enable (0),
                ; flag cleared (0), enable conversion (0),
                ; start sample and conversion (0)
 
jmp	$
Can anyone suggest, how can I get that internal reference to the output pins?

Thank you very much...
By OldCow
#73343
Did you hold the watchdog?
By LookashR
#73471
Yes, the watchdog is stopped.

Do I need to do anything with pins directions using PxDIR, or pin functions using PxSEL and PxSEL2, or anything else?
By gm
#73528
According to page 63 of the MSP430F12x2 Mixed Signal Controller, the CAPD.x bit needs to be reset (0) along with the ADC10AE0.x bit being set (1).

HTH,

gm
By LookashR
#73546
Your suggestion does not work, I´ve tried it. Here is the code of the whole simplified programme, which should put the internal reference voltage of ADC10 at the pins 2.3 and 2.4. But when I connect voltmeter at these pins, I can see nothing...
Code: Select all
    .cdecls C,LIST, "msp430x21x2.h"
     	          	             
;------------------------------------------------------------------------------
    .text                           ; Progam Start
;------------------------------------------------------------------------------
main		
         mov.w   #0x3FE, SP              ; Initialize stackpointer
         mov.w   #WDTPW+WDTHOLD, &WDTCTL ; Stop WDT
         mov.b	&CALBC1_16MHZ, &BCSCTL1 ; BCSCTL1 Calibration Data for 16MHz
			mov.b	&CALDCO_16MHZ, &DCOCTL  ; DCOCTL Calibration Data for 16MHz
			or.b    #0x80, &BCSCTL1;		  ; XT2 off, XTS = 0 low freq mode, ACLK divider 0
			or.b    #0x00, &BCSCTL2;		  ; mclk -> Dco, divider 1, smclk -> DCO, divider 1, internal Rco
			mov.b	#0x0C, &BCSCTL3;		  ; LFXT1 = extern watch krystal, 12,5 pF capacity
      
;********************************************************************
			bic.b	#00011000B, &CAPD2 	  ; P2.3 and P2.4 CAPD = 0 
			bis.b	#00011000B, &ADC10AE0	; P2.3 and P2.4 analog input enable
 
			mov.w #1011000000000000B, &ADC10CTL1
										; input (Vcc-Vss)/2 (1011), sample clock inter. (00),
										; straight binary output (0), not invert sample (0),
										; clock divider /1 (000), ADC clock internal (00),
										; single channel, single conversion (00),
										; ADC busy 0 (0)
		     
			mov.w #0010001001110000B, &ADC10CTL0	    
										; VR+ = Vref, VR- = Vss (001), sample = 4 (00),			 
										; sampl. rate 50ksps (0), REFERENCE OUTPUT (1), 
										; ref. buffer all the time (0), not needed (0),
										; Vref = 2,5V (1), REF. GENERATOR ON (1),
										; ADC10 on (1), interrupt enable (0),
										; flag cleared (0), enable conversion (0),
										; start sample and conversion (0)
  
			 
			
			jmp	$

		
;************************* INTERRUPT VECTORS **********************************
            .sect   ".reset"                ; MSP430 RESET Vector
            .short  main                    ;   
            .end 
Thank you for any suggestions and tips.
By LookashR
#73720
Solved. The voltage has to be measured between P2.4 and GND and not between P2.4 and P2.3 as I thought.