Programming the GPIB-LPT
Section Five
GPIB-LPT User Manual
5-6
© National Instruments Corporation
Programming Considerations
The GPIB-LPT works transparently with any program that uses the parallel port for hardcopy
output. No programming is required. However, you can write your own driver routines. The
following paragraphs explain how to use the GPIB-LPT with the DOS operating system and with
the C and BASIC programming languages. Considerations for programming your own
printer/plotter adapter driver are also discussed. In all examples, the GPIB-LPT is the second
parallel adapter in the system and has been assigned the DOS device name
LPT2
. Since
LPT2
is a
reserved DOS device name, the standard output can be redirected to the GPIB-LPT.
Using the GPIB-LPT with the DOS Operating System
The following DOS command sends the file
example.txt
to the GPIB device connected to the
GPIB-LPT.
type example.txt >lpt2
Note: You press your RETURN or ENTER key to execute these commands.
Similarly, the following DOS command sends the string
"Hello, world"
, along with a
carriage return (
0Dh
), followed by a line feed (
0Ah
), to the GPIB device connected to the GPIB-
LPT.
echo Hello, world>lpt2
The DOS
command is an interrupt-driven print routine (however, it is interrupted by the
internal clock, not by the printer adapter) that can be used to send a file to the GPIB device
connected to the GPIB-LPT. The following command:
print example.txt
will cause DOS to respond with:
Name of list device [PRN]:
Typing
lpt2
(when the board is configured for LPT2) starts sending the file
example.txt
to
the printer. All successive invocations of
assume device
LPT2
is to be used; the prompt
only occurs the first time. See your DOS manual for more information about the
command.