There are two methods of writing data to the data pins of the parallel printer port using the I/O ActiveX control.
Method 1 will work with Windows
NT4.0/2000/XP,
95/98/Me provided you make the proper "loopback"
connections. You can get input by calling ReadByte() only from a
device that supports the 1284 protocol. You can also get input
via
the status lines and the ParallelStatus() function, but doing so will
cause
the parallel port to go "Off Line" so that you will not be able to
write
data to the port. So it is a "in" or "out" use with
Method
1, but not both.
Method 1
Dim Result As Integer
Result = IO1.Open("LPT1:", "")
Result = IO1.WriteByte(&H55) ‘Writes
55 Hex to the parallel port data pins.
Result = IO1.ReadByte() ‘Reads data byte
from device that supports 1284 protocol.
Result = IO1.ParallelStatus
If (Result And PARALLEL_PAPER_EMPTY)
Then
Check1.Value = 1
Else
Check1.Value = 0
End If
IO1.Close
Note: PARALLEL_PAPER_EMPTY needs
to be defined someware to be equal to &h4 (4 hex).
Method 2
Result = IO1.Out(&H378, &H55) ‘This method writes directly to the port (LPT1:).
Result = IO1.In(&H378) ‘This method reads directly from the port (LPT1:).
Port addresses:
LPT1: 378 Hex(Data), 379 Hex(Status), 37A Hex(Control)
LPT2: 278 Hex(Data), 279 Hex(Status), 27A Hex(Control)
LPT3: 3BC Hex(Data), 3BD Hex(Status), 3BE Hex(Control)
The following are
helpful links to other sites with information on the PC's Parallel Port
(you may want to bookmark this list):
http://www.ai.sri.com/~connolly/neuroscience/printer/draft.html
http://www.doc.ic.ac.uk/~ih/doc/par/doc/regpins.html
http://www.doc.ic.ac.uk/~ih/doc/par/
http://www.fapo.com/ieee1284.htm
http://www.fapo.com/files/ecp_reg.pdf
Copyright (c) 1998 by JS Payne