Forums

ADC initialization and input display

Started by msp430helpneed February 12, 2008
Hello, I am new to the MSP430, we are using the MSP430F169.

We are having trouble initializing the ADC, taking a DC voltage input,
and then displaying the proper DC voltage on the LCD screen (or AC
voltage). I know this is a fairly low level task but none of us can
seem to grasp it. We have a small C background, but this part is
tricking us it seems. We have tried using the Line In audio jack as
our ADC input as well as one pin on the two 3-pin ADC inputs. The
example code on the TI site does not seem to help much. If anyone has
an idea, or can give us some direction it would be greatly
appreciated. Thank you.

Beginning Microcontrollers with the MSP430

Outsource alert! ;)

msp430helpneed wrote:
> Hello, I am new to the MSP430, we are using the MSP430F169.
>
> We are having trouble initializing the ADC, taking a DC voltage input,
> and then displaying the proper DC voltage on the LCD screen (or AC
> voltage). I know this is a fairly low level task but none of us can
> seem to grasp it. We have a small C background, but this part is
> tricking us it seems. We have tried using the Line In audio jack as
> our ADC input as well as one pin on the two 3-pin ADC inputs. The
> example code on the TI site does not seem to help much. If anyone has
> an idea, or can give us some direction it would be greatly
> appreciated. Thank you.
>
>
>
Yeah, I'm doing a co-op with a company and my group hasn't worked with
the MSP430 before so I'm trying to get help from anywhere I can, and
it made me sign up to post on this and I hadn't previously used yahoo
mail.

We're able to get the display to work fine, it can display any message
we tell it to. Once we read the ADC and attempt to display it on the
LCD is when problems arise. We're getting random numbers that dont
seem to make any sense. Especially with a DC input, it doesnt change
at all when we change the voltage. On an AC input the LCD values
change, so it almost seems like it's taking a derivative of the input
or something.

This is not the assignment we were given, but we're trying to make
sure we're reading the ADC properly and it's giving us our desired
output. I figured the question I asked was the most basic thing I
could go for without seeming like I was asking people to write our
actual code. Thanks for the assistance, though. Guess we'll keep
debugging...

Alex

--- In m..., Kipton Moravec wrote:
>
> You set up an email account for just your msp430 help?
>
> Step 1. Write a program, any program on the MSP430, and make sure you
> can compile it and step through it with the simulator, then try the same
> thing with the hardware and debugger.
>
> Step 2. Write code using the TI examples for the ADC. Read the ADC and
> put it
> in an integer. See that as you change the voltage in the integer
> changes.
>
> Step 3. Get the display working. Write "Hello World" to the display
> after initializing it.
>
> Step 4. Convert the integer from the ADC to a string of ASCII characters
> that represent the integer in base 10. And put on the display.
>
> Step 5. Do the assignment you were given.
>
> Kip
>
> On Wed, 2008-02-13 at 00:46 +0000, msp430helpneed wrote:
> > Hello, I am new to the MSP430, we are using the MSP430F169.
> >
> > We are having trouble initializing the ADC, taking a DC voltage input,
> > and then displaying the proper DC voltage on the LCD screen (or AC
> > voltage). I know this is a fairly low level task but none of us can
> > seem to grasp it. We have a small C background, but this part is
> > tricking us it seems. We have tried using the Line In audio jack as
> > our ADC input as well as one pin on the two 3-pin ADC inputs. The
> > example code on the TI site does not seem to help much. If anyone has
> > an idea, or can give us some direction it would be greatly
> > appreciated. Thank you.
> >
> >
> >
> >
> >
> >
> >
It's hard to know where your problems are if you don't post any of the
code that is giving you trouble. You are also saying something about
connectors and jacks, jet not saying anything about the hardware
you're working with.

I can't even guess what the problem is, with statements as confusing
as "We're getting random numbers that dont seem to make any sense.
Especially with a DC input, it doesnt change at all...". Well, are you
getting ramdom values or a fixed value?

You do have sample code. That should be of a lot of help when trying
to understand how your MSP ADC works. Unless, of course, you are
trying to make it work without trying to understand how it works.

Michael K.
--- In m..., "msp430helpneed"
wrote:
>
> Yeah, I'm doing a co-op with a company and my group hasn't worked with
> the MSP430 before so I'm trying to get help from anywhere I can, and
> it made me sign up to post on this and I hadn't previously used yahoo
> mail.
>
> We're able to get the display to work fine, it can display any message
> we tell it to. Once we read the ADC and attempt to display it on the
> LCD is when problems arise. We're getting random numbers that dont
> seem to make any sense. Especially with a DC input, it doesnt change
> at all when we change the voltage. On an AC input the LCD values
> change, so it almost seems like it's taking a derivative of the input
> or something.
>
> This is not the assignment we were given, but we're trying to make
> sure we're reading the ADC properly and it's giving us our desired
> output. I figured the question I asked was the most basic thing I
> could go for without seeming like I was asking people to write our
> actual code. Thanks for the assistance, though. Guess we'll keep
> debugging...
>
> Alex
>
> --- In m..., Kipton Moravec wrote:
> >
> > You set up an email account for just your msp430 help?
> >
> > Step 1. Write a program, any program on the MSP430, and make sure you
> > can compile it and step through it with the simulator, then try
the same
> > thing with the hardware and debugger.
> >
> > Step 2. Write code using the TI examples for the ADC. Read the ADC and
> > put it
> > in an integer. See that as you change the voltage in the integer
> > changes.
> >
> > Step 3. Get the display working. Write "Hello World" to the display
> > after initializing it.
> >
> > Step 4. Convert the integer from the ADC to a string of ASCII
characters
> > that represent the integer in base 10. And put on the display.
> >
> > Step 5. Do the assignment you were given.
> >
> > Kip
> >
> > On Wed, 2008-02-13 at 00:46 +0000, msp430helpneed wrote:
> > > Hello, I am new to the MSP430, we are using the MSP430F169.
> > >
> > > We are having trouble initializing the ADC, taking a DC voltage
input,
> > > and then displaying the proper DC voltage on the LCD screen (or AC
> > > voltage). I know this is a fairly low level task but none of us can
> > > seem to grasp it. We have a small C background, but this part is
> > > tricking us it seems. We have tried using the Line In audio jack as
> > > our ADC input as well as one pin on the two 3-pin ADC inputs. The
> > > example code on the TI site does not seem to help much. If
anyone has
> > > an idea, or can give us some direction it would be greatly
> > > appreciated. Thank you.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
It is either you do not have the ADC configured right or you are not
writing the number correctly to the display.

