Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Store commands as a table of strings

Hi 🙂 new user trying to grab hold of the NI-beast.  ...and already hit up the wrong board once  oops

 

I am trying to write a tool to capture readings from a FWB6010 Gaussmeter.  The meter has a bunch of commands.  I put together a few switches to send various commands to manipulate the settings on the meter eg :UNIT:FLUX:GAUSS or :SENSE:HOLD:STATE 1 for instance.  

 

I would normally create an array containing these commands and then grab the appropriate command as needed, either by a numeric index or perhaps even by searching for the command name.

 

The examples and videos I've seen do not make me confident about this approach.  Really don't want the commands scattered all over the code, though.

 

Any advice, examples, slaps in the right direction would be highly appreciated.  Oh, and if you've already written something to suck the readings off a device like this, I'd love to hear more about it.

 

Thanks,

Thys

0 Kudos
Message 1 of 10
(5,408 Views)

What I do is make a different VI for each command/read that I could send/read.  Then you just have to call the VI you want.  Take a look at the Agilent 34401 drivers that are shipped with LabVIEW for a good example of what I mean here.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 10
(5,406 Views)

@Dennis_Knutson wrote:
http://forums.ni.com/t5/Version-Conversion/Driver-FW-Bell-6010-gaussmeter-from-labview-4-02-to-12/td...

Wow.  Nice find.

 

If there is a library already made for you, I recommend just using it.  Apparently I converted some really old code a little over a year ago that should work for you.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 10
(5,378 Views)

CrossRulz, Dennis -- thank you for your responses, the links and the suggested examples.

 

I had found those FWB6010 files previously.  Now I can say thanks to CrossRulz for updating them.  I did not understand what they represented until now.  I was looking for a "front door" VI that could be presented to a user and did not want them confronted with raw commands.  The attached files show where my thinking was, rather than the approach of a separate VI for every command, as is the suggested/preferred approach with LabView.

 

So is the way forward is to create that front page UI and hook it to the various VIs in the library, or have I missed something else in that LLB?

Download All
0 Kudos
Message 5 of 10
(5,363 Views)

Thys wrote:

So is the way forward is to create that front page UI and hook it to the various VIs in the library, or have I missed something else in that LLB?


Yep, you make a VI that calls those other VIs.  Makes life a lot easier when you have abstractions like this.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 10
(5,361 Views)
I would recommend using an event structure. Each event would be linked to a front panel control with a value change event and in the event for the control, you would call a specific function in the driver.
0 Kudos
Message 7 of 10
(5,355 Views)

Ah!  An event structure sounds perfect.  That's what I was looking at with that mouse piece in my example.  The value change event makes good sense.  Thanks!

0 Kudos
Message 8 of 10
(5,331 Views)

@Thys wrote:

Ah!  An event structure sounds perfect.  That's what I was looking at with that mouse piece in my example.  The value change event makes good sense.  Thanks!


The term to use here is "Soft Front Panel" and really should be a requirement for any well constructed instrument driver.


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 10
(5,295 Views)

Jeff I have no doubt you are correct.  For the moment I want to get something working to prove the concept so people here will buy into LabView.  I will go back and apply what I learn to improve my model as time goes on.  Haaaaate leaving inelegant solutions lying around.  Getting out of the ground has proven to be tricky!

0 Kudos
Message 10 of 10
(5,291 Views)