I have been testing the functionality of the TS_7250 and have run
into issues while sampling analog inputs with the MAX197.
I have been able to collect a single sample accurately. However,
when I put the same code into a loop, the first sample is accurate
and the remaining samples are some constant #. (see code and
execution results below)
for(n = 0; n < num; n++)
{
*control = hexVal; //control value
// Wait for the conversion to complete
while((*complete & 0x80) != 0)
// now store the result on a scale from 0-(2^12-1) in sig array
res = 0;
res = *lsb;
res |= *msb << 8;
sig[n] = res;
}
When executed on chn 0 with range from 0-5v and a constant 1V input
the results of 20 samples were as seen below.
result: 848
result: 832
result: 832
result: 832
result: 832
result: 832
result: 832
result: 832
result: 832
result: 832
result: 832
result: 832
result: 832
result: 832
result: 832
result: 832
result: 832
result: 832
result: 832
result: 832
I have consistently had this result with several different inputs
(AC and DC all within correct range). I have tried adding a sleep
(1); at the bottom of the loop and found that slowing down the loop
execution yields accurate results but not reliably and I need a much
higher sampling rate than 1Hz.
Can anyone provide me with some information on this problem and
propose a solution?
Also, I have seen in the TS-7250 manual that the control register
for the MAX197 is at 0x1080_0000 (page 29 JUN 2007).
However, in the example code (page 39 Linux for ARM JUL 2007),
0x10C0_0000 is used to map the control.
I have tried both and seen that each value 0x1080 and 0x10C0 works,
at least for the single sample case.
Which address should I be using to properly control the MAX197 chip?
It is critical that I am able to maximize the sampling rate of the
ADC. Please advice on the best solution.
-Thank You
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|