From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Code runs well only for 1 time. NI-DAQ: command requires gpib controller to be controller

Solved!
Go to solution

Hi all,

Attached is my labview code. It controls a lakeshore powersupply, a keithley mulitmeter and sourcemeter and a GM08 gaussmeter.
The code works perfectly on the 1st run.
However, on the 2nd run, the Initalization for the sourcemeter (KE2400) returns an error.
The code runs fine again after stopping the VI and running it again.

I have no idea why this happens, any advice would help thanks! (as with any advice on making my code better in general)

My big loop is to average my readings.

0 Kudos
Message 1 of 9
(3,057 Views)

You say it returns and error on the 2nd run. What is the error? Which string of error cluster wires does the error occur in? Is it specific to one of the three devices you are using? You have a bunch of loops that operate in series. In which of these loops does the error occur?

 

Make sure you are fully initializing and closing out all of your devices with each run of the code.

None of your shift registers are initialized in your big loop, so this could also be the problem. Generally when your code runs ok the first time and not the second, then there is something not getting initialized properly with each run. This will mean your code might run fine in the run-time environment but will have bugs in development environment when the environment remembers previous run details.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 9
(3,048 Views)

The error returned is as ttiled : NI-DAQ: command requires gpib controller to be controller.
The error cluster with the error only happens with the sourcemeter (Ke2400) the rest are all fine.
The error occurs right after the Initilization of the Ke2400.

The error does not occure in the series of loops, it occurs at the Initialization fo Ke2400 which is outside of the big loop.

I've not tried initialzing the shift register, but I will try after reading up what it does.

I've run this code before, and it works with a different power supply. (not the one recieving error), so it's frustrating that this doesn't work.

Thanks for your advice!

0 Kudos
Message 3 of 9
(3,033 Views)
Solution
Accepted by topic author Funan

If the error occurs at the initialization then the issue isn't the shift registers. All of your inputs to the initialization don't have any local variables or anything weird, so it doesn't have anything to do with values changing with each run. This leaves us with the issue lying with the instrument itself, or the communication with the instrument.

 

When the first run of the application completes, are there any errors? Does that Close VI execute just fine to close out the connection?

 

I would suggest making a small test VI that just runs through the same VIs you are using with the Sourcemeter to see if you can dial in on the problem. If you test VI initializes and runs just fine over and over, then there might be an issue with your error handling or communication handling.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 4 of 9
(3,024 Views)

@steve89 wrote:

The error returned is as ttiled : NI-DAQ: command requires gpib controller to be controller.
The error cluster with the error only happens with the sourcemeter (Ke2400) the rest are all fine.
The error occurs right after the Initilization of the Ke2400.

The error does not occure in the series of loops, it occurs at the Initialization fo Ke2400 which is outside of the big loop.

I've not tried initialzing the shift register, but I will try after reading up what it does.

I've run this code before, and it works with a different power supply. (not the one recieving error), so it's frustrating that this doesn't work.

Thanks for your advice!


It is a bit odd to have a NI-DAQ error. What is the error number? The source meter seems to be configured for serial communication (I don't have the vis, but there is a serial configuration cluster), what address are you using? Why a GPIB controller error if using serial communication?

 

Ben64

0 Kudos
Message 5 of 9
(3,008 Views)

Thanks alot for the tips! I will check the instrument with a test VI. Strange thing is, this morning, it failed on the 3rd run. (still the full code)

The error is:

"Error 1 occurred at Scan From String (arg 1)... (bascially at Initialization from what I understand).

Possible reason(s):
LabVIEW: AN input paprameter is invalid..."

The full error is as attached.

I'm not so sure about the need of serial configuration. The driver I downloaded wants a serial configuration at the initialization, hence I supplied it with a serial constant of,  Baud Rate: 9600, Flow Control: None, Parity : None, Data Bits: 8, Stop Bits: 1.

Just to be clear, I am interfacing the instrument with GPIB not RS232.

0 Kudos
Message 6 of 9
(2,977 Views)

That means the data you are trying to scan doesn't match the format you are expecting.

 

Possibly either the message didn't come through, or it is incomplete.

 

Take a close look at the string that you are trying to scan the data from and see if it looks right.

0 Kudos
Message 7 of 9
(2,966 Views)
Not only is it not an NI-DAQ error, it's not a GPIB error. Please be precise in providing error messages. Notice the (s) after reason. That means plural in English so there are a couple causes for the error.
0 Kudos
Message 8 of 9
(2,958 Views)

Thanks to everyone that tried to help!
Sorry for the late response as the instruments were fully booked for a long time before I had a chance to use them.

Turns out all I had to do was to link the error out wire from my power supply  to the my Initialization of my sourcemeter (2400) for it to work.
I have no idea why, but I have a feeling that it has to do with mutiple visa session mismatch.

0 Kudos
Message 9 of 9
(2,896 Views)