Re: [PARPORT] Reading from pin - help.

From: Nate (nate@uniwest.com)
Date: Thu Dec 19 2002 - 20:18:39 EST

  • Next message: Matthew Duggan: "Re: [PARPORT] Reading from pin - help."

    Are you sure this is a Parallel Device? Because it sounds like a Serial
    Device and there are some DB-25 pin connectors that look like parallel, but
    they are serial...

    Please reply to the list as others can probably help you better than I.

    Nate

    ----- Original Message -----
    From: "Pawel Stochlinski" <int01h@sentinel.mj12.eu.org>
    To: "Nate" <nate@uniwest.com>
    Sent: Thursday, December 19, 2002 5:15 PM
    Subject: Re: [PARPORT] Reading from pin - help.

    > Of course, but the ds1820 sensor has 2 pins:
    > GROUND and DATA (bi-direcional pin).
    >
    > GND is connected t 18'th pin on Paraller port
    > the DATA pin of sensor is plugged to pin 11 (non negative right now -
    > easier)
    >
    > All i have to do, is (how says the manual) - change voltage to LOW on
    > datapin(pin 11'th) for 600mseconds and so on, and next i should read
    > incoming bytes from datapin on sensor. And that is all, thats what i am
    > asking for.
    > If i'll write:
    >
    > write_LPT(0x00,STATUS); //write_LPT is an function for outb(byte,port);
    >
    > will that above, set the STATUS pins to low state ?
    >
    > That was my last question, i'm sorry, but i am in need also :(
    >
    >
    > "Ulubiency bogow umieraja mlodo ale pozniej zyja wiecznie w ich
    > towarzystwie" [Fryderyk Nietzsche]
    >
    ____________________________________________________________________________
    > __
    > Pawel Stochlinski (int01h)
    > Linux registered user: #246375
    > (http://sentinel.mj12.eu.org||http://ipe.ath.cx)
    > -----BEGIN PGP MESSAGE-----
    > Version: GnuPG v1.0.7 (GNU/Linux)
    >
    > owGbwMvMwCS46Lmlj0renf2MawSTuPSKM9PzEktKi1JtmS894uqwZ2ZlALFgigSZ
    > 1BoZ5gfNr/iXLPy+r3f/lXk7Zdqar1ebVDAsuOU9S+e8yUeby+tYdr/1PL2nliF+
    > CgA=
    > =lIWg
    > -----END PGP MESSAGE-----
    >
    >
    > ----- 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 2:05 AM
    > Subject: Re: [PARPORT] Reading from pin - help.
    >
    >
    > > 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:23:34 EST