USB Printing

Below is some basic print configuration information.

The Device Table is used to define the devices used by NPL applications. Niakwa applications use the traditional WANG/Basic-2 method of addressing devices.  The Basic-2 definition is specified to the left of the equal sign in the device table.  On the right side of the equal sign is the way the computer OS addresses Devices.  Typically the device table is defined in the BOOT file.  It can be defined or redefined anywhere in the application but that is bad programming and creates a maintenance nightmare.

In the default device table we see:

DEVICE(/015) = “LPT1”

When the NPL program sends output to 015, the computer actually sends output to LPT1.


There are ways to change default behavior by adding modifier parameters as well, such as:

DEVICE(/015) = “LPT1 ALF=Y”

The ALF=Y parameter adds Automatic Line Feeds after each line.


While NPL cannot directly address USB ports.  In Windows, NPL applications can address the Windows Print Manager (and USB printers defined in Windows) by using certain character strings, examples are below.

$DEVICE(/004)=”>()” : Defines printer 004 as the Windows DEFAULT Printer.

$DEVICE(/004)=”>(?)” :  Forces the user to select a printer from the Windows printer selection box each time the printer is addressed.

$DEVICE(/004)=”>(?) SET=Y” : Forces the user to select a printer when the printer is addressed, then sets device 004 to that printer until the program ends or resets the printer.

————- HERE’S A NEAT TRICK ————

$DEVICE(/004)=”>(?) SET=Y”: Can also be used to find the Windows definition for that printer so the definition can be hard coded into the $DEVICE table.  That way the end user does not have to make a printer selection.

Here’s how:

1. Make sure the printer is configured in Windows.

2. Start RTIWIN32 with no program and manually enter the following small program.

10 $DEVICE(/215) “>(?) SET=Y”





3. Run the program.  A windows printer selection box will pop up and allow you to select a printer.

4. Select the printer you want to define and let it print.  The printer output should be HELLO followed by   the device table.

5. Take careful note of exactly the way device 215 is listed.

6. Enter that DEVICE definition into your program exactly as it appears in the printed Device table and substitute XPA=Y for SET=Y.

Why substitute XPA=Y for SET=Y?

Normally, the Windows print manager strips control codes from print jobs to allow the printer driver to control the printer.  The XPA=Y parameter tells the print driver to NOT strip out control codes from the print job but to pass them through to the printer. If that particular printer driver doesn’t support the “pass through” option, you will get a P-48 error the first time you try to print to that device.  If that happens, you may be able to configure Windows “Generic text only” printer driver for that printer and use the “XPA=Y” option.  After all, you are sending control codes to the printer anyway.  If you get a double page feed at the end of the print job, change the “Paper” setting in the properties window of the Generic printer driver to “Continuous, No page break”.

==== The following may be useful to know=======

You should be aware that most of the early USB inkjet printers will only work when driven by a Windows program,  they will not accept input from NPL.  Happily, most of the USB Inkjet printers produced within the last 10 years, or so, seem work fine with NPL.