Board index » delphi » Using parallel port as I/O Devise

Using parallel port as I/O Devise

Is there any one having an idea how to solve my problem?

I am trying to control some kind of robot system using the parallel port.

On the robot side I have 8 output lines and 8 input lines

Now my question can I access each single line of the PC parallel port ?
Can any one give me an example how to do that with Turbo Pascal?

Since I am not very experienced in developing such kind off software I hope
some one can give me some good advise

Thanks Henry Wyssen

E-Mail hwys...@swissonline.ch

 

Re:Using parallel port as I/O Devise


Quote
"Heinrich Wyssen" <hwys...@swissonline.ch> wrote:
>Is there any one having an idea how to solve my problem?
>I am trying to control some kind of robot system using the parallel port.
>On the robot side I have 8 output lines and 8 input lines
>Now my question can I access each single line of the PC parallel port ?
>Can any one give me an example how to do that with Turbo Pascal?
>Since I am not very experienced in developing such kind off software I hope
>some one can give me some good advise
>Thanks Henry Wyssen
>E-Mail hwys...@swissonline.ch

The standard parallel port has 8 output bits, but only 5 input bits.
Update the output bits by writing to port $3BC or $378, depending on
the address of your port.  You can read in the 5 bits at port $3BE or
$37A.

Var PortAddress: Word;
       Status: Integer;

begin
PortAddress := memw[$40:8];   { Get your port address,
                                                   this assumes lpt1 }
Port[PortAddress] := $ff;            { set all bits to 1's }
Status := Port[PortAddress+2]; { read in the input bits }
end.

Re:Using parallel port as I/O Devise


 "<> On the robot side I have 8 output lines and 8 input lines

Wouldnt be a{*word*106} smith kit by any chance would it?

Luke Peterson,
Four Dimensional Technologies (4DT)

.. You can't do that. It's been digitally cursed.
-=-
|Fidonet:  Cheater 12:200/10
|Internet: Chea...@digicomm.aust.com
|
| DIGICOMM BBS & DigiGate FidoNet <--> UseNet SMTP Gateway
| Standard disclaimer: The views of this user are strictly his own.

Re:Using parallel port as I/O Devise


The date  Fri, 15 Aug 1997, the time 10:49:28,  Heinrich Wyssen sipped
the last dregs of cold coffee and, smirking, hit the return key........

Quote
>Is there any one having an idea how to solve my problem?

>I am trying to control some kind of robot system using the parallel port.

>On the robot side I have 8 output lines and 8 input lines

>Now my question can I access each single line of the PC parallel port ?
>Can any one give me an example how to do that with Turbo Pascal?

>Since I am not very experienced in developing such kind off software I hope
>some one can give me some good advise

>Thanks Henry Wyssen

>E-Mail hwys...@swissonline.ch

The date  Fri, 15 Aug 1997, the time 10:49:28,  Heinrich Wyssen sipped
the last dregs of cold coffee and, smirking, hit the return key........

Quote
>Is there any one having an idea how to solve my problem?

>I am trying to control some kind of robot system using the parallel port.

>On the robot side I have 8 output lines and 8 input lines

>Now my question can I access each single line of the PC parallel port ?
>Can any one give me an example how to do that with Turbo Pascal?

>Since I am not very experienced in developing such kind off software I hope
>some one can give me some good advise

>Thanks Henry Wyssen

>E-Mail hwys...@swissonline.ch

Here's what you've got;

LPT1 &H378        &H379        &H37A
LPT2 &H278        &H279        &H27A

bit  line         line         line
---  ----        ------       ------
0    D0          unused    NOT out0
1    D1          unused    NOT out1
2    D2          unused        out2
3    D3           in3      NOT out3
4    D4           in4         unused
5    D5           in5         unused
6    D6           in6*        unused
7    D7       NOT in7         unused

As you can see you only have 5 inputs, input 7 is inverted and in6(*)
can generate an interrupt (this is the printer acknowledge bit).
you can access i/o from here directly using  port[address].
If you want 8 inputs you'll have to use some external logic to multiplex
the input lines.

I've some other useful stuff I've accumulated on the subject including a
routine for handling the In6 interrupt, this routine is in C so I'll
email it to you (and anyone else that wants it) but could easily be
converted to Pascal.

--
      .-.                                                  
    .(  >  Andi Carey   Reply to: a...@amcarey.demon.co.uk
   //)'')  Grease monkey * Mouse charmer * pathological liar
  ///''/  tweaker of the tweakable   &   bigger than a rabbit
 //-"-"------------ http://www.amcarey.demon.co.uk ----------

Other Threads