- From: Breno Maia de Carvalho <brenoaut_at_yahoo.com.br>
- Date: Fri, 19 Oct 2007 13:52:40 -0300 (ART)
Hey everyone...
I´m from Brazil and i´ve been trying to use a
advantech card, the 1710 through comedi.
I've written the most simple code to try to figure out
how i can read data. It is not working though.
I think i had loaded all the modules that i was
supposed to.
List from lsmod
Module Size Used by
adv_pci1710 13184 0
rtai_comedi 4608 0
kcomedilib 12800 1 rtai_comedi
comedi 34464 2 adv_pci1710,kcomedilib
rtai_shm 9344 1 rtai_comedi
rtai_sem 18048 1 rtai_comedi
rtai_fifos 27468 0
rtai_sched 83224 5
rtai_comedi,kcomedilib,rtai_shm,rtai_sem,rtai_fifos
rtai_hal 32184 8
adv_pci1710,rtai_comedi,kcomedilib,comedi,rtai_shm,rtai_sem,rtai_fifos,rtai_sched8250
19732 2
serial_core 20608 1 8250
sis 9280 2
drm 65300 3 sis
sis900 21248 0
mii 4992 1 sis900
processor 17600 0
cpufreq_powersave 1664 0
cpufreq_performance 1792 0
cpufreq_ondemand 5148 0
freq_table 3716 0
fuse 37772 0
parport_pc 36964 0
ppdev 8196 0
parport 36424 2 parport_pc,ppdev
psmouse 37000 0
i2c_sis630 6412 0
i2c_core 17936 1 i2c_sis630
sis_agp 6276 1
agpgart 26544 2 drm,sis_agp
evdev 7808 1
And, of course that i did "comedi_config /dev/comedi0
pci1710"...
Now below is my code, compile through gcc -lm -lcomedi
-o
#include <stdio.h> /* for printf() */
#include <comedilib.h>
int subdev = 0;
int chan = 0;
int range = 0;
int aref = 0;
int main(int argc,char *argv[])
{
comedi_t *cf;
int chan=0;
lsampl_t data;
int maxdata,rangetype;
double volts;
comedi_range *range;
cf=comedi_open("/dev/comedi0");
for(chan=0;chan<68;chan++){
maxdata=comedi_get_maxdata(cf,subdev,chan);
rangetype=comedi_get_rangetype(cf,subdev,chan);
range=comedi_get_range(cf,subdev,chan,rangetype);
comedi_data_read(cf,subdev,chan,rangetype,aref,&data);
volts=comedi_to_phys(data,range,maxdata);
printf("%d %g\n",data,volts);
}
return 0;
}
And everytime that i run this code i receive the some
info from all the channel, two results below:
-1209036056 nan
-1209036056 nan
-1209036056 nan
-1209036056 nan
-1209036056 nan
-1209036056 nan
-1209036056 nan
-1209036056 nan
-1209036056 nan
-1209036056 nan
-1209036056 nan
-1209036056 nan
this keeps on for the 68ths channels
and another one:
-1209298200 nan
-1209298200 nan
-1209298200 nan
-1209298200 nan
-1209298200 nan
-1209298200 nan
-1209298200 nan
-1209298200 nan
-1209298200 nan
-1209298200 nan
And to my board is conected a signal generator in the
pins 60 and 68...
CAN ANYONE HELP ME?
thanks a lot anyway
Abra sua conta no Yahoo! Mail, o único sem limite de espaço para armazenamento!
http://br.mail.yahoo.com/
Received on 2007-10-19Z15:52:40