Reply by "Redd, Emmett R"●February 4, 20092009-02-04
I barely use C but I think your printf function call could use %u instead of
%d.
Emmett Redd Ph.D. mailto:E...@missouristate.edu
Professor (417)836-5221
Department of Physics, Astronomy, and Materials Science
Missouri State University Fax (417)836-6226
901 SOUTH NATIONAL Dept (417)836-5131
SPRINGFIELD, MO 65897 USA
Physicists always practice energy conservation.
________________________________
From: m... on behalf of eZ430-Learner
Sent: Wed 2/4/2009 9:42 PM
To: m...
Subject: Re: [msp430] Re: How to calibrate ADC
Is it this bit in control register "SD16CCTL0, SD16_A Control Register 0"
SD16DF Bit 4 SD16_A data format
0---> Offset binary
1----? 2s complement
so code becomes some thing like this
SD16CCTL0 = SD16SNGL +SD16IE + SD16UNI + SD16DF ;
--- On Wed, 2/4/09, old_cow_yellow wrote:
From: old_cow_yellow
Subject: [msp430] Re: How to calibrate ADC
To: m...
Date: Wednesday, February 4, 2009, 9:38 PM
Use unsigned format, not signed.
--- In msp430@yahoogroups. com, eZ430-Learner wrote:
>
> Hi,,,, every one
>
> I have written a simple progra to perform ADC and
simple display
Is it this bit in control register "SD16CCTL0, SD16_A Control Register 0"
SD16DF Bit 4 SD16_A data format
0---> Offset binary
1----? 2s complement
so code becomes some thing like this
SD16CCTL0 = SD16SNGL +SD16IE + SD16UNI + SD16DF ;
--- On Wed, 2/4/09, old_cow_yellow wrote:
From: old_cow_yellow
Subject: [msp430] Re: How to calibrate ADC
To: m...
Date: Wednesday, February 4, 2009, 9:38 PM
Use unsigned format, not signed.
--- In msp430@yahoogroups. com, eZ430-Learner wrote:
>
> Hi,,,, every one
>
> I have written a simple progra to perform ADC and
simple display
> so according to the code the full scale voltage is 0
to 0.6V...what
I have done is, applied a DC voltage at ADC pin.. the output digigtal
value am getting as
>
> 0V.----> 0
> 0.1V------> 12545
> 0.2V-------- > 25770
> 0.3 V-------> 260135
> 0.4V-------- --> -25413
> 0.6--------- --> -1
>
> How can chage I the configuration to get all posituve
Values
>
>
Cheers !!!!!!!!!!!! !!1
>
>
>
>
>
>
>
>
Reply by old_cow_yellow●February 4, 20092009-02-04
Use unsigned format, not signed.
--- In m..., eZ430-Learner wrote: >
> Hi,,,, every one
>
> I have written a simple progra to perform ADC and simple display using Printf().. > This is the code
>
> SD16CCTL0 = SD16SNGL +SD16IE + SD16UNI ; // single conversion + interrupt enable + UNI mode + 256 OSR >
> SD16AE = SD16AE1; // P1.1 A1+, A1- enable channel selection >
> SD16CCTL0 |= SD16SC; // Set bit to start conversion >
> ofcourse the clock has been setup...
>
> In the ADC interrupt routine what I have done is if the voltage is morethan 0.3V glow the led and show the result,,id lessthan 0.3V just
show the convertedn Digyal value.. >
> code in Interrupt routine is
>
> if (SD16MEM0 < 0x7FFF) // SD16MEM0 > 0.3V?, clears IFG
> {
> P1OUT &= ~0x01;
>
> } // bit7 to bit 22 is read by SD16MEMo since OSR =256,LSBACC=0 and UNI mode > else
> {
> P1OUT |= 0x01;
> printf("%d \n\r",SD16MEM0);
> }
>
> so according to the code the full scale voltage is 0 to 0.6V...what I have done is, applied a DC voltage at ADC pin.. the output digigtal
value am getting as >
> 0V.----> 0
> 0.1V------> 12545
> 0.2V--------> 25770
> 0.3 V-------> 260135
> 0.4V----------> -25413
> 0.6-----------> -1
>
> How can chage I the configuration to get all posituve Values
>
>
Cheers !!!!!!!!!!!!!!1 >
>
>
>
>
>
>
>
Reply by eZ430-Learner●February 4, 20092009-02-04
Hi,,,, every one
I have written a simple progra to perform ADC and simple display using
Printf()..
This is the code
SD16CCTL0 = SD16SNGL +SD16IE + SD16UNI ; // single conversion + interrupt
enable + UNI mode + 256 OSR
SD16CCTL0 |= SD16SC; // Set bit to start conversion
ofcourse the clock has been setup...
In the ADC interrupt routine what I have done is if the voltage is morethan 0.3V
glow the led and show the result,,id lessthan 0.3V just show the convertedn
Digyal value..
} // bit7 to bit 22 is read by SD16MEMo
since OSR =256,LSBACC=0 and UNI mode
else
{
P1OUT |= 0x01;
printf("%d \n\r",SD16MEM0);
}
so according to the code the full scale voltage is 0 to 0.6V...what I have done
is, applied a DC voltage at ADC pin.. the output digigtal value am getting as