Re: Fastest way to convert raw data to voltages

Hi Bernd,
 
Thanks
 
My card AI range is [-10,10], but near to -9 to -10, the raw input converted to volt (double) will be a very large POSITIVE number.  I am not sure if it is due to some 2's complement representation used in comedi.  
 
Further, I listed a typical conversion set
the raw data -> voltage
32515  ->  -9.961547
32491  ->  -9.999084
32345  ->  1310729.993896
32181  ->  -9.96157
32159  ->  -9.975280
 
The converted values do not seem to follow the way the raw data changes.  I wonder if there is a problem of reading too fast before the conversion is finished in a while loop.
 
Thanks again
 
wee liat
 
 


Bernd Porr <BerndPorr_at_f2s.com> wrote:
Hi!

Re the VERY large number: yes. If the value reaches the maximum value 
it's converted to NAN.

Re the most efficient way: look at the code-bit in the library. These 
are only a couple of lines code. It might get faster if you just do a 
copy and past into your code but I don't think it'll speed up much more. 
A faster way is probably if you stay with integer values and don't 
convert to floating point.

/Bernd

www: http://www.berndporr.me.uk/
http://www.linux-usb-daq.co.uk/
Mobile: +44 (0)7769 506746
Work: +44 (0)141 330 5237
University of Glasgow
Department of Electronics & Electrical Engineering
Room 519, Rankine Building, Oakfield Avenue,
Glasgow, G12 8LT


weeliat ong wrote:
> Dear All,
> 
> I have an array of 2 by 100 raw data to convert to its corresponding 
> voltages. I am currently running a while loop to convert element by 
> element using comedi_to_phys() function. Is there a faster way? I may 
> need to convert all these data within 1 ms.
> 
> Another problem is that sometimes the comedi_to_phys() function returned 
> a VERY large positive double number. Is this an out-of-range 
> behaviour? Anyway to do a check on it? I am very tempted to write my 
> own coversion routine but afraid that it might not be as efficient as 
> the existing one.
> 
> Thanks
> 
> wee liat
> 
> ------------------------------------------------------------------------
> Do you Yahoo!?
> Express yourself with Y! Messenger! Free. Download now 
> . 
> 


		
---------------------------------
Do you Yahoo!?
vote.yahoo.com - Register online to vote today!

Received on 2004-10-19Z07:23:42