NI Home > Community > NI Discussion Forums
Reply
Member
ap8888
Posts: 150
0 Kudos

Agilent OSA Data Acquisition - Where to begin?

[ Edited ]
I'm new to LabView and have been learning it for the past little while. I am attempting to communicate with an Agilent 86142A OSA with a GPIB-USB-HS cable. I think I've downloaded all of the necessary drivers (e.g. 488.2).

I've also acquired a Plug-and-Play driver from Agilent to be used by 8614x devices. These Instrument Drivers came with three examples. I connected to the device via MAX (that is, it sees the device).

A few questions:

1) Running these examples, for whatever reason, does not work. I continously receive a "Could not perform operation because of I/O error.; " error. I noticed that in the VI, the address is set to 23. Now my instrument PAD is 22, so I wanted to change this address in the VI. I tried doing so by clicking on the AG8614X node in the VI, but after running the program the address changes back to 23. Due to this, I decided to try changing the GPIB address of my machine; I changed it to 23 to be compatible with what the VI wants. Now running the program simply stops it immediately. I've attached this file to this post.

2) I've tried using Instrument I/O Assistant also. My question regarding the Assistant is this: can I only input single commands into the command windows or can I copy/paste large code/programs written in my hardware manual? Also, is all of the code that the I/O Assistant simply the code documented in the programming guides of my hardware (e.g. "SENDMESSAGE INIT;*OPC?") ? Excuse the naive question, but I simply want to know if I'm on the right page here.

3) Lastly, I seem to be at a loss when I look at the dozens of VIs that came with my instrument drivers. When creating a communication program, is there a general format for the structure of the program? For example, I know that one should first use the Initialize function and lastly use the Close function -- but are there any other requirements in between?

4) Lastly, and perhaps most importantly, is this: If these instrument drivers manage to work and I figure out how to use them, will I have to use any of the hardware programming language in my program at all? Are the instrument drivers capable of making it unnecessary to manually write code?

Thank you,
Alex


Message Edited by ap8888 on 06-25-2008 01:09 PM
Member
Troy
Posts: 98

Re: Agilent OSA Data Acquisition - Where to begin?

Alex,
First can you provide a link to the VIs that you downloaded for the instrument driver?  I am unable to locate them at either Agilent's or NI's website that are for LabView. 
 
Second, you should spend some time reviewing LabView's state machine design practices.  Using these techniques will clean up your code considerably, as the use of sequence structrues as you have them is not the best method for accomplishing what you want.  It may in the end be the primary reason things are not executing correctly.  The way you have the sequences stacked is very state machine like it how it should behave, but proper technique will make the code much more readable and easier to debug.
 
Also, keep in mind that LabView is a data flow dependant environment.  You have a few property nodes that have no flow control between them.  Specifically on the outside of the sequence structrue you have two that enable a couple of controls but then in the zero frame you disable them.  Without flow control such as using the error lines from the property nodes and tying them to the edge of the sequence structure, there is no guarantee of their execution sequence.
 
This holds true for your use of the local variable on the Results indicator.  LabView will attempt to execute the code outside the sequence and the code inside the sequence in parallel the way you have it setup now. 
 
That said, we can possibly work with what you have while you learn.  To do that we really need either a link to the VIs of your instrument driver or your VIs themselves.  If you can do that I'd be more than happy to help with the code debug.
 
Troy
Troy
Member
ap8888
Posts: 150
0 Kudos

Re: Agilent OSA Data Acquisition - Where to begin?

Hello Troy.  Thanks for your input.

In fact I was not the creator of the "example VI" that I attached. It was one of the three examples that were sent to me by Agilent.  I downloaded the following two files:

1) Link 1 (I believe this was the one): VXIplug&play Driver Version A.02.00 for 8614x Optical Spectrum Analyzers

2) Link 2: ag8614x_LV.zip

Let me know what you can find out from these files. It's really difficult for me to understand even the example VIs. I was just sent a revised set of examples by Agilent that apparently have some bug fixed, but I'll have to try to run those tomorrow.

I've attached the modified example files (ZIP file). Please tell me how they can be improved and hence where they are lacking. This will help me learn from the mistakes and create my own programs with the provided instrument driver functions.

Thanks,
Alex
Member
ap8888
Posts: 150
0 Kudos

Re: Agilent OSA Data Acquisition - Where to begin?

I think that to make my question clear, I'll make this post.

1) I've attached two examples that contain the following errors. I've also compiled a document (attached) that outlines the errors/messages that were displayed in the VIs.

Example 2: The program runs but a few of the commands receive a timeout error.
Example 3:  Very similar to the problems in Example 2.

Also, on several occasions I see a “Undefined Header –113” error on the OSA’s screen when tasks are being executed in the VI. The VI, however, just says “No Errors”.

Lastly, please tell me how the structure of these example VIs is lacking and can be improved.

Member
Troy
Posts: 98

Re: Agilent OSA Data Acquisition - Where to begin?

Likely the timeout errors are when you are seeing the -113 Undefined Header error on the analyzer.  Usually this indicates a syntax error for the SCPI commands.  Have you tried this with the package of instrument drivers you linked here?  Reason I ask is a bunch of the VIs in the examples had different names in the instrument driver package than what the example wanted, making me thing they corrected some syntax errors.  I was able to relink them and will work on this throughout the day showing you a better way .  Hopefully that will give you a better idea of both how to use the instrument drivers and the LabView dataflow and statemachine techinques. 

