- From: Matt Kubilus <mattkubilus_at_gmail.com>
- Date: Tue, 13 Sep 2005 10:48:02 -0400
Trying to do DIO with the parallel port. I've got comedi setup and installed
and can do output no problem. However, when I try to do input, i always get
one, regardless of the voltage on the line. Any ideas? Here is the test
program I am using.
#include <stdio.h>
#include <comedilib.h>
int subdev = 0;
int chan = 0;
int range = 0;
int aref = AREF_GROUND;
int main(int argc, char *argv[])
{
comedi_t *it;
lsampl_t data;
unsigned int in;
it = comedi_open("/dev/comedi0");
comedi_dio_config(it, 0, 0, COMEDI_INPUT);
comedi_dio_read(it, 0, 0, &in);
printf("%d\n", in);
return 0;
}
Also, is the dio on the parallel port set by channel or subdevice. Can I
have channel 0 be input, channel 1 be output,etc?
Thanks,
Matt Kubilus
Received on 2005-09-13Z13:48:02