Did you do Step 2 below?

Then looking at the numbers coming out of the ADC using the HW debugger
does it make sense?

Can you put in the lowest voltage and get something near zero out?
Can you put in the highest voltage and get 0x03FF? (Assuming 10 bit-ADC)
Is the value you see at the pin on the MSP430 what you expect with the
value coming in?

You say Step 3 is working.

Does step 4 work?
Can you take a 16-bit integer and put its data representation on the
display?
Does it work for all numbers from 0 to 65537?

If you can't answer the questions we can't help?

Kip

On Wed, 2008-02-13 at 17:29 +0000, msp430helpneed wrote:
> Yeah, I'm doing a co-op with a company and my group hasn't worked with
> the MSP430 before so I'm trying to get help from anywhere I can, and
> it made me sign up to post on this and I hadn't previously used yahoo
> mail.
>
> We're able to get the display to work fine, it can display any message
> we tell it to. Once we read the ADC and attempt to display it on the
> LCD is when problems arise. We're getting random numbers that dont
> seem to make any sense. Especially with a DC input, it doesnt change
> at all when we change the voltage. On an AC input the LCD values
> change, so it almost seems like it's taking a derivative of the input
> or something.
>
> This is not the assignment we were given, but we're trying to make
> sure we're reading the ADC properly and it's giving us our desired
> output. I figured the question I asked was the most basic thing I
> could go for without seeming like I was asking people to write our
> actual code. Thanks for the assistance, though. Guess we'll keep
> debugging...
>
> Alex
>
> --- In m..., Kipton Moravec wrote:
> >
> > You set up an email account for just your msp430 help?
> >
> > Step 1. Write a program, any program on the MSP430, and make sure you
> > can compile it and step through it with the simulator, then try the same
> > thing with the hardware and debugger.
> >
> > Step 2. Write code using the TI examples for the ADC. Read the ADC and
> > put it
> > in an integer. See that as you change the voltage in the integer
> > changes.
> >
> > Step 3. Get the display working. Write "Hello World" to the display
> > after initializing it.
> >
> > Step 4. Convert the integer from the ADC to a string of ASCII characters
> > that represent the integer in base 10. And put on the display.
> >
> > Step 5. Do the assignment you were given.
> >
> > Kip
> >
> > On Wed, 2008-02-13 at 00:46 +0000, msp430helpneed wrote:
> > > Hello, I am new to the MSP430, we are using the MSP430F169.
> > >
> > > We are having trouble initializing the ADC, taking a DC voltage input,
> > > and then displaying the proper DC voltage on the LCD screen (or AC
> > > voltage). I know this is a fairly low level task but none of us can
> > > seem to grasp it. We have a small C background, but this part is
> > > tricking us it seems. We have tried using the Line In audio jack as
> > > our ADC input as well as one pin on the two 3-pin ADC inputs. The
> > > example code on the TI site does not seem to help much. If anyone has
> > > an idea, or can give us some direction it would be greatly
> > > appreciated. Thank you.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
You set up an email account for just your msp430 help?

Step 1. Write a program, any program on the MSP430, and make sure you
can compile it and step through it with the simulator, then try the same
thing with the hardware and debugger.

Step 2. Write code using the TI examples for the ADC. Read the ADC and
put it
in an integer. See that as you change the voltage in the integer
changes.

Step 3. Get the display working. Write "Hello World" to the display
after initializing it.

Step 4. Convert the integer from the ADC to a string of ASCII characters
that represent the integer in base 10. And put on the display.

Step 5. Do the assignment you were given.

Kip

On Wed, 2008-02-13 at 00:46 +0000, msp430helpneed wrote:
> Hello, I am new to the MSP430, we are using the MSP430F169.
>
> We are having trouble initializing the ADC, taking a DC voltage input,
> and then displaying the proper DC voltage on the LCD screen (or AC
> voltage). I know this is a fairly low level task but none of us can
> seem to grasp it. We have a small C background, but this part is
> tricking us it seems. We have tried using the Line In audio jack as
> our ADC input as well as one pin on the two 3-pin ADC inputs. The
> example code on the TI site does not seem to help much. If anyone has
> an idea, or can give us some direction it would be greatly
> appreciated. Thank you.
>
>
>