On Wed, Aug 23, 2006 at 07:33:17PM -0000, Rodrigo G?mez wrote:
> I'm trying to figure out how to convert and analogic signal to one
> digital trought the ADC installed in ARM 7250. I have compiled the
> code examples published on the bibliography and the other one posted
> in the files section of this web page, but it doesn't work!!
First of all, what do you mean "it doesn't work"? Compile errors? segfaults?
The numbers you are getting don't seem right?
I had a hard time with this once. At one point there was a bug on the sample
code, and they may have fixed it in the version you have, or they may not. It
only takes a minute to test it. I'm looking at
http://www.embeddedarm.com/Manuals/linuxarm-guide-rev2.0.pdf on page 34. Here
they use the variable name "complete" and on page 39 they call it the "busy
bit". I think this is correct... while the busy bit != 0 (bit is high), dwell.
*control = 0x41;
while (( *complete & 0x80 ) != 0) ; // dwell in a loop
At one point I believe it was backwards != was == or vice versa, which made it
fall right through with no dwell, and I was reading the analog signal before the
A/D converter was complete. I'm a home and don't have production code in front
me of me, just my bad memory. Anyway, whatever you have, try the boolean
opposite and see if the problem goes away.
Another thing to watch is the mmap() calls. They are kind of like malloc(), in
that you call them once at program initialization, and then hang on to that
pointer. If you have a program which is constantly looping through A/D
conversion and you call mmap every time you will run out of resources.
Regarding the statement *control = 0x41... 4 means 0-5V, and 1 means channel
1. If you want another channel, you change the last digit. If you want a
different scale you change the first digit, but I can't remember to what...
Hope that helps.
Joe
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|