LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing both Channels Ag 53220A

Solved!
Go to solution

Hello everyone,

 

I am quite new to LabVIEW and facing my first most probably small issue concerning the alternating measurement of frequencies on two (or more) channels of an Agilent 53220A frequency counter.

I am able to measure one channel and display this measurements inside two graphs. However, I can't figure out how to measure both channels.

I know that one can't measure them simultanously, but I'm fine with alternating measurements (like every second one channel).

 

How can I achieve this?
I will attach my block diagramm to this post.

 

Thanks for your help!

0 Kudos
Message 1 of 8
(3,543 Views)

I would really appreciate a short example measuring the frequency of different channels of the equipment.

I'm too new to labview to understand this whole VISA-programming stuff and the examples provided by Keysight are no big help either.

 

I tried some more and attached another block diagramm to this post, but I still got the problem, that the waveform charts display the results of both measurement circles.

 

Could someone explain the programming logic of labview to me?
Does it read from left to right? Why does it compile parts at the same time that are supposed to be following each other?

0 Kudos
Message 2 of 8
(3,485 Views)

Ok, a few suggestions if you want to get this working.

 

1) Invest some time in the LabVIEW basics courses.  You'll learn a lot, not necessarily about how VISA or instrument programming works.  You'll learn that LabVIEW is a dataflow language, not left to right unless the dataflow specifies that, and how to structure your programs to take advantage of dataflow.

 

 

 

2) You're much more likely to get help if you post the VI (i.e. attach the actual file you are working on) rather than an image of the code.  Don't mistake VI snippets (PNGs that you can drag into labview that become code), for simple PNG images that are not very useful.  See - http://www.ni.com/tutorial/9330/en/

 

3) To get good help, do a good job describing exactly what you want your code to achieve, what you've tried and what the results were.   Here it seems like you want to monitor frequency on both channels at the same time and plot them on a chart against time.  Is your frequency changing with time?  What's the rate of that change or what sort of data do you expect to measure?  

 

4) Have you read the instrument manual?  When programming an instrument know what commands and what types of information is possible for the instrument to return is more important than the language you write your program in.  Does the manual explain that concurrent measurements of frequency on 2 channels is possible?  I glanced at the manual and I don't think so.  I know most frequency counters can display 2 channels at the same time, but I don't think they necessarily have the capability to update those values to a PC in real time.  When collecting data on the PC I think you have to configure 1 channel at a time, read the frequency on that channel and then configure/read the next channel.  They provide a frequency histogram measurement, ability to acquire multiple measurements of the frequency at set intervals, and other more advanced measurement statistics.

 

Here's an example (snippet and attached VI) that configures and reads data from 2 channels sequentially, then plots the data on the sample plot of "freq vs. sample count".

Agilent_532XX_2ch_frequency.png

 

 

 

0 Kudos
Message 3 of 8
(3,479 Views)

Hello cstorey,

 

thank you for your suggestions, I will have a look at them.

And now to further explanations of my problem:

 

We were using this frequency counter for a long time in our lab and recently we had to upgrade one of our PCs from win XP to win10, and therefore the old LabVIEW .exe didn't work anymore. I am now responsible for updating this old routine to LabVIEW 2017 on 64 bit (and already faced many different issues concerning the communication with the device). Sadly, the guy who scripted the old LabVIEW routine did not save a VI-file, but only the executable. As it was written in LabVIEW 8.5, the VI itself can not be extracted from the .exe file anymore.

 

So what did the old routine do?
It measured the frequency of both channels sequentially and plotted them in two separate waveform charts against the time. Measurements were taken every second from the moment you pressed a start-button until you hit the stop-button (so that was most probably just a loop with start/stop button?). They were stored at the same time, as you had to specify a saving location (via save dialog) before starting the measurement. The data should be saved as ASCII file (.txt is good enough), containting the time (1sec, 2sec etc) in one column, and the two frequencies in the second and third column.

The frequency itself changes over time, eventually, but the resolution of 1 second is sufficient.

 

I also attached the VIs this time.

"promising" is a VI which is capable of measuring the frequency of two channels, with following problems:

As I placed two loops without connection, there is -of course- a problem with the initiation. But the really interesting part for me in this VI is, that the second chart first displays the data from the first chart until one stops the first loop. Then the first chart stops showing data and the second one switches to the other channel.

