comedi_command()

I want to make a program which writes one data (maxdata, 4095) into a channel of an analogic output. When i execute the program i get this:

comedi_command: Conseguido

However, i look at the output channel and i see the voltage corresponding to the maxdata.

Here are a part of my program. Can anybody help me? Thank you and pardon for my ignorance.

 

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

if (device<0)

{

comedi_perror("/dev/comedi0");

exit(1);

} 



/* Inicializamos la estructura comedi_cmd */

memset (cmd,0,sizeof(cmd));



/* Configuramos la estructura comedi_cmd */



cmd->subdev=subdevice;

cmd->flags=0;

cmd->start_src=TRIG_NOW; /* La escritura de datos comienza de inmediato*/

cmd->start_arg=0;

cmd->scan_begin_src=TRIG_TIMER; /* Se escribe el conjunto de muestras (scan) a la velocidad indicada en el argumento */

cmd->scan_begin_arg=100; /* 100 nanosegundos */

/* Velocidad a la que realizamos cada muestra */

cmd->convert_src=TRIG_NOW;

cmd->convert_arg=0; /* Lo mas rapido posible */

cmd->scan_end_src=TRIG_COUNT;

cmd->scan_end_arg=nchan;

/* Escribiremos solo un conjunto de muestras (1 scaneo) */

cmd->stop_src=TRIG_NONE;

cmd->stop_arg=0;

chanlist[0]=CR_PACK(0,0,AREF_GROUND);

cmd->chanlist=chanlist;

cmd->chanlist_len=1;

ret=comedi_command_test(device,cmd);

if (ret<0)

{

comedi_perror("comedi_command_test");

exit(1);

}

//write (comedi_fileno(device),&data,sizeof(sampl_t));

if (err=comedi_command(device,cmd)<0)

{

printf("Casaca en el comedi_command");

comedi_perror("comedi_command");

exit(1);

}

while(1)

{

write(comedi_fileno(device),&data,sizeof(sampl_t));

}

}

 

 


---------------------------------
Copa del Mundo de la FIFA 2002
El único lugar de Internet con vídeos de los 64 partidos ¡Apúntante ya!.

Received on 2002-07-02Z21:27:04