Re: pci1730 data read problem

Not quite sure, but if do_insn thing should be implemented in the
driver, that might be a problem, if the driver lacks something. But I
am not sure, perhaps COMEDI experts might help here.

If you're sure that you wrote a correct instruction and it's not
working, just switch to what is working.

Cheers, Askar

2007/10/15, Lopez Jose Alejandro-MGIF1203 <MGIF1203_at_motorola.com>:
>
> Hi,
>
> The function comedi_data_read() reads one data value from the specified channel and places the data value in the location pointed to by data. And I need to read multiple data in different channels (8 channels (8bit))
>
>
>
> -----Original Message-----
> From: Askar Ibragimov [mailto:askar.ibragimov_at_gmail.com]
> Sent: Monday, October 15, 2007 1:43 AM
> To: José Alejandro López Corella
> Cc: comedi_at_comedi.org; Lopez Jose Alejandro-MGIF1203
> Subject: Re: pci1730 data read problem
>
> Hi,
>
> why not to use comedi_data_read () ?
>
>
> 2007/10/15, José Alejandro López Corella <corella91_at_yahoo.com>:
> > Hi to all
> >
> > I have a problem since I cannot read data with the card advantech pci
> > 1730 but if I can have exit of data.
> >
> > somebody can help me?
> >
> > #include <stdio.h>
> > #include <malloc.h>
> > #include <string.h>
> >
> > #include <comedilib.h>
> >
> > #include <fcntl.h>
> > #include <unistd.h>
> > #include <errno.h>
> > #include <sys/time.h>
> > #include <unistd.h>
> >
> > const int NBITS = 8;
> >
> > int main(int argc, char **argv){
> >         comedi_t *comedi;
> >         comedi_insn cmd;
> >         lsampl_t bits[NBITS];
> >         int ret, channel, range, subdev, aref, i;
> >
> >         /* Limpiamos los valores de bits */
> >         memset(bits, 0, sizeof(lsampl_t) * NBITS);
> >
> >         /* Abrimos el device del comedi*/
> >         comedi = comedi_open("/dev/comedi0");
> >
> >         if (comedi == NULL){
> >                 printf("No se pudo abrir /dev/comedi0\n");
> >                 return 0;
> >         }
> >
> >         /* Seleccionamos Canal y rango */
> >         channel = 0;
> >         range = 0;
> >         aref = AREF_GROUND;
> >         subdev = 0;
> >
> >         /* Banderas, INSN_BITS es para modo digital. */
> >         cmd.insn = INSN_BITS | INSN_READ;
> >         cmd.n = NBITS;                  /* Numero de elementos a leer */
> >         cmd.data = (void*)bits; /* Apuntador a los datos */
> >         cmd.subdev = subdev;            /* Cambiar! */
> >
> >         /* Empaqueta los datos de adquisicion, canal, rango y aref*/
> >         cmd.chanspec = CR_PACK(channel, range, aref);   /*
> > Cambiar! */
> >
> >         /*ret = comedi_dio_config(comedi, subdev, channel,
> > INSN_CONFIG_DIO_INPUT);*/
> >
> >         if (ret == -1)
> >                 printf("Error configurando el canal de entrada\n");
> >
> >         ret = comedi_do_insn(comedi, &cmd);
> >
> >         printf("Muestras tomadas: %i\n", ret);
> >
> >         for (i = 0; i < NBITS; i++){
> >                 if (bits[i]){
> >                         printf("Bit %i: 1\n", i);
> >                 }else{
> >                         printf("Bit %i: 0\n", i);
> >                 }
> >         }
> >
> >         comedi_close(comedi);
> >
> >         return 0;
> > }
> >
> >
> >
> >
> > ______________________________________________________________________
> > ______________
> > ¡Sé un mejor fotógrafo!
> > Perfecciona tu técnica y encuentra las mejores fotos.
> > http://telemundo.yahoo.com/promos/mejorfotografo.html
> >
>
>
> --
> ICQ 19576333  Cellular +358 45 6386080
>


-- 
ICQ 19576333  Cellular +358 45 6386080

Received on 2007-10-15Z13:23:43