Quantcast
Channel: Instrument Control (GPIB, Serial, VISA, IVI) topics
Viewing all 5665 articles
Browse latest View live

viReadSTB hanging with Keithley 2110 over USB connection

$
0
0

Hello everyone,

I'm developing an application that needs to communicate with the multimeter Keithley 2110.

I installed the latest Keithely IO Library (KIOL-850C07), which bundles the NIVISA run-time version 5.2.

Everything works as expected: I can connect to the device, retrieve its ID, read voltage measurements and so on. However, once in a while voltage reading method gets stuck in the call to viReadSTB for about 120s before returning a VI_ERROR_SYSTEM_ERROR. I tried to read the timeout value:

ViUInt32attrValue;
status = viGetAttribute(vi, VI_ATTR_TMO_VALUE, (void *)&attrValue);

which correctly returns the default value of 2000ms (much smaller than the actual wait time of 120000ms).

Trying to set a different timeout:

ViUInt32attrValue = 1000;
status = viSetAttribute(vi, VI_ATTR_TMO_VALUE, attrValue);

does not make any difference.

I tried so to update the nivisa runtime to the latest available version (17.0). I did not update the visa.h and visa32.lib since visa.h has only minimal changes, while .lib is byte-to-byte unchanged.

Interestingly, all the above is true on a win10 machine, but if I run the very same application with the same libraries, drivers and device on a win7 machine (tried 2 of them) the hanging time reduces to 10s. Also in the latter case this time is unaffected by timeout setting.

 

I wanted to know what is causing the hang and if I can do anything to reduce the waiting time or get rid of it if possible.

I'm building the application using gcc 5.3.0.

 

Here below is the code snippet I'm using to communicate with the multimeter.

 

DMM.h

#ifndef DMM_H
#define DMM_H

#include <QObject>
#include <QThread>

#include "visa.h"

#define MANUFACTURER_ID 0x05E6 //Keithley
#define DMM_MODEL 0x2110 //Keithley 2110 5 1/2 Digit Multimeter

class Dmm : public QObject {
    Q_OBJECT

public:
    Dmm();
    ~Dmm();

    bool openConnection(int SerialNumber);
    bool closeConnection();
    bool identify(QString &identificationString);
    bool measureVoltage(double &value);
    bool clearErrors();

private:
    ViSession   defaultRM, vi; //these are pointers
    char        buf [256]   = {0};
    ViStatus    error       = VI_SUCCESS;
    ViUInt16    status      = 0;

signals:
    void errorMessage(QString);

public slots:
    bool initialize();
};

#endif // DMM_H

DMM.cpp

#include <stdio.h>
#include "DMM.h"
#include <windows.h>

Dmm::Dmm() {

}

Dmm::~Dmm() {

}

bool Dmm::openConnection(int SerialNumber) {
    char AddressString[60];
    int ManufacturerID  = MANUFACTURER_ID;
    int DMMmodel        = DMM_MODEL;
    
    sprintf(AddressString, "USB0::0x%x::0x%x::%d::INSTR", ManufacturerID, DMMmodel, SerialNumber);
    
    /*! Open session to USB device*/
    if ((error = viOpenDefaultRM(&defaultRM)) != VI_SUCCESS) {
        emit errorMessage("DMM: viOpenDefaultRM(&defaultRM) failed");
        return false;
    }

    if ((error = viOpen(defaultRM, AddressString, VI_NULL, VI_NULL, &vi)) != VI_SUCCESS) {
        emit errorMessage("DMM: viOpen(defaultRM, " + QString::fromUtf8(AddressString) + ", VI_NULL,VI_NULL, &vi) failed");
        return false;
    }

    return true;
}

bool Dmm::closeConnection() {
    /*! Restore DMM manual mode *!
    if ((error = viPrintf(vi, ":SYSTem:LOCal\n")) != VI_SUCCESS) {
        emit errorMessage("DMM: viPrintf(vi, \":SYSTem:LOCal\\n\")) failed");
        return false;
    }
    
    /* Close session */
    if ((error = viClose(vi)) != VI_SUCCESS) {
        emit errorMessage("DMM: DMM viClose(vi) failed");
        return false;
    }

    if ((error = viClose(defaultRM)) != VI_SUCCESS) {
        emit errorMessage("DMM: DMM viClose(defaultRM) failed");
        return false;
    }
    
    return true;
}

bool Dmm::clearErrors() {
    /*! Clears tester errors */
    if ((error = viPrintf(vi, "*CLS\n")) != VI_SUCCESS) {
        emit errorMessage("DMM: viPrintf(vi, \"*CLS\\n\") failed");
        return false;
    }

    return true;
}

bool Dmm::initialize() {
    /*! Resets the device to power on configuration */
    if ((error = viPrintf(vi, "*RST\n")) != VI_SUCCESS) {
        emit errorMessage("DMM: viPrintf(vi, \"*RST\\n\") failed");
        return false;
    }
    
    /*! Modify timeout */
    ViUInt32 attrValue = 1000;
    status = viSetAttribute(vi, VI_ATTR_TMO_VALUE, attrValue);

    /*! Clear error queue */
    return this->clearErrors();
}

bool Dmm::identify(QString &identificationString) {
    /*! Send an *IDN? string to the device */
    if ((error = viPrintf(vi, "*IDN?\n")) != VI_SUCCESS) {
        emit errorMessage("DMM: viPrintf(vi, \"*IDN?\\n\") failed");
        return false;
    }
    do {
        if ((error = viReadSTB(vi, &status)) != VI_SUCCESS) {
            emit errorMessage("DMM: viReadSTB(vi, &status) failed");
            return false;
        }
    } while (status == 0); //waits for 0x10, Message available (?)
    /*! Read results */
    if ((error = viScanf(vi, "%t", &buf)) != VI_SUCCESS) {
        emit errorMessage("DMM: viScanf(vi, \"%t\", &buf) failed");
        return false;
    }    
    identificationString = QString::fromUtf8(buf);
    return true;
}

bool Dmm::measureVoltage(double &value) {
    if ((error = viPrintf(vi, ":MEASure:VoltAge:DC?\n")) != VI_SUCCESS) {
        emit errorMessage("DMM: viPrintf(vi, \":MEASure:VoltAge:DC?\\n\") failed");
        return false;
    }

    /*! Wait 100ms to avoid too frequent calls */
    QThread::msleep(100);

    do {
        if ((error = viReadSTB(vi, &status)) != VI_SUCCESS) {
            emit errorMessage("DMM: viReadSTB(vi, &status) failed");
            this->initialize();
            return false;
        }
    } while (status == 0); //waits for 0x10, Message available (?)
    /*! Check that the data available bit is set, otherwise reset device and return */
    if (!(status & 0x10)) {
        this->initialize();
        return false;
    }

    /*! Read results */
    if ((error = viScanf(vi, "%t", &buf)) != VI_SUCCESS) {
        emit errorMessage("DMM: viScanf(vi, \"%t\", &buf) failed");
        return false;
    }

    sscanf(buf, "%lf", &value); /*!< returns a measure in volts */

    return true;
}

 

 

Thank you in advance for any help.

Best regards


looking for a LCD Display Panel

$
0
0

I've searched the forums and found posts about how to talk to small LCD Display modules, but I'm looking for suggestions for hardware. I'd like a small panel, maybe 2 to 4 lines of characters, 40 to 80 wide. Serial interface would be fine, but Ethernet would be better. There are tons of them out there, but the problem is that they are all parts. I'm looking for a product, not a project. I may need 30 of these, so I don't really want to have to put them each in a box, add connectors and power suppy, etc. I just need a nice, packaged module that I can mount next to a machine and send some text to from LabVIEW. Any ideas?

Thanks,

      DaveT

Passing a VISA resource name from a vi to another vi

$
0
0

Hi everyone,  I'm using a global variable to pass the VISA resource name from a initialisation vi to an execution vi of an application, the problem is that the resource name hardly ever appears on the execution vi even when the condition to go from the initialisation vi to the execution one is that in the first one there is a resource name. Any idea about this?

I'd appreciate every comment.

Best regards.

USBTMC Gadget driver on Embedded Linux Board and Windows 7/10 Host viOpen Issue

$
0
0

Hi All,

I'm currently working on the device side function driver development for TMC gadgets.

Based on my experience and reference from USBTMC Specification as well as a couple of example code from Google, I have developed this driver.

 

