Re: comedi dio read/write help

What do you do exactly? I don't have the same board as you, but I've
been trying the DIO channels on another one, to see how exactly do
they work.

More experienced people might say other things, I think when you are
trying to set channels things up, it's better if you have a small 5V
power supply, connected to the appropriate digital channels. When you
are setting up the digital input, just turn the power supply on/off,
and you should have the 1/0 reading... When using the digital output
channels, connect it to a voltmeter, or a scope... The thing: don't
let the channel just to float, that will give you wrong reading - as
you would expect, if it just floats, there's nothing to read.

So, for example, if you are trying to write to a channel and read it
back, connect the channel to the power supply that is turned off. You
should be able to read/write the values properly. But I still suggest
the separate setting up of the input and output in the beginning.

I hope this solves your problem, it certainly works for me now....
Basic electronics, I guess....

    Greg


On 18/08/07, Sayoji Siv <mail-for-me_at_lycos.com> wrote:
>
>  Yes...the subdevice 0 is the digital input, and subdevice 1 is the digital output. But, even though when i specify it correctly in the code,
>                             comedi_dio_write ( it,  1,  chan, 1);
>  itz reading 0 always. Any other suggestions.
> Thanks
>
>
>
>
>
>
> ---------[ Received Mail Content ]----------
>
>  Subject : Re: comedi dio read/write help
>
>  Date : Fri, 17 Aug 2007 15:58:30 +0100
>
>  From : "Gergely Imreh" <imrehg_at_gmail.com>
>
>  To : "Comedi Mailing List" &lt!  ;comedi_at_comedi.org>
>
>
>
> Hi,
>
>
>
>    Just judging by the output of the comedi_config, the subdevice 0 is
>
> the digital input, and subdevice 1 is the digital output. Because of
>
> this, your program has to configure the two different subdevices
>
> differently, and read/write them separately.
>
>
>
>    I don't have the same type of card around to try this, but I think
>
> with these modifications it should be possible to read and write to
>
> the digital channels.
>
>
>
>   Cheers,
>
>       Greg
>
>
>
>
>
>
>
> On 14/08/07, Sayoji Siv  wrote:
>
> >
>
> >  Thanks of ur reply. I added comedi_dio_config
>
> >
>
> > comedi_dio_config ( it, subdev, chan,COMEDI_INPUT );
>
> > comedi_dio_config ( it, subdev, chan,COMEDI_OUTPUT );
>
> >
>
> > but still i am getting the output as
>
> > data = 0
>
> > data1 = 0
>
> >
>
> > !  Normally we will used to do I/O operation by ports. In comedi the port s are specified as subdevice. May I know in details about channels or lines.
>
> >
>
> > Eg
>
> >      PORT1 - Digital  input (8 channels / lines for this port)
>
> >       .
>
> >       .
>
> >       PORT 4 - Digital Output (8 channels /line)
>
> >
>
> > How this ports and channel specifications are accesed when using comedi drivers
>
> >
>
> > The output of the comedi_test code is given below. How it is related to abov!  e specified example port configuration ?
>
> >
>
> > I: subdevice 0
>
> > I: testing info...
>
> > rev 1
>
> > I: subdevice type: 3 (digital input)
>
> >   number of channels: 32
>
> >   max data value: 1
>
> >   ranges:
>
> >     all chans: [0,5]
>
> > I:
>
> > I: subdevice 1
>
> > I: testing info...
>
> > rev 1
>
> > I: subdevice type: 4 (digital output)
>
> >   number of channels: 32
>
> >   max data!   value: 1
>
> >   ranges:
>
> >     all chans: [0,5]
>
>

Received on 2007-08-18Z19:59:32