LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

GPIB inconsistent behavior

Hi,
I am trying to automate the power spectrum measurements with HP3562a(frequency analyzer) and LabView. My problem is that I get inconsistent response from the HP3562a every time from the same command  which basically sets up the analyzer.Not all commands are getting executed by the analyzer for some reason. I have tried both GPIB Write and Visa write  but  the problem persists. For getting data from the analyzer I am using the NI provided driver. The data  reading returns from the driver appear to be wrong. I compared the labview measurement with manual measurements and they don't match.   Did anyone experience a similar problem?  Please help me  to understand if I am doing something wrong. I've spen 3 days on this problem with virtually no progress.  I have attahced my code.  Thansk.
Download All
0 Kudos
Message 1 of 27
(5,073 Views)
I am the original poster under the different username.  Could someone help me out with my problem? I am just a beginner in LV.  I was able to work out the GUI. I just have a trouble with data reading. Thanks.

0 Kudos
Message 2 of 27
(5,040 Views)
You should use the VISA Write & Read as you started using in Frame 2 of 4 inside Frame 2 of the stacked structure.
 
Try to stay away from the GPIB Read & Write.  You can open a session at the beginning and use the same reference until you no longer need to communicate.  No need to open and cloise each time.  And do not mix the VISA & GPIB write.. 
 
Comment on the code...  Avoid Stacked Sequence Structure.   Also avoid initializing as if you were programming a text based language. Use the error cluster for dataflow.  Remember, Labview executes code based on dataflow.. Try not to force a sequence by using the stacked structures, to allow scalability and maintainability of your code.
 
RayR
Download All
0 Kudos
Message 3 of 27
(5,032 Views)

To learn more about LV in general, I suggest you read the LabVIEW user manual. Also, try searching this site and google for LabVIEW tutorials. Here is one you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide 

Since it sounds like you are new to LabVIEW, I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours



Message Edited by JoeLabView on 06-01-2008 09:44 PM
0 Kudos
Message 4 of 27
(5,030 Views)
Joe thanks for the your advice. I will definetly rework my code after I do finish my data reading. As if right now I need to figure out data reading part.

    Basically, my internal 0 to 2 frames setup the analyzer properly. On my 3rd frame I added a 1000ms delay. On my 4th frame I used the NI driver to read the plot. The problem is that driver does not acquire the right  plot. But what is interesting is that if I run the subVI HP3562a separatelly then the plot is being read properly. I tried to increase the delay between writing to analyzer and callin the subVI but that does not help. I can't figure out why the standalone subvi hp3562a works properly but when I call the subVi inside my program it does not work properly. Can anyone explain?
Thanks.



0 Kudos
Message 5 of 27
(4,990 Views)
Always wire from left to right.  Never right to left. COntrols to the left, indicators to the right.
Connector pane should have error in at bottom left and error out at bottom right.
 
Don't use a double as your GPIB port number.  Use an integer value, or use the actual control type from your sub-vi which is a sting.
I couldn't run the vi because it is missing readheader.vi and I do not have the SA. 

Can you check if the way you configure the test is identical when doing it manually, to the way done in Spektr.vi?
Is the GPIB Port the right one?  Are you communicating to 2 other instruments? because of the mixed use of VISA & GPIB commands.
 
I simply changed the vi to use a string control for you GPIB Port.  Not sure if that had any impact.. 
You may want to try to isolate the rest of the code and only run the spectrum analyser from within.
RayR
 
0 Kudos
Message 6 of 27
(4,978 Views)
Joe,
I am connecting only with only one device which is the  HP3562a  signal analyzer. I used the VISA for setting up the HW since the GPIB write did not work properly(it would skip some commands). I checked the the ports number and commands and they are correct.  The configuration setup is correct as well since I see the display of the analyzer and this is how i know that my Write comand worked properly.  One weird thing  I noticed during debug is  when I do step by step execution the subVI  HP3562a works properly and returns correct data(?!?).  This fact totally  got me confused.
    I was not able to open your code since I am using LV 8.0 .
    I have attached the readheader VI.


0 Kudos
Message 7 of 27
(4,975 Views)

Your concatenated string looks like this:

And attached is the VI in LV8.0.

The only additional change I did was to remove VISA close... I'm not sure if it needs the reference in the sub-vi.

If everything up to the HP subvi is ok, and the sub-vi works well as a standalone, then the only thing in between is the closing of the port.  Although it seems that I missed something.. 😞

Hope this helps.

RayR



Message Edited by JoeLabView on 06-02-2008 07:58 PM
Download All
0 Kudos
Message 8 of 27
(4,958 Views)
Joe,
I think I finally got it. My mistake was that after sending the long command string  which sets up the analyzer I was reding the register immidiately. By that time the new settings did not take place and the measurements have not occured.This analyzer is very old (older then me :-)) and is very slow.All I did was to  add the 2.5 seconds delay between setup and data reading and that it! This thing started to work perfectly.  Thanks a lot for your help Joe.
0 Kudos
Message 9 of 27
(4,953 Views)
Oh yeah, forgot timing.  In my vi's that talk to the DSA, the user sets up the test, runs the test, then downloads the data, so the timing is handled by waiting for the user to see that the DSA completed the previous task.  The other issue is that happened is when the GPIB - to - USB converter is plugged directly into the device.  Some GPIB devices need a longer GPIB cable for proper termination.  This fixed a bug with an older HP Power Supply.
0 Kudos
Message 10 of 27
(4,934 Views)