How this works as I understand it is you need to read the nAck to know when
the data in the data register is valid.
So you shouldn't just be reading one pin. The nAck can be set by the other
source to indicate that you can consider the data register to be valid.
This all depends on what cable you are using and how the device works.
You are not going to be able to read X number of bytes just across one pin.
You must follow the design of the sensor, if it has one. Typically a source
will write data to the data register and then write to its own control
register to indicate that the data is valid and ready. Then the reading
computer will read its own status to see that the source wrote to the
source's own control register, so the data in the data area must be good.
Then read the data and write back on its own control register that is it
done reading. Now the source reads the source's status and sees that the
reading computer read it. It will keep going until its done.
I hope that gives a picture and isn't too confusing. It depends greatly on
the wiring too, a LapLink cable is different than a Straight-Through
Parallel Cable.
So you will be reading and writing to at least three areas: DATA, CONTROL
and STATUS.
Try reading some of the links I sent earlier too, for a better explanation,
than I can do.
Good luck.
Nate
----- Original Message -----
From: "Pawel Stochlinski" <int01h@sentinel.mj12.eu.org>
To: "Nate" <nate@uniwest.com>
Sent: Thursday, December 19, 2002 4:53 PM
Subject: Re: [PARPORT] Reading from pin - help.
> Kewl, this is what i have done earlier, but how do i read a data from that
> port?
> The main question from me is :
> "How can i read a data flowing to pin 10 (nACK) ?"
>
> Big thnx.
>
> ----- Original Message -----
> From: "Nate" <nate@uniwest.com>
> To: "Pawel Stochlinski" <int01h@sentinel.mj12.eu.org>
> Cc: <linux-parport@torque.net>
> Sent: Friday, December 20, 2002 1:45 AM
> Subject: Re: [PARPORT] Reading from pin - help.
>
>
> > adding to what "Uwe Bonnes" stated earlier, plus a little more...
> >
> > ///////////////////////////////////////////////////////////////
> > // this assumes you have the appropriate parport modules loaded
> >
> > unsigned char ucStatus = 0;
> > int nFD = -1;
> > int nError = 0;
> >
> > nFD = open( "/dev/parport0", O_RDWR );
> > if( nFD>0 )
> > {
> > nError = ioctl(nFD, PPCLAIM, 0 );
> > if( !nError )
> > nError = ioctl(nFD, PPRSTATUS, &ucStatus );
> > if( !nError )
> > {
> > if( ucStatus & 0x40 ) // is the bit a 1?
> > printf( "nAck or S6 or Pin 10 is 1\n " );
> > else
> > printf( "nAck or S6 or Pin 10 is 0\n " );
> > }
> > close( nFD );
> > }
> >
> > ///////////////////////////////////////////////////////////////
> >
> >
> > Other good references
> >
> > http://www.doc.ic.ac.uk/~ih/doc/par
> > http://www.beyondlogic.org/spp/parallel.htm
> > http://www.lvr.com/files/pppinout.pdf
> >
> >
> > Nate
> >
> >
> >
> >
> >
> >
> > ----- Original Message -----
> > From: "Pawel Stochlinski" <int01h@sentinel.mj12.eu.org>
> > Cc: <linux-parport@torque.net>
> > Sent: Thursday, December 19, 2002 2:53 PM
> > Subject: Re: [PARPORT] Reading from pin - help.
> >
> >
> > > ----- Original Message -----
> > > From: "Uwe Bonnes" <bon@elektron.ikp.physik.tu-darmstadt.de>
> > > To: "Pawel Stochlinski" <int01h@sentinel.mj12.eu.org>
> > > Cc: <linux-parport@torque.net>
> > > Sent: Wednesday, December 18, 2002 10:14 PM
> > > Subject: Re: [PARPORT] Reading from pin - help.
> > >
> > >
> > > > >>>>> "Pawel" == Pawel Stochlinski <int01h@sentinel.mj12.eu.org>
> writes:
> > > >
> > > > Pawel> Please help me - i have a problem with reading a data
from
> > pin
> > > > Pawel> #10 on LPT (its an ACK), what should i write in code, to
> read
> > > it?
> > > > Pawel> I am using x=inb(STATUSPORT); but that is not correct,
> > please,
> > > > Pawel> help me how to read from pin 10...
> > > >
> > > > Do something like
> > > >
> > > > int re;
> > > >
> > > > fd = open(portname,O_RDWR);
> > > >
> > > > ioctl(fd,PPRSTATUS,&res);
> > > >
> > > > Bye
> > > > --
> > > > Uwe Bonnes bon@elektron.ikp.physik.tu-darmstadt.de
> > > >
> > > > Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
> > > > --------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
> > > >
> > > > -- To unsubscribe, send mail to:
linux-parport-request@torque.net --
> > > > -- with the single word "unsubscribe" in the body of the
message. --
> > >
> > > Yep, but when i read from file descriptor the soft is 'blocked'
waiting
> > for
> > > data.
> > >
> > > Isnt there anything easier? I just want to read from some pin a data,
> > > not\hing more.
> > >
> > > Thanks
> > >
> > >
> > > -- To unsubscribe, send mail to: linux-parport-request@torque.net --
> > > -- with the single word "unsubscribe" in the body of the message. --
> > >
> > >
>
>
-- To unsubscribe, send mail to: linux-parport-request@torque.net --
-- with the single word "unsubscribe" in the body of the message. --
This archive was generated by hypermail 2b29 : Thu Dec 19 2002 - 20:10:50 EST