LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

better method than using a large number of shift registers?

I'm trying to work with example code provided free by stanford research systems (http://www.srsys.com/downloads/soft.htm).

Their example software alows the user to run an analog scan across 100 masses (the x axis) which progressively produces a graph of all the data. It repeats scanning (and updating the graph)until the user hits stop.

My goal is to find a way to make the program display the graph of the last scan while it is displaying the current scan (this way it is possible to compare the graphs and see how they change). But as best I can tell the data is generated and plotted in a while loop piece by piece so the best thing my labview inept mind has managed so far is using a large nu
mber of shift registers and graphing the points as they generated along with points that were generated 10 cycles ago in a different color.

So I hope to either find a good way to use shift registers to get values from over 100 cycles ago (which doesn't really seem to work unless i just make space for over 100 little arrows in my loop) or to find a better approach to the whole mess.

The example does not seem to use XY plot and to tell the truth I don't know exactly what its using to plot.
Can anyone offer any guidance or at least understand my question enough to point me in the right direction.
I'm including the stock example and my adaptation to it but if you need to use the included sub vi's the package is on that SRS webpage I listed above (look under RGA).

I suppose this may all be too much to ask but I can dream can't I?
Download All
0 Kudos
Message 1 of 7
(3,058 Views)
You could just build up a 2D array as in the attached example. (I don't have any DAQ, so I just simulate a signal). Optionally, you can just display the current trace plus one of the history traces.

There could be performance issues if you continuously resize arrays as in this example, so make sure the program does not run forever. A better solution would be to use a fixed-size history array (initialized all to NaN at the beginning) and then always replace the "oldest" trace as you go, keeping track of the indexes.
0 Kudos
Message 2 of 7
(3,058 Views)
Hello,

I worked for a while on this one and wanted to show you what I came up with. This solution needs some tweaking but it seems to meet the criteria you mentioned.

Hope this helps!

Liz F
National Instruments
0 Kudos
Message 3 of 7
(3,058 Views)
I appreciate both of your prompt answers. I am going to continue to work with this for awhile but after playing with the examples for a bit I'm still afraid I'm having trouble. I think i don't properly understand the way the data from my DAQ is being output and the way the analog graph is being updated.

You are completely correct that tossing the output of the DAQ into an array as its being plotted so that 100 points later it can be replotted with the new data is what I am trying to do. I just don't think I understand the fine points of array management. Like how do you make sure the 50th, 150th, and 250th etc. measurments (correspondingto 50 AMU on the x axis) are all falling into the 50th position on the array, and then how do you make sure that t
he graph looks for that data in the 50th position?

I'll keep playing with it but thank you both I believe you have saved me quite a few hours of beating my head against the desk.
-Paul
0 Kudos
Message 4 of 7
(3,058 Views)
Hello Paul,

Just a couple of thoughts as you continue to investigate your program. Your DAQ data may be gathered as a waveform data type, which combines data with timestamp information. If that is the case, you must extract just the data and ignore the timestamp if you are to plot data from different time periods on the same x-axis. So, you might wish to extract the data using the "Get Waveform Components" function found in the Functions >> Waveform palette. This will allow you to return just the array of data rather than the timestamped waveform. Then, you can analyze that array to see how many data points are being generated at once, etc. After you know that, you can implement a programming structure similar to mine because you will know h
ow many times to call your DAQ code in order to generate the number of data points you want at a time (such as 100).

If you'd like, post a screenshot of your code (or the code itself) and I'd be happy to help you sort through the DAQ programming, which sounds like the main stumbling block at this point.

Hope this helps!

Liz F
National Instruments
0 Kudos
Message 5 of 7
(3,058 Views)
I certainly agree that the DAQ programming is the part leaving me most confused. I'll attach the package that I am trying to modify, the trouble is there are so many sub vis involved in actually acquiring the data that I am not entirely sure what format the data comes out in.

Perhaps to someone more skilled than I am with lab view the inner workings of this package would be clearer. If you are up for it then look at SRSRGAa simple analog.vi in SRSRGA61.lib and you can see what I'm working with.

I'll also attach my attempt to modify the code to make it work like altenbachs example... however somehow it would seem my timing/synchronization is off. Hope some of this makes sense, I'll see what luck I can have with get w
aveform components, I suppose I have been approaching this so far as if my DAQ was just giving me data points as opposed to a waveform.
Download All
0 Kudos
Message 6 of 7
(3,058 Views)
Hello,

I'm sorry for the delay - I was teaching a LabVIEW course last week.

In order to see each point as it is plotted, you must acquire a single point at a time. I could not think of any other method besides the one I sent before, but I attached it again with more comments so perhaps you can fill it in with your VIs. It looks like your main acquisition VI, the pressure VI, is getting 100 points at a time. Can you modify it to get just 1 point, and then use the structure in my attached VI? You could easily replace the "data" code in my VI with your acquisition VI, as I noted in the attached example.

I hope this helps! Let me know if I am missing the point...

Liz F
National Instruments
0 Kudos
Message 7 of 7
(3,058 Views)