Talking to a Parallel port

Posted on 2000-02-03
Medium Priority
Last Modified: 2012-06-27
Is there a way to programmatically talk to a parallel port? I know how to talk to a serial port using the mscomm control, but I'd like to send a constant stream of bits (hopefully to a particular pin) and I think using the serial port would eat up all the memory.

The mscomm control is also geared towards modem communications, which I don't really want - I'd probably like a lower level function to say "start sending bits to pin 5 now" and "stop sending bits now".
Question by:ismhome

Accepted Solution

adityau earned 600 total points
ID: 2486200
Download the driver from the following site for PCL-720 and it gives you some API's to program Parallel port.


Expert Comment

ID: 2537907
You can use VB with Printer comands, but only to write, with limitations, to pin's 1-9 of conector DB-25 of parallel port.   But to talk with parallel port you can use DLL you can find in
http://www.zdnet.com/swlib/  searching 'parallel port', like IOPort.VBX (VB3) or LPT.OCX (VB5,6)

This DLL has capability to do input (INP or PEEK function) or output (OUT or POKE function) from Parallel Port, no permited in Visual Basic alone.   The best explanation I found in:
Peter Anderson Home Page (http://www.access.digex.net/~pha/)
Jane Axelson Page, or http://www.lvr.com/parport.htm

Then, your code can use DLL's funcion for input or output electronic signals in pin's of DB25 conector.  If your computer has bidirectional Parallel Port, you can use 1 to 9 pin's for both input and output; if not you can use 1-9 for output and others (13, 15, ..) for input.  In any case, you use a decimal value 0-255 for values of 8 bits (binary to decimal conversion), with this code:

Dir =888 'decimal address for Paralell Port
OUT Dir, 0 'for clearing port
'For write
  Valor= 'decimal value for 8 bits, corresponding to 8 signals in connector pi`'s
  OUT Dir, Valor

'For output
  Input = INP(Dir + 1) 'Register for output is following address


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

599 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question