• Announcements

    • bluehash

      Forum Upgrade   03/11/2017

      Hello Everyone, Thanks for being patient while the forums were being fixed and upgraded. Please see details and report issues in this thread. Thanks!
biza

Conversion from analog to digital with MSP432

8 posts in this topic

Fellows, 
I'am trying to adquire a signal with ADC converter in the MSP432, but some problems appeard. I try to read  lm35 sensor temperature and before conect the lm35 output signal to input pin of MSP432, i made a mesurement with multimeter and i see the pin has 1.10 +/- 1.15v. It's this normal? The code was made in ccs, and with classic programation (registers), this is the code:

#include "adc.h"
#include "lcd.h"
#include "stdio.h"		
extern char Mensaje[];
/**/
void adc(void){
    volatile unsigned int i;

/*ADC CONFIGURATION*/
P5->SEL1 |= BIT4;
P5->SEL0 |= BIT4;

/*ENABLE GLOBAL INTERRUPTS*/
__enable_irq();

/*ENABLE ADC INTERRUPT IN NVIC MODULE*/
NVIC->ISER[0] = 1 << ((ADC14_IRQn) & 31);


 /*Sampling time, S&H=16, ADC14 on*/
 ADC14->CTL0 = ADC14_CTL0_SHT0_2 | ADC14_CTL0_SHP | ADC14_CTL0_ON;
 ADC14->CTL1 = ADC14_CTL1_RES_2;


 ADC14->MCTL[0] |= ADC14_MCTLN_INCH_1;
 ADC14->IER0 |= ADC14_IER0_IE0;

 SCB->SCR &= ~SCB_SCR_SLEEPONEXIT_Msk;

   while (1)
    {
        for (i = 20000; i > 0; i--);

        // Start sampling/conversion
        ADC14->CTL0 |= ADC14_CTL0_ENC | ADC14_CTL0_SC;
        __sleep();

        __no_operation();
    }

}

void ADC14_IRQHandler(void) {

	int value_adc=ADC14->MEM[0];
	float value_vol= value_adc * (3.3/4096);
	//sprintf(Mensaje,"%d",value_adc);
	sprintf(Mensaje,"%1.2f",value_vol);
	LCD_SetText(Mensaje,5 ,0);

}

Share this post


Link to post
Share on other sites

A few questions:  What is your power supply?  What was the temperature of the environment?

The lm35 needs at least a 4V supply.

Its output is 10mV/degree C, so at 20 degrees C, the output should be 200 mV.

enl likes this

Share this post


Link to post
Share on other sites

Thank you Nurse Bob,
for answer my question, I have 5V power supply to LM35. but my problem has in P5.4 without connect to the output pin of LM35, in the multimeter I measure 1.10 to 1.15V , why? All that calcules are in LM35 data sheet.

 

 

Share this post


Link to post
Share on other sites

Do you have another device?  I have some lm34s -T092 devices  (read F instead of C) and in my home office I'm seeing .70V - or 70 degrees F when attached to the LP 5V tap.  My recollection is that it's easy to damage the devices with ESD or if wired wrong...  Other than that, I don't have more to offer.

Bob

 

Share this post


Link to post
Share on other sites

No, I don't have another device. But forget the LM35 sensor, you configure the P5.4 to receive a analog signal and convert him, why this pin have oscillation voltage, I have used a multimeter and I measure this pin and I get between 1.10 and 1.15V.

 

Share this post


Link to post
Share on other sites

> I have used a multimeter and I measure this pin and I get between 1.10 and 1.15V.
Is this in reference to the msp432 pin? I thought you were measuring the lm35...
So, if you're testing the P5.4 pin, and you have CCS, I'd look in the debugger at the port registers to see if
your statements to set P5.4 SEL1 and SEL0 are actually working as intended.

Where is the sample code from?

Aside from that, I don't have a suggestion.

Share this post


Link to post
Share on other sites
On 3/20/2017 at 5:34 PM, biza said:

Thank you Nurse Bob,
for answer my question, I have 5V power supply to LM35. but my problem has in P5.4 without connect to the output pin of LM35, in the multimeter I measure 1.10 to 1.15V , why? All that calcules are in LM35 data sheet.

 

 

Am I reading correctly that this is with the LM35 not connected to the input pin? In other words, there is nothing connected to the input pin?

If this is the case, then the potential on the pin will float, generally to about half of the power supply, give or take (depends on the device) and, being configured as an input, it will have very high impedance, so it will pick up noise. You would be measuring more the properties of the multimeter and its interaction with the floating input than a real potential.

NurseBob likes this

Share this post


Link to post
Share on other sites

Enl, thank you for your answer
So  I understand your explanation, but how can I proced to read temperature with that sensor. Since I dont obtain a consistent temperature I remove the pin P5.4  from MSP432 and  measure the output pin voltage, where I see a float voltage between 1.10 to 1.15 volts.

Thank's in advance

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now