- From: Francisco Mota <mota_at_dca.ufrn.br>
- Date: Fri, 17 Feb 2006 16:03:05 +0000
Hi all,
We could finally resolve the problem of reading through parallel port.
We give up using subdevice 0 (I/O) and used subdevice 1 that defaults to
input (pins 10-13 and 15). Thanks Daniel and Franco for the help. The
code below now works just fine.
Cheers.
Francisco Mota
===========================================
#include <math.h>
#include <stdio.h>
#include <unistd.h>
#include <comedilib.h>
int subdev = 1;
int chan = 3;
//int range = 0;
//int aref = AREF_GROUND;
int main()
{
comedi_t *it;
unsigned int in=0; // unsigned
int test=0;
it=comedi_open("/dev/comedi0");
//comedi_dio_config(it, subdev, chan, COMEDI_INPUT);
test=comedi_dio_read(it, subdev, chan,&in);
printf("%d %d\n", test,in);
return 0;
}
======================================
Franco Minutiello wrote:
> Francisco Mota wrote:
>
>> Hello all,
>>
>> I am using comedi for controlling a stepper motor through parallel
>> port. The point is that the comedi "write" command works fine, but I
>> am having hard time in reading from it (I always get "1"). Has anyone
>> experienced that problem?
>>
>> Francisco Mota
>
>
> Have you problem in reading data fom D0-D7?
> I had the same problem.
> I modified the following lines in function parport_insn_a
> #ifdef notdef
> data[1] = inb(devpriv->a_data);
> #else
> data[1] = inb(dev->iobase+PARPORT_A);
> #endif
> Now it works fine
>
Received on 2006-02-17Z16:03:05