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.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Sending just a single command through GPIB

Solved!
Go to solution

Hi,

I've got an laser diode controller instrument here and have connected it to an NI GPIB USB adapter, set it up and got it talking.

If I send a command via "Communicate with Instrument", it works, and NI SPY shows one write to the device.

If I start a new VI, drop in an Insturment I/O Assistant, set up accordingly and add in a Write step with a simple command (with a boolean varaible); it works and when clicking test, it sends a single write according to NI SPY.

However if I tie that into a true/false button in the workspace, and run the VI the insrument is constantly receiving 80-100 writes per second of the same command over and over in the "OFF state". If I change the switch, it send's 100's of commands per second to the "On state".

Is this behaviour normal? I only want LabView to send the command once when the switch is pressed, not constantly write the state of the switch to the instrument.

Another example is if I tie in a button to change mode on the instrument; LabView constantly issues the change mode command, so the screen on the device tries to redraw itself over and over, more or less grinding the device to a halt.

I've tried changing button mechanical operations, but that has no effect.

 

Anyone any ideas and can tell me what I'm doing wrong?

 

Cheers,

Dan

0 Kudos
Message 1 of 8
(5,044 Views)

You are certainly using the wrong mechanical action. If you had tried 'Latch When Released', you would be fine as long as you have else in the code. Which, by the way you did not attach so someone does has to guess. I also hope you are not doing something silly like using the run continuous button.

 

You should really be using an event structure with a value change event for the Boolean and your write inside that event.

 

p.s. LabVIEW does not have a 'workspace'. It has a front panel and a block diagram.

Message 2 of 8
(5,035 Views)

Thanks,

I'll try that.

 

Apologies for using improper nomenclature...

0 Kudos
Message 3 of 8
(5,022 Views)

Hi Dennis

 

Although you are right that LabVIEW has no workspace like the other program that does a lot of Math...work.

We use the term workspace also in LabVIEw and we even have a workspace loader running written in LabVIEW.

 

have a good weekend.

greetings from the Netherlands
0 Kudos
Message 4 of 8
(5,011 Views)

I started again, and re-did a few commands as event structures, which worked!

It now only issues the GPIB command once. Thanks Smiley Very Happy

 

However after making 3 event structures for 3 different commands and running the VI the buttons on the front panel seem to only work once.

e.g. in my example, changing the backlight works when toggled once, and NI SPY detects the correct command has been sent.

Toggling again, the button on the front panel changes, but a command is not sent to the instrument, and the backlight remains in the previous state.

Toggling for a 3rd time, the button no longer switches on the front panel, seeming to be 'locked'.

 

VI attached...

 

I've started with simple commands like the backlight setting to get the hang of the basics. Then I'll progress to sorting the commands for the actual data I want to exchange with the instrument. I've never used LabView before, and I've never used GPIB; so it's one big learning curve!

 

Can anyone steer me in the correct direction as per the issues above?

 

 

Many thanks in advance,

Dan

0 Kudos
Message 5 of 8
(4,988 Views)
Solution
Accepted by topic author danielbriggs

Dan-

You really need to start by looking at the examples and tutorials that ship with LabVIEW.  Unlike text based languages LabVIEW is a dataflow language.  This means that some of your programming concerns need to be what is running and when.

 

one event structure is the prefered style.  You can add event cases to handle events from different controls or take different actions.  The way you've contructed your vi it operates like this.

 

The while loop starts- and three different event cases start waiting to process events. 

one event fires (let's say GPIB echo value change) and the code in the event case runs once.

the loop is still waiting on the other two event cases to execute before iterating so the GPIB value changes are essentially BLOCKED( the event can't be acted on again until the while loop iterates-  although the events still queue up ready for the event structure to run again.

 

so ONLY in the case where all three event structures handle one event each will the while loop iterate.


"Should be" isn't "Is" -Jay
Message 6 of 8
(4,984 Views)

Thanks Jeff.

As usual; user error. Smiley Happy

 

LabView is like nothing else I have used before... and I've done a fair bit of programming.

I was hoping this would be a quick 'drag and drop' exercise to get the kit talking and then design the front panel.

 

I'll study LabView further...

 

Thanks to all.

 

Dan

 

0 Kudos
Message 7 of 8
(4,972 Views)

Hi, do you have the manual for 06DLD105? or at least the pinout on the connectors?

Are LabView drivers available?

0 Kudos
Message 8 of 8
(4,342 Views)