Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
55 ratings:
 3.49 out of 5     Rate this Document

I Receive Error -37 When Writing to the Parallel Port (LPT1) in LabVIEW

Primary Software: LabVIEW Development Systems>>LabVIEW Full Development System
Primary Software Version: 4.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I receive error -37 (device not found) in LabVIEW when I try to write to my parallel port.

According to page C-6 of the LabVIEW Instrument I/O Reference Manual (320537C-01, January 1996), I can write to my parallel port (LPT1) if I use the LabVIEW Serial Port Write.vi and specify port number 10. The manual says that I can add the following line to the labview.ini file in the LabVIEW directory to make sure that port number 10 is correct:

serialDevices="COM1; COM2; COM3; COM4; COM5; COM6; COM7; COM8; COM9; COM10;
LPT1; LPT2; LPT3; LPT4;"


I tried using this line, but I still receive error -37.

Solution:
The following solution applies to LabVIEW 4.x and to a certain extent, LabVIEW 5.0. LabVIEW 5.1 or later automatically includes the serpdrv file (and daqdrv, if you create a data acquisition application) in your executable. Refer to the Application Builder Troubleshooting Wizard (linked below) for more information.

In LabVIEW 4.x and 5.0, instead add the following line to the labview.ini file:

serialDevices="COM1;COM2;COM3;COM4;COM5;COM6;COM7;COM8;COM9;\\.\COM10;
LPT1;LPT2;LPT3;LPT4"

Do not use spaces after the semicolons and do not use a semicolon after the last port. Also, if you use parallel ports, any references to a COM port greater than COM9 must have \\.\ in front of the COM reference. For example:

serialDevices="COM1;COM2;COM3;COM4;COM5;COM6;COM7;COM8;COM9;\\.\COM10;
\\.\COM11;\\.\COM12;\\.\COM13;LPT1;LPT2"


You can use this special backslash notation with every COM port entry, but it is optional to use it for COM ports 1-9.

Page C-10 also states that LPT1 will be port 10 (for Windows 98/95 only). This is conditionally true, because it depends on where LPT1 is placed in the serialDevices string. In the original serialDevices line:

serialDevices="COM1;COM2;COM3;COM4;COM5;COM6;COM7;COM8;COM9;\\.\COM10;
LPT1;LPT2;LPT3;LPT4"


LPT1 is port 10, even though it is the 11th element in the string. LabVIEW begins the string index with zero.

Modifying the serialDevices String
You do not have to use LPT1 on port 10. If you want to use COM1, COM2, and LPT1, you can do so. Use the following serialDevices line:

serialDevices="COM1;COM2;LPT1"

In this case, LPT1 is port 2, because it is the third element in the string.

LabVIEW Executables
If you are building an executable using the LabVIEW Application Builder and you want to use the parallel port, you must create an .ini file for that executable that resides in the same directory. The first line of the .ini file must contain the name of your executable (not including the extension) enclosed in brackets. You might receive error -37 if you do not do so.

For example, if your executable is named myprog.exe, create a file called myprog.ini whose first line is:

[myprog]

The contents of this file should be the same as the labview.ini file. The serialDevices line also should be the same, unless the target computer for the executable does not have the same port configuration as the development computer. If the port configuration is different, change your executable and the serialDevices line to reflect the port setup on the target computer. The executable should behave exactly like the original VI running in LabVIEW.

You also must include a copy of serpdrv, located in the LabVIEW directory, in the directory with the executable. Refer to the KnowledgeBase document linked below for more information.

Note: Your view settings in Windows Explorer might be set to hide certain types of files. To show all files, select View»Folder Options»View»Files and Folders»Hidden Files and select Show all files in Windows 98. Windows 95 is slightly different, but similar.

To write out the parallel port in LabVIEW 4.x, you might need version 4013 or higher of serpdrv.
  1. Run the windows serpdrv version number.vi in lv\vi.lib\instr\_sersup.llb to identify the current version of serpdrv.
  2. Version 4013 identifies itself as 4012 even though it's actually 4013. Make sure the last modified date is 5/30/97.


Related Links:
Developer Zone:Writing to a Parallel Port
Application Builder Troubleshooting Wizard
KnowledgeBase 0PFEJ3A1: Serial Port VIs Do Not Work Properly and Hang the System

Attachments:





Report Date: 02/29/1996
Last Updated: 01/06/2010
Document ID: 0ISAJ838

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit