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
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
the status lines and the ParallelStatus() function, but doing so will
the parallel port to go "Off Line" so that you will not be able to
data to the port. So it is a "in" or "out" use with
1, but not both.
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)
Check1.Value = 1
Check1.Value = 0
Note: PARALLEL_PAPER_EMPTY needs
to be defined someware to be equal to &h4 (4 hex).
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:).
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):
Copyright (c) 1998 by JS Payne