EmbeddedRelated.com
Forums

ADC10 unknown results?

Started by glgo...@hotmail.com September 12, 2008
Just started working on ADC10 using ez430-RF2500. I tried to get values directly from the output of an amplified signal however it looks so different from the value displayed on the oscilloscope. I was supposed to get an ECG signal.

Do i need to connect the ground reference to the ground used for the ecg signal? And also, is ez430-RF2500 unable to convert negative values to positive values?

This is the code i used to sample my signal.

void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT weili luv darek
ADC10CTL1 = CONSEQ_2 + INCH_3; // Repeat single channel
ADC10CTL0 = SREF_1 + ADC10SHT_1 + MSC + REFON + REF2_5V + ADC10ON + ADC10IE;
TACCR0 = 1000; // Delay to allow Ref to settle
TACCTL0 |= CCIE; // Compare-mode interrupt
TACTL = TASSEL_2 + MC_1; // TACLK = SMCLK, Up mode
__bis_SR_register(CPUOFF + GIE); // LPM0, TA0_ISR will force exit
TACCTL0 &= ~CCIE; // Disable timer Interrupt
ADC10DTC1 = 0x08; // 8 conversions
ADC10AE0 |= 0x08; // P2.0 ADC option select

for (;;)
{
ADC10CTL0 &= ~ENC;
while (ADC10CTL1 & BUSY); // Wait if ADC10 core is active
ADC10SA = 0x200; // Data buffer start
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
__bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will force exit
printf("%d\n" , ADC10MEM);
}
}

Beginning Microcontrollers with the MSP430

You should see nothing but junk without common grounds.
Your input needs to be between Vref and Gnd.

--- In m..., glgoh@... wrote:
>
> Just started working on ADC10 using ez430-RF2500. I tried to get
values directly from the output of an amplified signal however it
looks so different from the value displayed on the oscilloscope. I
was supposed to get an ECG signal.
>
> Do i need to connect the ground reference to the ground used for
the ecg signal? And also, is ez430-RF2500 unable to convert negative
values to positive values?
>
> This is the code i used to sample my signal.
>
> void main(void)
> {
> WDTCTL = WDTPW + WDTHOLD; // Stop WDT weili luv
darek
> ADC10CTL1 = CONSEQ_2 + INCH_3; // Repeat single channel
> ADC10CTL0 = SREF_1 + ADC10SHT_1 + MSC + REFON + REF2_5V + ADC10ON
+ ADC10IE;
> TACCR0 = 1000; // Delay to allow Ref
to settle
> TACCTL0 |= CCIE; // Compare-mode
interrupt
> TACTL = TASSEL_2 + MC_1; // TACLK = SMCLK, Up
mode
> __bis_SR_register(CPUOFF + GIE); // LPM0, TA0_ISR will
force exit
> TACCTL0 &= ~CCIE; // Disable timer
Interrupt
> ADC10DTC1 = 0x08; // 8 conversions
> ADC10AE0 |= 0x08; // P2.0 ADC option
select
>
> for (;;)
> {
> ADC10CTL0 &= ~ENC;
> while (ADC10CTL1 & BUSY); // Wait if ADC10 core
is active
> ADC10SA = 0x200; // Data buffer start
> ADC10CTL0 |= ENC + ADC10SC; // Sampling and
conversion start
> __bis_SR_register(CPUOFF + GIE); // LPM0, ADC10_ISR will
force exit
> printf("%d\n" , ADC10MEM);
> }
> }
>

What do you mean needs to be between Vref and Gnd?

>You should see nothing but junk without common grounds.
>Your input needs to be between Vref and Gnd.

If Vref = 2.5volts and GND = 0 volts, the signal you want to convert
must be between these voltages. A voltage less than 0 may damage the
device. A voltage greater than 2.5 volts will always read 0x3FF, and if
goes above VCC may damage the device.

--- In m..., glgoh@... wrote:
>
> What do you mean needs to be between Vref and Gnd?
>
> >You should see nothing but junk without common grounds.
> >Your input needs to be between Vref and Gnd.
>

You need to connect both grounds. Signalground and Vref ground on your
MSP430. The absolut maximum inputvoltage of the ADC10 is 3.6V.
So your inputsignal needs to be between 0V and 3.6V, no negative
Voltage allowed!