The second VI "not so much difference so first test" Should, as far as I can tell, measure the frequency of the first channel, show it in the first chart, then measure the frequency of the second channel and show that, but it doesn't. It plots the same data in both charts, which is a little bit frustrating.

Correct me if I'm wrong: LabVIEW should, more or less, compile according to the wires, right?

 

Concerning your VI (thank you for that one!):
It actually does not measure on the chosen channels, as far as I can tell. If I run the VI inputting two different channels, I only get a red curve sweeping between the value of one channel and 0, and only a blue line.

I can even proof, that the VI is not measuring two different channels, because I have no hardware on the third channel, which normally produced an error "beep" on the device, as soon as I try to collect data from that channel. But choosing channel 3 as Channel B in your VI does not lead to the error, but choosing it as Channel A does.

 

I hope I described my "needs" in a better way now and hope for your kind help!

Download All
0 Kudos
Message 4 of 8
(3,471 Views)

Thanks, now I understand what you need to accomplish it makes guiding you a lot easier.  As I see it, given your rookie LabVIEW status, your best options to get this working soon are..

 

1) Try running the existing EXE in a WinXP friendly mode.  You should be able to run almost all winxp EXEs on Win10.  Here are tips..https://www.howtogeek.com/228689/how-to-make-old-programs-work-on-windows-10/

 

2) The WinXP on Win10 route doesn't work then there's always virtual machines.  Setup a WinXP virtual machine and run the EXE from there.  

 

3) Rough up the guy who wrote the code until he coughs up the source - he must have backups!  Who works without backups?!  Alternately buy him lunch and get him to write down all that he remebers about how the instruments were setup and how the code was structured.  This will save you a lot of time too.

 

Seriously, those are the easiest options for you.  I don't have the instrument to play with so I'm blind...I also haven't read the manual and don't plan to ;). 

 

If you can get the code running by any of the ways above, then you can take some time to learn LabVIEW.  With the EXE running you can actually use the NI-IO Trace to look at the commands the EXE is sending the instrument, then rather than guessing at how the last guy did things you have commands being send to the instrument.  With a bit of time you can write the program yourself using those commands and the new program should be the same as the old.

 

Now to answer some of your questions and comments Re "promising.vi"

 

- Its a VI with a lot of issues. I'm not even sure where to begin..

 

>> Correct me if I'm wrong: LabVIEW should, more or less, compile according to the wires, right?

- You need to learn about dataflow!  Please watch/read:  http://www.ni.com/getting-started/labview-basics/dataflow

 

 - Second you are trying to communicate with the same instrument in two loops running in parallel, the instrument just can't do that.  Its probably receiving commands from both loops and replying with whatever data is in the buffer. 

 

- Also you are intializing and closing communication every loop, you would do that before and after the loop but not inside.  It's like calling your friend on the phone, saying "Hello", listening to them say "Hi", hanging up, calling back, saying "How's it going?", listeing to them say "Ok", hanging up, calling back, saying...

 

Call once, talk as much as you like, then hang up!  A single channel reading continuosly should look something like this..promising_cds.png

 

Note that I've added error checking every loop.  An error or a press of the stop button will stop the loop.

 

Now I suggest you modify the last VI I attached to include an error check before and after each channel reading.  I'm not sure why the data for both channels would be the same (unless it was the same?) but maybe the instrument is throwing an error that is not caught and the second channel read is just the same data as the first due to the error. 

 

Maybe a delay is needed, maybe there's an easy way to configure both channels at once - that's where reading the instrument manual will help.

 

 

Keep me posted.

Craig

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

Ahem, I made a mistake using waveform chart in my first VI.  Try this with XY Graph instead.

 Agilent_532XX_2ch_frequency_cds2.png

 

 

Should show you 2 plots if the data is collected without error.

Craig

0 Kudos
Message 6 of 8
(3,459 Views)
Solution
Accepted by topic author MathLabLer

Hello again Craig,

 

thanks a lot for your suggestions and help.

I asked the NI telephone Support to extract the original VI from the executable file, which was -of course- not possible, but the very nice guy on the phone "took me by the hand" and helped me create this very simple VI attached to this post.

I post it here in order to help anyone who is looking into the same problem in the future.

 

Still, thank you very much for your support and let me know your thoughts about this VI!

Cheers

0 Kudos
Message 7 of 8
(3,437 Views)

Glad its working.  Good luck with the rest of the development.

0 Kudos
Message 8 of 8
(3,433 Views)