Do you have some specific needs or are you just learning at this point?  If you have specifics, we can work through those as well.

Troy
Member
ap8888
Posts: 150
0 Kudos

Re: Agilent OSA Data Acquisition - Where to begin?

Thanks again Troy.

I'm not sure what you mean about using it with the package of instrument drivers that I listed; the errors I documented in my last post are the errors with the most recent versions of the example VIs.

At this point I am mearly learning how to construct a program using instrument drivers that suit my needs. Once I understand the proper structure of such a program, I need to construct a program that receives the trace from the OSA and marker positions, and calculates the peaks of the waveform. I think there's a "Marker Position" function within these instrument drivers that may be able to do this.

Thank you Troy; I'll be awaiting the reformed examples that you mentioned you'll produce.


Member
ap8888
Posts: 150
0 Kudos

Re: Agilent OSA Data Acquisition - Where to begin?

Also another note:

In terms of a State Diagram, what "states" are usually required for a data acquisition process? I understand that one must first Initialize and end with a Close function, but is there an ordered set of states in the middle that should be in my State Diagram?
Member
Troy
Posts: 98

Re: Agilent OSA Data Acquisition - Where to begin?

Alot of the content of the states will be dependent on the measurement you are trying to make and how much setup needs to be done to the OSA to get there.  I think once you see what I am working on to clean up the examples, you will understand what I mean.  You are sort of correct that you should start with an init and end with a close, but in reality this is more for handling the VISA bus references in the PC than for the instruments sake.

A lot of times if I am doing something simple such as a trace capture from a spectrum analyzer, I usually leave the instrument setup to the operator.  When they are ready to take a trace, I open the VISA reference to the insturment, query the values I need, then close the VISA reference.  I also try to return the analyzer to local control which depends a lot on the age of the equipment.  Some of the HP gear I work with is knocking on 25 years old and doesn't have some of the same features in GPIB as the newer equipment.

Troy
Member
Troy
Posts: 98

Re: Agilent OSA Data Acquisition - Where to begin?

Alex,

Attached is a refined version of the example 2 that uses what I feel are appropriate LabView techniques.  I also did some documenting in the code for you to try to give you an idea of what I am doing, and what Agilent did in their code.  If you are familiar with text languages the technique should look familiar using DoWhile and a big If/Then/Else statement. 

You may have to relink to VIs if this comes up broken.  If so, I might suggest that you first take the ag8614x_LV.zip file that placed here earlier and unzip it into c:\program files\national instruments\labview 8.5\instr.lib\ folder.  You may then only have to re-direct LabView to the VXIpnp driver install location.  BTW, I am developing in LabView 8.5.  I believe I read that you are using 8.5 or later so you should be OK.  Let me know if you have any problems.  If you do, likely we have problems with the SCPI syntax, as I didn't take the time to download the manual and verify it, I just copied it from Agilent's VIs.  The code is untested, so hopefully I didn't forget anything or miss something. 

I kind of have to laugh at Agilent's VI and "driver" set.  What they did, could have been done without their instrument driver for the most part (at least the examples).  In LabView we have the ability to read and write to and from the VISA driver using the VISA natives.  They do exactly the same thing that Agilent did with their VXIpnp driver, since Agilent still requires you to code or enter the SCPI language with their "Send String" VI.  I am going to continue tinkering with this and show you how I would have done this with the absence of a NI provided LabView driver.  It's not difficult, especially if you have access to the programming manual for the instrument to get the SCPI syntax for your requirements.  

Troy
Member
ap8888
Posts: 150
0 Kudos

Re: Agilent OSA Data Acquisition - Where to begin?

Troy,

1) I've opened your modified example. I've copied below this text the Results. I'm not sure what the problem is, but perhaps you know yourself. Nonetheless, I will begin studying this modified state-machine example to understand the proper structure of an instrument driver program. If you figure out the problem, please let me know as it will facilitate my learning.

2) You mentioned that you'll be able to create another example which uses VISA commands and without instrument drivers. Are you suggesting that using VISA commands (which I assume uses the hardware specific programming code) is better in this case because the instrument drivers are not good? Why aren't they good and how does VISA benefit me (if anything, I feel that using hardware specific code is more difficult!)?

I also don't think I've mentioned that Agilent sent me a VISA example (which I've attached to this post). Let me know what you think of it.

I would be grateful to see your VISA example. If you think that's the way to go, I'll take your advice seriously.

(Note: I've also attached the programming manual)

---
AG 8614XB Example #2 for LabView

--- Attempting to Initialize instrument . . . ---
No Errors

--- Setting the Automatic Instrument Error detection . . . ---
No Errors

--- Seting the print format used by the instrument,  using function cmd
No Errors

--- Ask the actual print format.         
Print Format:
Timeout expired before operation completed.

--- Query the available sources used by the instrument    and display it.
Available Sources:
Timeout expired before operation completed.

--- Asking the instrument for the evailable applications . . . ---
Available Applications:
Timeout expired before operation completed.

--- Returning the number of channels detected.. . . ---
Available Applications Numbers:
Timeout expired before operation completed.

--- Closing Instrument Session . . . ---