Evaluating ADC Results - F4793

Started by bigehcky7 March 31, 2009
Hey I'm a student working on a senior design project with a quick question regarding ADC results. We're building a wireless charging pad, using an MSP430F4793, and are using the ADC to measure rises/falls in current levels to determine charging started/completed points. What I want to know has to do with storing results from SD16MEM into local variables for later comparisons. We read the ADC memory with this (coding in c):

results = SD16MEM0;

So what I've found is that there are 2 formatting options for how results are stored in ADC memory, bipolar offset binary and bipolar twos complement. What I don't know is what format the local variables are stored in. Say if we choose bipolar offset for our ADC format, and then store that number into 'results'...if these local variables are formatted differently, then out comparisons will be completely off. So basically what I want to know is what they're stored in, and if we'll need to implement some conversion algorithm to fix the mismatch in the formatting. Please let me know, thanks.

-Eric

Beginning Microcontrollers with the MSP430

A document can be written in English, French, or some other language. If I make a copy of it, what language is the copy in?

--- In m..., "bigehcky7" wrote:
>
> Hey I'm a student working on a senior design project with a quick question regarding ADC results. We're building a wireless charging pad, using an MSP430F4793, and are using the ADC to measure rises/falls in current levels to determine charging started/completed points. What I want to know has to do with storing results from SD16MEM into local variables for later comparisons. We read the ADC memory with this (coding in c):
>
> results = SD16MEM0;
>
> So what I've found is that there are 2 formatting options for how results are stored in ADC memory, bipolar offset binary and bipolar twos complement. What I don't know is what format the local variables are stored in. Say if we choose bipolar offset for our ADC format, and then store that number into 'results'...if these local variables are formatted differently, then out comparisons will be completely off. So basically what I want to know is what they're stored in, and if we'll need to implement some conversion algorithm to fix the mismatch in the formatting. Please let me know, thanks.
>
> -Eric
>

Uh - Je ne sais pas, Lichen.. :-)

Perrier, c'est fou !
Du vin, du pain .... Boursin !!!

mvg,
Kris

On Tue, 31 Mar 2009 15:27:27 -0000, "old_cow_yellow"
wrote:
> A document can be written in English, French, or some other language. If
I
> make a copy of it, what language is the copy in?

I do not know either -- especially when I try to use c which not only copies but also does translation too.

--- In m..., wrote:
>
> Uh - Je ne sais pas, Lichen.. :-)
>
> Perrier, c'est fou !
> Du vin, du pain .... Boursin !!!
>
> mvg,
> Kris
>
> On Tue, 31 Mar 2009 15:27:27 -0000, "old_cow_yellow"
> wrote:
> > A document can be written in English, French, or some other language. If
> I
> > make a copy of it, what language is the copy in?
>

Ok so your first message points out the obvious, if it's a straight copy then it will be in the same format...and I don't know if it is a straight-forward copy. And now you say it also does translation in this message. What I'm trying to understand is if the chip will know that the result is stored in a different format, and automatically translate that into the correct format for storage in the local variable. And if this isn't the case then what binary format does memory use to store local variables.

-Eric

--- In m..., "old_cow_yellow" wrote:
>
> I do not know either -- especially when I try to use c which not only copies but also does translation too.

bigehcky7 wrote:
> Ok so your first message points out the obvious, if it's a straight copy then it will be in the same format...and I don't know if it is a straight-forward copy. And now you say it also does translation in this message. What I'm trying to understand is if the chip will know that the result is stored in a different format, and automatically translate that into the correct format for storage in the local variable. And if this isn't the case then what binary format does memory use to store local variables.
>

Ahhh. Well the 'chip' doesn't know anything. SD16MEM0 is just a
register. Copy it to another register or memory and it will be exactly
the same. That is why you have the option of setting the format in the
register, so it will be what you expect. The MSP430 is little endian.
The least significant byte is stored in lower memory. But you usually
don't have to concern yourself with that, especially in C.

Best, Dan.

--
email: y...@lakeweb.net but drop the 'x'.