Now I have one weird problem with my above USB TMC function driver, It works fine under Linux host but not in case of Windows host.

 

Case-1: Linux as host.

1) On embedded board load the g_tmc driver and it creates /dev/g_tmc0 device node.

2) Make a connection between Linux host and embedded Linux board.

3) On the Host side(Ubuntu 16.04), usbtmc class driver load automatically and /dev/usbtmc0 is also created well.

4) Command string also I can send from Linux host side like

echo *IDN? > /dev/usbtmc0

5) on the device side /dev/g_tmc0 device file also give me a perfect output.

    I have attached snap for the same as tmc_read.png

 

Case-2: Windows 7/10 as Host

1) On embedded board load the g_tmc driver and it create /dev/g_tmc0 device node.

2) Make a connection between Windows 7/10 host and embedded Linux board.

3) NI-VISA / IVI Shared component successfully detect my tmc gadget and I can see the device in my DEVICE MANAGER under Test & Measurement Class category.

4) Now If I run an example from Users/Public/Documents/National Instruments/NI-VISA/Examples/C/USB path of NI-VISA then viOpen and viFindRsrc function failed to open and find my device.

 

Questions:-

Why is behaviour not same under the two different host?

Why Windows 7/10 can detect my tmc gadget but NI-VISA  fail to make a connection?

What is the different between usbtmc class driver of vanilla Linux and NI VISA usbtmc driver?

 

USB RAW resource to NI-VISA

$
0
0

Hi everyone,

 

How to I communicate with a USB RAW resource device using NI-VISA? 

third party hardware interface with labview

$
0
0

Hi everyone. I want to interface 3rd party usb with labview. as far as the programming is concerned ,  have called .dll library in labview. Actually, i am using irishield-usb scanner and it is connected via usb to laptop . now i want to operate this scanner using labview so how can i do this?

Help with Variable Voltage control and output

$
0
0

Hey everyone so I'm working with labview on a simple circuit with an LED in series on a bread board connected to a DC power supply as well as a digital multimeter.

 

I have attached my labview file so far, and I think my setup should work, but I need to be able to change the voltage on the DC supply based on a user input as a starting point and essentially add in the stepsize until it reached the voltage maximum. The code in my file for the Agilent power supply is to set it to 6 volts currently. I need to be able to change that number and I don't see how to do that if it will only input into the machine that line of code. How do I put in a variable for the 6 in my line that I have so it can change?

 

Scale problem-Using labview to control a tektronix MDO3000 series oscilloscope

$
0
0

I have connected the oscilloscope to the computer,and  downloaded the oscilloscope's driver to control it.My problem is I want to show 100 cycles of signals on the screen,but when I run the VI,it automaticly show only two cycles on the screen.What should I do?


Similar command "ibsad" in VISA

$
0
0

I have a PCI-GPIB card and want to use VISA instead of IEEE488.2 to play with an old telescope.

In my case, the secondary address must be configured frequently.

Could not find  command in VISA similar to ibsad.

 

Only know in viOpen, I can apply the secondary address (see below value "101" )

viOpen(defaultRM,"GPIB0::18::101::INSTR",VI_NULL,VI_NULL,&vi);

 But if want to other address, I must close and reopen again.

I do not think this is a good idea.

 

Thanks for any tips!!

GPIB-USB-HS windows 7 driver ??

$
0
0

I have a GPIB-USB-HS cable that I am trying to use with my Windows 7 laptop and an Agilent 34970A.  Where can I find the NI driver for the GPIB-USB-HS cable?

GPIB only received FFFFF as a response in NI MAX

$
0
0

Hello everyone, 

I am new to LabView and GPIB. Currently I am trying to communicate with an old piezo controller (Physik Instrumente (PI) E-710) through NI-PCI GPIB. I can communicate with the controller if I used the original software from PI (Nanocapture 2.02 beta). But it is very old and inconvenient, so I want to make my own LabView program to control it.

 

To do so, I used NI I/O trace (formerly NI Spy) to see the configuration and the commands sent/received when I used the original software, and tried to replicate the setting and commands in NI MAX Interactive control. 

 

Problem:

The NI MAX always shows a random number of "FFFF..." as a response from the piezo controller, even in the identification of the instrument (picture attached). I thought this might be due to wrong configuration setting.

 

Troubleshooting 1 : use the IO Trace and change the configuration in NI MAX

 

IO Trace showed:

1 ibconfig(0, IbcAUTOPOLL(0x0007), 0 (0x0))

2 ibdev(0, 4, 0(0x0), T3s (12), 0, 0x0C0A)

3 ibonl(UD0,1)

4 ibclr(UD0)

5 ibeos(UD0,0x0C0A)

6 ibeot(UD0,0)

7 ibrsp(UD0, 64 (0x40))

8-... ibrsp(UD0, 0 (0x00))

 

I checked the meanings in the GPIB reference, and tried to follow the configuration in NI MAX:

GPIB Setting:    Primary address: 0 

Secondary address: none 

I/O timeout: 3 s

System Controller: checked

Enable Autopolling: unchecked

Termination Setting: only checked "Terminate Read at EOS" box. EOS Byte: 10.

 

However, I cannot set EOS byte as 0x0C0A or 3082 in decimal like what IO Trace showed (EOS can only 0-255). So I set 10 (Line Feed) as the EOS because the E-710 manual said the command is terminated by Line Feed (byte 10).

 

Failed. I still only can read "FFFFFF..." as the response from the device.

 

Troubleshooting 2 : use the NI MAX Interactive control to replicate the command seen in IO Trace.

 

I cannot replicate exactly like what I saw in IO Trace. What I can make:

1 ibconfig(GPIB0, IbcAUTOPOLL(0x0007), 0 (0x0))

2 ibdev(GPIB0, 4, 0(0x0), T3s (12), 0, 0x0C0A)

3 ibonl(UD0,1)

4 ibclr(UD0)

5 ibeos(UD0,0x0C0A)

6 ibeot(UD0,0)

7 ibrsp(UD0, 0 (0x00))

 

I cannot order the board 0 because interactive control in NI MAX always start with board GPIB0. And I never got the 0x40 as a response from ibrsp.

 

Still failed. Only got "FFFFFF..." when I tried to read (ibrd) or querry the identity of the device.

 

Questions:

Did I misunderstood something? If I cannot communicate with NI MAX, can I still communicate with the device using LabView program? With GPIB, VISA, or? Also sometimes Iberr has a value (1 and 3082 in my case) even though the Ibstat did not show any error (0x0100), why this happens?

 

I am using NI MAX and IO Trace ver 17.

 

Sorry for the long post. Thank you very much.

 

Kind regards,

Jane

 

NI-VISA 17.0 and NI-VISA 17.5 do not support USBTMC driver

$
0
0

As title.

If the OS never setup NI-VISA before than version 17.0, and direct to setup NI-VISA 17.0 or 17.5. It will not support USBTMC driver.

Virtual com port (usb) reconnect

$
0
0

I have a VI (LV-2017) recording the output of four identical instruments permanently that are all connected via their own USB port (virtual com port). Despite weeks of searching, one of the instruments will stop recording (seemingly randomly) and I cannot work out why, as far as I can see all of the settings are the same for all four. Either way, the only way to get it to work again is to completely exit labview, physically disconnect and reconnect the instrument and reload the VI.

 

Is there a way to get these instruments to reconnect while keeping the program running so I can turn one off > on (if I need to) and have it automatically re-detect? Or perhaps someone can shed some light on why such an instrument would randomly DC?

 

They are just connected via a standard visa resource dropdown in the VI.

 

Thanks in advance.

PCI GPIB and 64 bit Windows 7

$
0
0

Hi 

 

I have a Windows 7 OS which is 64 bit. The motherboard has a PCI slot.

 

I have have just purchased a used PCI-GPIB Controller Interface Card 777158-01 (183617G-01). I intend to control an instrument using Labview 2017 via GPIB.

 

Does anyone foresee any problems with this configuration ? For instance installing such a card on a 64 bit OS ?

 

Regards

 

Barry

Specfiying timeout value when creating new session

$
0
0

I am trying to create an IIviSession object using the GlobalResourceManager's Open method using the .NET IVI API.

 

One of the parameters to the method is a timeout value in milliseconds. My assumption is that the method would throw a timeout exception if it's not able to create a session within the specified timeout value. However, the method always takes around 15s before throwing an exception, regardless of the timeout value passed to the method.

 

