LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Newbie needs help : scripting I/O Assistant possible ?

After some puzzling, I can read, write and query my GPIB ( HPIB ) instruments thru Labview's I/O Assistant.
I/O Assistant controls ( thru keyboard ) my instuments perfectly.

Unfortunately, for some of my GPIB instrument no drivers exist and so I cannot use the VI's in block diagram structures.

I guess I am supposed to write my own ones with VISA but C is still beyond my capabilities at the moment.
I am practizing, but it is a hard job for me to master C ( I bought Borland's C++ ).

So, is there, instead of keyboard entries in I/O Assistant, a way to script in an ASCII file ( and execute ) commands like :

" Open GPIB instrument #X, set the frequency of #X at .., open instrument #Y, set frequency of #
Y at ... , open instrument #Z, read the amplitude output of #Z " etcetera.

If needed I renounce ( for now ) the use of those beautiful VI's and I would be satisfied with text based results only.

If such a scripting exists, where and how should I search for tutorial help ?
I have over 2000 pages of printed documentation but I cannot resolve above mentioned question.

Thanks for any of your thoughts.

Peter van Daalen.
0 Kudos
Message 1 of 7
(3,109 Views)
Since you are just getting started with LabVIEW, I will assume that you have a fairly new version. LabVIEW 7.0 had an Express VI called the Instrument I/O Assistant. You mention the I/O Assistant in your post. You mention that you have used this to control your instrument. If you have and then press OK, it will script back into itself the VISA VIs that it takes to do in LabVIEW what you were doing interactively.

After that, you can open the front panel of the Express VI and it will convert it to a subVI with all of the VISA calls in it. You can look around in this and see what it is doing. You can learn from it. You can then modify it to read from the file or accept user entries and send these commands instead.

You could also just write them fr
om scratch using the VISA palette. I think that this is more difficult for a new user, but it is a better way to go in the long run.
0 Kudos
Message 2 of 7
(3,109 Views)
Peter - to answer your question, the I/O Assistant does not script pseudo-code to an ASCII file. However, hopefully I can still help you.

You say "I guess I am supposed to write my own ones with VISA but C is still beyond my capabilities" - I wanted to make sure you understand that you can use VISA in LabVIEW the same way you can in C, and in fact, there are many instrument drivers written in LabVIEW - is there a reason why you want a driver written in C?

What type of instrument are you working with? There may be a LabVIEW driver available that is similar enough to your instrument that you could modify it to work with your instrument. Or, since you have already been successful using Instrument I/O Assistant, you may be able to use the code generate
d by the Assistant to get the I/O functionality you need.

I hope I am understanding your question correctly. If not, can you please explain a little more about what you are trying to do?

-Tommy
0 Kudos
Message 3 of 7
(3,109 Views)

You do not need C to use VISA. You use only LabVIEW functions. You can also use the I/O Assistant function in several places in your diagram as sort of a stand-in for a regular driver - especially for setting an instrument to default values. Creating your own driver is not really that hard and certainly no harder than creating some sort of scripting program. The Instrument Driver Network has several links including tutorials and a new set of guidelines, that (I believe), make creating a driver easier than ever. Lot's of examples and templates are included. Unless you venture into the somewhat murky world of IVI, you'll not see one piece of C code. Good luck.

0 Kudos
Message 4 of 7
(3,109 Views)
Thanks to all of the three respondents ( apparently I can reply to one only.... ).

This is really great help.

Indeed, I run Labview 7.

Woow, after having run a sequence of various write/read/query commands in I/O Assistant, I can save this sequence and afterwards I can execute the sequence again by opening the myvi.vi.
This is exactly what I was looking for !

I am happy, with your help, I could make a modest start in this dazzling program.

I even started to ( try to ) wire in the block diagram in order to present the read/query resulting tokens in cute graphs.
Not very succesful as yet, but I will find out.

Meanwhile I encountered a problem : when I change ( " select instrument " ) in I/O Assistant and execute one or more commands in th
is second instrument#, this change of instrument# is not executed in the ( saved anew ) myvi.vi.
( BTW : both instruments perform perfectly when sequentially controlled in the I/O Assistant before saving).

While executing myvi.vi , whether the bus is not released by one of the two instrument# or the change of instrument# is not part of the saved myvi.vi code.

I happened to buy today a HP Bus System Analyzer but I had no time today to learn to read and analyze the bus systems and data messages so soon.

Nor can I read the myvi.vi code in alfa numeric tokens ( in order to read whether both instrument# are in the code ).
I tried to read the code under Tools etc. but apparently I have to configure something before.
OK, I try to find out.

Meanwhile, maybe one of you is able and so kind to give me a headstart/hint in the said problem ( " how to use more than one instrument# in I/O Assistant so that all instruments are controlled by executing the saved myvi.vi of these I/O As
sistant sequences.

Thanks,
Peter.
0 Kudos
Message 5 of 7
(3,109 Views)
Great! I'm glad we've been of some assistance. Are you trying to communicate with multiple instruments inside of the same Instrument I/O Assistant Express VI? What I mean is, do you have multiple Select Instrument steps in the same Express VI? That is not really how the Assistant is intended to be used. I would drop another instance of the Assistant to deal with your other instrument.

You can tell which instrument is being addressed in the code of the Express VI if you right click on the blue Instrument I/O Assistant VI and select "Open Front Panel". Then you can view what resource strings are being passed into the various VISA functions.

If this doesn't help you fix the problem, attach the VI so we can take a look at it and get a
better idea of what you are doing in the VI.

-Tommy
0 Kudos
Message 6 of 7
(3,109 Views)
Yes, I had multiple Select Instrument steps in one and the same I/O Assistant instance.
Obviously, this didn't work.

Instead, as you prompted me, I opened multiple I/O Assistant instances, each one for another of three of my HPIB instruments.

The only way to interconnect them was thru " error out " into " error in ".
But, most surprisingly, at least for me, it works !
All three of the instruments on the bus are controlled by this one and only .vi.
This is great.
I am gonna try to put all of my seven GPIB instruments on the bus and have them controlled by one and the same .vi.
This would be fun.

BTW, maybe off topic, maybe not, how many instruments can be daisy chained with 1 mtr cables ?
I also have 3 x 2 mtr cables, not enou
gh to star config all of the instruments.
What is the IEEE488(2) rule for cabling ?

The vi cannot be stoppped as yet but I guess I saw an example somewhere how to to insert a stop and restart function into the block diagram.

Next step will be to ( try to ) present the read and queried tokens {results from executing my first .vi :-)} onto the computer screen.

Of course, I will try myself first.
I have many examples in the documentation.
However, if I get stuck I am afraid I have to revert here... OK ?

BTW, most stupid question, I realize, but if this G-language works so cute, why would one get involved in Labview's frightful C business ?
I started to master Borland C++ but it is no piece of cake at all for me.

Thanks,
Peter.
0 Kudos
Message 7 of 7
(3,109 Views)