Below is my sample code, through which I am reading voltages on four ADC channels, but in all cases I am getting the same voltage levels on all channels, that is one channel reading on the other channels.
for the first time , that is for Temp1 this code works fine but for the rest all it is not doing conversion so please, if any can help me out where i have to make change inorder to do all channels readings thanks in advance. regards Boni
Didn't find your answer? Ask the community — no account required.
M
Mark Borgerson
Why would you expect any sensible answer when you haven't said which processor you are programming?
Mark Borgerson
L
larwe
Which text adventure game was it that responded to the "help" keyword with "How should I know, try tap dancing"? Was it The Pawn (Magnetic Scrolls)?
D
D Yuniskis
(reformatted)
Presumably, this is C (or a dialect thereof). Presumably, these are manifest constants (?) Yet, you are *assigning* values to them... :<
I *think* you intended this (preceding) statement to store the value of "channel" into a control register whose address is specified by "ADC10CTL1". But, I suspect you have just updated a *variable* called ADC10CTL1 which may not be connected to the hardware to which you *think* it is connected. Hard to say as you haven't indicated what each of these symbols/variables mean. :< (i.e., if ADC10CTL1 isn't a pointer...)
Again, it seems like you are expecting this to return the value of a hardware (I/O) register "ADC10MEM". But, it is just returning the contents of a variable that you have (probably not even initialized!).
Including a code snippet without everything pertinent is a pretty silly way to get help :<
"The answer I got is '5'. Why is that?"
"Um, what was the *question* you asked and the answer that you expected??"
Have you verified that the answer you are getting (even though you think it is WRONG) actually bears some correlation with reality? I.e., if you vary the voltage impressed on ALL of the A/DC input pins, do you see *any* change in the result?? Does the change that you observe correlate with the voltage that you have impressed? (i.e., does the value move up when the voltage moves up?) Or, is it just totally random (suggesting that your code is just returning uninitialized values from memory...)
Please be a bit more considerate of people's time in the future and ask questions that don't require lots of work on *our* part to save *you* the time preparing better questions. :-/
G
Gunther Mannigel
Mark Borgerson schrieb:
It's a MSP430.
cheers Gunther
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.