I have been unable to find documentation for the class. Any ideas on how to specify a timeout when creating new sessions? Thanks.


Trouble communicate with rs232 serial to usb port

$
0
0

Hello, i start labview programming from last week and now, I need your help.

 

i'm trying to communicate with a Thermo/Humidity meter and it composed with rs232port and rs232 to usb converter.

 

as rs232port and rs232 to usb converter is connected by special unit, it is impossible to disconnect these two.

 

I attached a softwear that company gave to me and it works fine but it is made by C#.

 

I need to read data using labview for combine with other data but i have no idea that duplicate this C# program.

 

Even worth, this instrument does not respond to NIMAX serial read/write process.

 

I tried every command that NIMAX provide me but result is always same. "VISA : (Hex 0xBFFF0015) Timeout expired before operation completed."

 

The company that gave me the softwear for instrument just saying "Read data by serial communication of Labview"

 

So I use serial read & write example, but it doesn't work.

 

Labview can reconize that there is something at COM port but no data.

 

I tried Serial Port Monitor example also, but it indicate there is no communication between PC and instrument.

 

Please help me...

TCP/IP Connection Randomly Disappears During a Long Test.

$
0
0

I am testing an RF transmitter at different temperatures, over and over again for 48 hours. I have scripted the measurement sequence in LabVIEW 2016 (current with all the updates), and running off of a Windows 7 PC, and controlling a Signal Analyzer, NI DAQ 6233, Power Meter, Freq Counter, Power Supply, Thermal Plate and a Receiver/BERT. Some of the instruments communicate with GPIB, but most of them use TCP/IP for VISA reads and writes. 98% of the time, everything runs smoothly, but every once in a while, after 20 hours of run time, I get an error message that says 

 

−1073807343Insufficient location information or the device or resource is not present in the system.

After further investigation, it is always the receiver/BERT that has lost it's address and needs to have the power cycled and reset the static ip address manually. The Port number is still present, as it is configured as a raw data socket. NiMax will recognize it again only after resetting the instrument and ip address. I have attached the .vi that seems to be the problem, but I don't see anything wrong with it, perhaps another set of eyes will spot something. Thanks.

 

REN Line Question GPIB-USB-HS Adatper 488.2

$
0
0

I am trying to figure out when REN is asserted/unasserted. I have a pin of a co processor connected to this line and need to figure out exactly what this line does with each command.

 

Sometimes the REN line doesn't seem to get asserted when I call ibdev until after I send data with ibwrt but sometimes it is automatically asserted with ibdev. Not sure if it is a brief assertion or if it is continuously asserted (maybe I am missing something) after calling ibdev. Calling ibonl seems to have no affect on the REN line. I tried calling ibconfig(ibcSRE), attempting set the state to 1 as well as zero, received errors both times. How do I properly manage/monitor the REN line?

 

Basically I want to assert the REN line when a device handle is created with ibdev and unassert REN before closing out any applications.

 

It seems to be that the NI adapter buffers as much data as possible which is throwing me off.

Keithley 2601 Read Compliance State with Labview

$
0
0

Dear Community,

 

i have got a specific Problem:

How is it possible to read out via Software if the Keithley 2601 is in the compliance state, that limits the sourced Current? I did not find any entry in the manual about that. Is it an specific event or state that could be read out?

 

PCI Profibus board and Comsoft drivers

$
0
0

We have had an NI PCI Profibus board running under a LabVIEW 2013 compiled application for several years with no problems.

Upgrading to LVRTE2015 and NIDAQ17.1.1f0 so that we can support the project remotely, we now can't get the board to be recognised, either by NI-MAX or Windows device manager. Device manager reports an unknown PCI device with no drivers installed (code 28). The Profibus Visa Driver Version 1.37.5 made no difference.

Connecting to the NI update service, we installed PXI platform services patch 2018 Q! 17.5.1 and LVRTE 2015 SP1 f10 patch. Upon restarting the PC, an NI-VISA driver wizard started automatically, which we have never seen before, requiring information such as card manufacturer, model number etc. in order to create an INF file. I have no idea where to find this information.

Viewing all 5665 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>