- From: Pedro Jurado Maqueda <pjmelenas_at_biwemail.com>
- Date: Wed, 5 Jun 2002 18:58:54 +0200 (CEST)
Hi, I'm development a program that capture a data and introduce it in a database (with mysql).
My problem happens when the program is running, aproximately 15 minutes after begin, the
program don't get more data, not abnormal termination, it continues but show me the next error
whit strerror:
"Bad comedi_t structure"
I upgrade to last version comedi 0.7.64 and comedilib 0.7.18, (with previous versions also
happens) and I'm using DebianPotato with kernel 2.4.12.
The function is called every 1 second, I do this for maximum charge ( 1 second is the minimun
quantum in my program).
Below is the source of my program, only the function that capture, rest I think is irrelevant but I
can send you if you want. Thank you very much for you answer.
#define NUM_CANALES 16 /*Number of channels*/
nt subdev = 0; /* change this to your input subdevice */
int range = 0; /* more on this later */
int aref = AREF_GROUND; /* more on this later */
comedi_range *ptr;
comedi_t *cf;
int maxdata[NUM_CANALES];
int rangetype[NUM_CANALES];
int i; /*index*/
int pope,error; /*some silly integer*/
char *merror; /*message error*/
int INDICE_CANAL /* is a integer assigned in other function but it is also a integer*/
/* and show the number of channels to read*/
void captura()
{
cf=comedi_open("/dev/comedi0");
for(i=0;i<INDICE_CANAL;i++)
{
maxdata[i]=comedi_get_maxdata(cf,subdev,mel[i].canal); /*mel[i].canal is other integer*/
/*inside a struct*/
ptr=comedi_get_range(cf,subdev,mel[i].canal,range);
rangetype[i]=comedi_get_rangetype(cf,subdev,mel[i].canal);
pope=comedi_data_read(cf,subdev,mel[i].canal,range,aref,&data[i]); /*data[i] array of
l_sampl_t*/
if(pope!=1)
{
printf("Here comes the error %i,\n\n\n",pope);
error=comedi_errno();
merror=comedi_strerror(error);
printf("%s",merror);
}
volts[i]=comedi_to_phys(data[i],ptr,maxdata[i]);
printf ("Data is %f volts ",volts[i]); /*volts[i] array of float*/
}
}
Attachments
- application/octet-stream attachment: stored
Received on 2002-06-05Z15:58:54