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

The Commands to My GPIB Instruments Are Truncated When Sent Through LabWindows/CVI

Primary Software: LabWindows/CVI Development Systems>>Full Development System
Primary Software Version: 7.0
Primary Software Fixed Version: N/A
Secondary Software: N/A
Hardware: GPIB

Problem:
I downloaded the GPIB drivers for my instrument for LabWindows/CVI from ni.com. When I watch the GPIB bus using NI Spy, the commands sent from within Measurement & Automation Explorer (MAX) are correct, but the commands sent from within LabWindows/CVI are truncated.

For example, within MAX, I sent a centering frequency command to my hp8566b to center with 9.876543210E9 Hz. The device centers to this exact frequency. When I try the same command in LabWindows/CVI, the device goes to 9.876540000E9 Hz, and the command has been truncated.

How can I edit the driver to display a higher degree of precision?

Solution:
The drivers for GPIB in LabWindows/CVI are written in Standard C format. The problem you are experiencing is caused by the Fmt function of LabWindows/CVI. This function defaults to six digits of precision. To resolve this problem, alterations to the hp8566b_frequency_sweep function are necessary.

Open the hp8566b.c driver file in either LabWindows/CVI or a text editor and change lines 239 and 241 to match the following lines:

.
.
.
int PUBLIC hp8566b_frequency_sweep
.
.
.
238 if (!cont_md)
239 Fmt (cmd, "%s[a]<FA %f[p9e];FB %f[e];\n", cent_start, span_stop);
240 else
241 Fmt (cmd, "%s[a]<CF %f[p9e];SP %f[e];\n", cent_start, span_stop);
.
.
.

Notice that the Fmt command now has the specifier of p9. This expands the precision to 9 digits. If you need more digits, just change the values to suit your needs.

Related Links:
NI Instrument Driver Network

Attachments:





Report Date: 06/27/2002
Last Updated: 10/03/2008
Document ID: 2MQBPJMQ

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