Board index » delphi » accessing parallel port

accessing parallel port

Can someone tell me how to access the parallel port
using Borland Pascal 7.0???

thanks sooooo much

-joe

 

Re:accessing parallel port


you can use PORT command,

ADDRESS:=$378;{PORT ADDRESS}

   DATA:= ADDRESS;
 STATUS:= ADDRESS + 1;
CONTROL:= ADDRESS + 2;

PORT[DATA]:= $0A;  {WRITE $0A PORT }
MY:=PORT[DATA];    {READ  PORT }

--
-----------------------------------------------
 mailto:suley...@netas.com.tr              
-----------------------------------------------

Re:accessing parallel port


Here is a description of the adresses involved from helppc.
(u might wanna download helppc, it is very usefull on all kinds of
hardware issues:
http://gryphon.ccs.brandeis.edu/public/jon/programming/helppc.zip)

Helppc reports 378 as base adress for the parallel ports:
270-27F  Third parallel port (see PARALLEL PORT)
  278 data port
  279 status port
  27A control port
378-37F  Second Parallel Printer (see PARALLEL PORT)
         First Parallel Printer (see PARALLEL PORT)
378 data port
379 status port
37A control port
3BC-3BF  Primary Parallel Printer Adapter (see PARALLEL PORT)
3BC parallel 1, data port
3BD parallel 1, status port
3BE parallel 1, control port

explanation for the ports:

Port 3BC printer data output  (readable)
 |7|6|5|4|3|2|1|0|  ports 278, 378, 3BC
  | | | | | | | +---- data bit 0, hardware pin 2
  | | | | | | +----- data bit 1, hardware pin 3
  | | | | | +------ data bit 2, hardware pin 4
  | | | | +------- data bit 3, hardware pin 5
  | | | +-------- data bit 4, hardware pin 6
  | | +--------- data bit 5, hardware pin 7
  | +---------- data bit 6, hardware pin 8
  +----------- data bit 7, hardware pin 9
Port 3BD printer status register   (Parallel Printer Port)
 |7|6|5|4|3|2|1|0|  ports 279, 379, 3BD
  | | | | | | | +---- 1 = time-out
  | | | | | +------- unused
  | | | | +-------- 1 = error,  pin 15
  | | | +--------- 1 = on-line,  pin 13
  | | +---------- 1 = out of paper,  pin 12
  | +----------- 0 = Acknowledge,  pin 10
  +------------ 0 = busy,  pin 11
Port 3BE printer control register   (Parallel Printer Port)
 |7|6|5|4|3|2|1|0|  ports 27A, 37A, 3BE
  | | | | | | | +---- 1 = output data to printer,  (pin 1)
  | | | | | | +----- 1 = auto line feed,  (pin 14)
  | | | | | +------ 0 = initialize printer,  (pin 16)
  | | | | +------- 1 = printer reads output,  (pin 17)
  | | | +-------- 0 = IRQ disable,1=IRQ enable for ACK
  +------------- unused

In pascal u can set/read these adresses with
Base := $3BC;                      {or $378 or $278, easy to try}
Port[Base] := random(255);         {output a byte on the data lines}
Port[Base+2] := Port[Base+2] Or 4; {set initialize printer high}
or
Byt := Port[Base];                 {read data lines}

Chris

Quote
Joe P. Said wrote in message <6241sr$...@mozo.cc.purdue.edu>...
>Can someone tell me how to access the parallel port
>using Borland Pascal 7.0???

>thanks sooooo much

>-joe

Re:accessing parallel port


Quote
Chris Meijer wrote:

> Here is a description of the adresses involved from helppc.
> (u might wanna download helppc, it is very usefull on all kinds of
> hardware issues:
> http://gryphon.ccs.brandeis.edu/public/jon/programming/helppc.zip)

[...]

Apparently, the file has been updated and this URL is no longer valid.

Try

  http://gryphon.ccs.brandeis.edu/public/jon/programming/helppc21.zip

There is also an information file at

  http://gryphon.ccs.brandeis.edu/public/jon/programming/helppc21.inf

Best Regards,

Mike
CEO, Analog & Digital Design
Automated Production Test
  http://www.csolve.net/~add/home.htm

Hosting Jonathan Ramsey's Pascal TCP/IP for DOS:
  http://www.csolve.net/~add/zips/tcp.htm

Re:accessing parallel port


Quote
>Subject: accessing parallel port
>From: js...@ector.cs.purdue.edu (Joe P. Said)
>Date: Wed, Oct 15, 1997 23:32 EDT
>Message-id: <6241sr$...@mozo.cc.purdue.edu>

>Can someone tell me how to access the parallel port
>using Borland Pascal 7.0???

>thanks sooooo much

>-joe

You could access parallel ports, but is it necessary?

The printer's so slow compare to the computer anyway so speed wouldn't matter.
 You might as well use the BIOS functions (int 17h) or just use the DOS file
 devices Lpt1, Lpt2, & Lpt3.

To find # of printers/parallel ports installed use int 11h.

You could get the base port addresses for LPT1 thru LPT3 by the following:
LPT1Port := MemW [0040h:0008h];
LPT2Port := MemW [0040h:000Ah];
LPT3Port := MemW [0040h:000Ch];

The base addresses is the parallel port's data port where you send stuff out.
 Base address + 1 gives the address of the status port and base address + 2
 gives the address of the control port.
To access a port of a given address use the following:

Port [Address] := Value_to_Ouput_to_Port;
Value_to_Input_from_Port := Port[Address];

That's just about as much as I know about parallel ports.  I also know that on
 some systems there is something called Enhanced Parallel Ports which is
 supposed to allow complete 2-way traffic through parallel ports but I have
 absolutely no idea how that works.

I could e-mail you info on int 11h and int 17h if needed.

Other Threads