Re: NI-PCI-6534, read and write failures.

* Frank Mori Hess <fmhess_at_users.sourceforge.net> [2005-01-25 19:09]:
> On Tuesday 25 January 2005 12:49 pm, Jack W Holloway wrote:
> >
> > My problem is this: it seems as though I can't read or write bits to the
> > device. I've written my own simple code using comedi_dio_bitfield(),
> > I've tried using the comedilib demos, inp, and outp.
> >
> 
> You need to configure the channels as outputs with comedi_dio_config(), you 
> might try the dio demo.
> 
> -- 
> Frank
> 

Frank,

I was under the impression that setting the write_mask argument of the
comedi_dio_bitfield() function would do all the directional configuration
for me. Regardless of any misunderstanding, calling comedi_dio_config()
appropriately had no effect on any write/read operations.

Anyway, here's a little snippet of the code I've got. It's ridiculously
simple, but I get nothing on any of the connector bits.
--------------------------------------------------------------------------

it=comedi_open("/dev/comedi0");
if(!it)
{
	comedi_perror("/dev/comedi0");
	exit(-1);
}

subdev = 0;
chan = 0;
while(chan<32)
{
	result = comedi_dio_config(it,subdev,chan,COMEDI_OUTPUT);
	if(result == -1)
	{
		printf("comedi_dio_config failed on channel %d\n", chan);
		comedi_close(it);
		exit(-1);
	}
        chan = chan + 1;
}

write_mask = 0xFFFFFFFF;        
temp = 0xFFFFFFFF;
bits = &temp;

result = comedi_dio_bitfield(it, subdev, write_mask, bits);
if(result == -1)
{
	  printf("Error in testing\n");
	  comedi_close(it);
	  exit(-1);
}
------------------------------------------------------------------

I had tried the dio command in the comedilib demo directory to find that
the board behaved the same as I have come to expect. It's very
curious. Apart from the +5V pin on the connector (pin 1), all the reset of
the pins remain at zero regardless of what I write to the device.

Any ideas out there?

-Jack

-- 
Jack W. Holloway				holloway_at_mit.edu
Remote Sensing and Estimation Group		
MIT Research Laboratory of Electronics
77 Massachusetts Ave., Room 26-344		617.253.3o74
Cambridge, MA o2139

Received on 2005-01-26Z22:23:01