Comedi problem: reading analog input

Hi all,

I tried to read an analog input channel. 


The segment of code and the problem are as follows:


#include <stdio.h> /* for printf() */
#include <comedi.h> /* also included by comedilib.h */
#include <comedilib.h> /* 'cuz we're using comedilib
*/

int subdev = 0;         /* change this to your input
subdevice */
int chan = 0;           /* change this to your channel
*/
int range = 0;          /* more on this later */
int aref = 0;           /* more on this later */

int main(int argc,char *argv[])

{
        comedi_t *cf;
        int chan=0;
        lsampl_t data;
	int maxdata,rangetype;
	double volts;

        cf=comedi_open("/dev/comedi0");

	maxdata=comedi_get_maxdata(cf,subdev,chan);

	rangetype=comedi_get_rangetype(cf,subdev,chan);

       
comedi_data_read(cf->fd,subdev,chan,range,aref,&data);

	volts=comedi_to_phys(data,rangetype,range,maxdata);

        printf("%d %g\n",data,volts);

        return 0;
}


the name of the program is secondcomedi.c, and then a
try to compile:

control:/home# cc secondcomedi.c -lcomedi -o
secondcomedi

and I obtain:

secondcomedi.c: In function `main':
secondcomedi.c:25: dereferencing pointer to incomplete
type
secondcomedi.c:27: warning: passing arg 2 of
`comedi_to_phys' makes pointer from integer without a
cast
secondcomedi.c:27 too many arguments to function
`comedi_to phys'


what is wrong?

Thanks.

Cobertura especial de la Copa Mundial de la FIFA Corea-Japón 2002, sólo en Yahoo! Deportes:
http://ar.sports.yahoo.com/fifaworldcup/

Received on 2002-06-13Z17:44:07