--- In m..., glgoh@... wrote:
>
> What do you mean needs to be between Vref and Gnd?
>
> >You should see nothing but junk without common grounds.
> >Your input needs to be between Vref and Gnd.
>

But my signal has negative. so what should i do den?

Are your trying to measure a negative signal with an A/D converter that
only goes between Vref and zero? Take a step back and ask yourself if
that should work.

________________________________

From: m... [mailto:m...] On Behalf
Of g...@hotmail.com
Sent: Friday, September 12, 2008 10:57 AM
To: m...
Subject: [msp430] Re: ADC10 unknown results?

But my signal has negative. so what should i do den?


So u mean that if i set my Veref and V-eref to 2.5 V and -2.5 V
respectively. I would be able to get the values. And just a check, my
timer sampling rate isit at 1 KHz? Cos i set it to TACCR0 = 1000

--- In m..., "Dan Muzzey" wrote:
>
> Are your trying to measure a negative signal with an A/D converter
that
> only goes between Vref and zero? Take a step back and ask yourself
if
> that should work.
>
> ________________________________
>
> From: m... [mailto:m...] On
Behalf
> Of glgoh@...
> Sent: Friday, September 12, 2008 10:57 AM
> To: m...
> Subject: [msp430] Re: ADC10 unknown results?
>
> But my signal has negative. so what should i do den?
>
>
>

No.

That is unless you want to destroy the chip.

Follow these steps:
1. Get the data sheet.
2. Look up input ranges.
3. Realize that -1V is less than 0V
4. Design a circuit that will do what you need to do.

________________________________

From: m... [mailto:m...] On Behalf
Of f0rep1ay
Sent: Friday, September 12, 2008 11:14 AM
To: m...
Subject: [msp430] Re: ADC10 unknown results?

So u mean that if i set my Veref and V-eref to 2.5 V and -2.5 V
respectively. I would be able to get the values. And just a check, my
timer sampling rate isit at 1 KHz? Cos i set it to TACCR0 = 1000

--- In m... , "Dan
Muzzey" wrote:
>
> Are your trying to measure a negative signal with an A/D converter
that
> only goes between Vref and zero? Take a step back and ask yourself
if
> that should work.
>
> ________________________________
>
> From: m...
[mailto:m... ] On
Behalf
> Of glgoh@...
> Sent: Friday, September 12, 2008 10:57 AM
> To: m...
> Subject: [msp430] Re: ADC10 unknown results?
>
> But my signal has negative. so what should i do den?
>
>
>


Sorry about acting noob. But here i am, just getting started on the
chip. I was told to use this chip and i hardly have any knowledge on
embedding system. Thought negative was possible due to 2's complement.

--- In m..., Onestone wrote:
>
> You need to go away and study for about two years before coming here
and
> asking such stupid questions. Normally I try to think that there isn't
> such a thing as a stupid question, but occasionally some people come
> along who should never have been allowed near an engineering class, and
> here I'll make an exception. These questions are so basic, and the
> answers should be so obvious even to a first term electronics student,
> that it sounds very troll like to me. Read the manual, read the data
> sheet, learn a few very basic principles of electronics and then try to
> attempt to actually design something. At the moment you haven't a
> snowballs chance in hell of even understanding the simplest answers
that
> you have already been given.
>
> Al
>
> f0rep1ay wrote:
>
> >So u mean that if i set my Veref and V-eref to 2.5 V and -2.5 V
> >respectively. I would be able to get the values. And just a check, my
> >timer sampling rate isit at 1 KHz? Cos i set it to TACCR0 = 1000
> >
> >--- In m..., "Dan Muzzey" wrote:
> >
> >
> >>Are your trying to measure a negative signal with an A/D converter
> >>
> >>
> >that
> >
> >
> >>only goes between Vref and zero? Take a step back and ask yourself
> >>
> >>
> >if
> >
> >
> >>that should work.
> >>
> >>________________________________
> >>
> >>From: m... [mailto:m...] On
> >>
> >>
> >Behalf
> >
> >
> >>Of glgoh@
> >>Sent: Friday, September 12, 2008 10:57 AM
> >>To: m...
> >>Subject: [msp430] Re: ADC10 unknown results?
> >>
> >>But my signal has negative. so what should i do den?
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> >
> >
> >
> >
> >
> >