- From: Alessandro Toso <toso_at_aero.polimi.it>
- Date: Tue, 5 Jun 2007 16:21:59 +0200
Hi,
we usually get AI from a Kernel module that gives the timing and the
board properties is passed to the user space via shared memory struct.
/* kernel module */
comedi_get_krange(dev, subdev, 0, AI_RANGE, &krange);
maxdata = comedi_get_maxdata(dev, subdev, 0);
/* shared memory */
NI_board->krange = krange;
NI_board->maxdata = maxdata;
NI_board->dev = dev;
Then in user space you can convert data (received via mail box every
time step) manually
/* user space */
/* get ai board properties from shm */
ai_range_min = (double)( NI_board->krange.min ) * 1.e-6;
ai_range_max = (double)( NI_board->krange.max ) * 1.e-6;
maxdata = NI_board->maxdata
/* while loop */
/* get data */
rt_mbx_receive( send_data, adc_i, sizeof( adc_i ) );
/* transform in volt */
x = adc_i[i];
x /= maxdata;
x *= ( ai_range_max - ai_range_min );
x += ai_range_min;
/* end while loop */
Bye
On Jun 5, 2007, at 4:06 PM, L.C. Karssen wrote:
> Hi lists,
>
> I noticed that there's no comedi_get_range() RTAI prototype in
> rtai_comedi.h. I guess it has got something to do with the absence of
> the comedi_range struct definition in linux/comedi.h (which is
> loaded by
> rtai_comedi.h when using LXRT).
>
> The reason why I ask is that I want to use the comedi_{to,from}_phys()
> routines in a program that uses LXRT and as I noticed eralier it is
> nog
> possible to include both rtai_comedi.h and comedilib.h because of
> double
> definitions of functions.
>
> Since I don't know whether this should be solved on the Comedi or the
> RTAI side I send this to both lists.
>
>
> Lennart
> --
> *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
> L.C. Karssen
> Department of Physics and Astronomy
> Faculty of Science
> Utrecht University
> Princetonplein 1
> 3584 CC Utrecht
> The Netherlands
>
> tel.: +31 (0)30-253-2208
> fax.: +31 (0)30-253-7468
> e-mail: L.C.Karssen_at_phys.uu.nl
> www: http://www1.phys.uu.nl/wwwaoud
> -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
>
>
> _______________________________________________
> comedi mailing list
> comedi_at_comedi.org
> https://cvs.comedi.org/cgi-bin/mailman/listinfo/comedi
Alessandro Toso
Dipartimento di Ingegneria Aerospaziale
Politecnico di Milano
Via La Masa, 34
20156 Milano (Italy)
tel : +39 02 2399 8044
fax : +39 02 2399 8329
e-mail : toso_at_aero.polimi.it
Attachments
- application/pkcs7-signature attachment: smime.p7s
Received on 2007-06-05Z13:21:59