- From: David García <kid_dv_at_yahoo.es>
- Date: Sat, 6 Jul 2002 14:55:19 +0200 (CEST)
Hi to all
I´m trying to execute a program output 4096 samles ( numbering from 0 to 4095).
the info demo provide the next information:
overall info:
version code: 0x00073b
driver name: ni_pcimio
board name: pci-6024e
number of subdevices: 7
.
.
subdevice 1:
type: 2 (analog output)
number of channels: 2
max data value: 4095
ranges:
all chans: [-10,10] [0,10] [-1,1] [0,1]
command:
start: now
scan_begin: timer
convert: now
scan_end: count
stop: none|count
command fast 1chan:
can't do timed?!?
not supported
Well, when i try to execute my program, the sencond comand_comedi_test return 0. However, th comedi_command() function return to me -1 and the comedi_perror give me the following error:
Comedi_command: Conseguido
The Spanish word "conseguido" means in English "achieve".
I think the error is printable in Spanish because is a System Operative error, DO you think?
I would be lovely if somebody could help me because i´m driving crazy for this problem.
Any more cuestion: Does it output the 4096 samples in one scan or no? i very confused and I like somebody explain to me how the samples are output and how works the streaming buffer the comedi.
Here you are my code:
#include <comedilib.h>
#include <comedi.h>
#include <linux/kernel.h>
int main(int argc, char *argv[])
{
comedi_t *device;
comedi_cmd cmd;
sampl_t data[4096];
int subdevice; /* Dispositivo de Salida Analogica */
unsigned int chanlist[1];
int ret=1;
int err;
int i;
int m;
subdevice=1;
for(i=0;i<4096;i++)
data[i]=i;
device=comedi_open("/dev/comedi0");
if (device<0)
{
comedi_perror("/dev/comedi0");
exit(1);
}
// subdevice=comedi_find_subdevice_by_type(device,COMEDI_SUBD_AO,0);
/* Inicializamos la estructura comedi_cmd */
memset (&cmd,0,sizeof(cmd));
/* Configuramos la estructura comedi_cmd */
cmd.subdev=subdevice;
cmd.flags=TRIG_WAKE_EOS;
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=1000000; /* 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=1;
/* 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;
while(ret!=0)
{
ret=comedi_command_test(device,&cmd);
if (ret<0)
{
comedi_perror("comedi_command_test");
exit(1);
}
}
//lseek (comedi_fileno(device),subdevice,SEEK_SET);
write (comedi_fileno(device),data,sizeof(sampl_t)*4096);
err=comedi_command(device,&cmd);
if (err<0)
{
comedi_perror("comedi_command");
}
while(1)
write(comedi_fileno(device),data,sizeof(sampl_t)*4096);
}
Thank you very much for you greatful help and sorry for my bad English (i hope it will be better soon)
Universidad Politecnica de Madrid (EUITT)
---------------------------------
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-06Z11:55:19