Jump to content
43oh

Conversion from analog to digital with MSP432


Recommended Posts

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);

}
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.

 

 

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

 

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.

 

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.

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.

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

Link to post
Share on other sites
  • 1 month later...
  • 7 months later...
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...