01-24-2012 12:41 PM - edited 01-24-2012 12:42 PM
I am trying to create an two data arrays and display them on my front panel as I aquire them over time. I do not know why, but neither array appears to be saving the values that I expect and neither are displaying correctly....
The first array is simply an index of stage positions and the second is the data aquired at each position. For the "Last Scan" display, it shows my data once and then does not update, and for my averaged array for the averaged data over time, it never shows anything.
Additionally, my array that is saved at the end is all zeros for my data, despite the fact that I know that the program is reading non-zero data points.
Any advice would be greatly appreciated.
Solved! Go to Solution.
01-24-2012 12:41 PM
it wouldn't let me post with an attachment initially, so here it is.
01-24-2012 12:50 PM - edited 01-24-2012 12:57 PM
I cannot test without your gear, but there are a couple of simple beginners mistakes:
Realtime monitoring:
Dataflow problem. The loop conditions will never change once the loop runs. The control terminal needs to be in the innermost loop.
Saving problem:
You have an uninitialized shift register, meaning it starts out as an empty array. Adding an array to an empty array will always result in an empty array, because the shorter array "wins". LAter building the 2D array will pad with zeroes. You need to initialize the shift register with an aray of the proper size. You could multiply the array output from the preceeding loop by zero and wire from the outside of the shift regsiter.
There are probably other problems, I have not studied the code in detail. For example the larger sequence structure has no purpose. The innermost while loop should be a FOR loop, etc.
01-24-2012 12:53 PM
I took a quick glance while im waiting for a question of mine to be answered and from what I saw, you have some serious loop issues.
1 issue to me is your DAQmx is not set up properly. You need to set it up so that is Starts, Reads in a loop, and stops outside a while loop. That loop should probably be seperate from the timed loop it is embedded in right now,too. If the "realtime Monitoring" button is True, your code is stuck in the loop inside the case structure. As long as it is in there, the outerloop will not iterate until the inner loop is stopped( Realtime Monitoring=F)
01-24-2012 03:09 PM
Yes, well this is the first piece of labview I've ever written.
Is there a way to see what the values of an array are while stepping through the code without coding an output to the front panel?
I initialized the shift register, but when I get my output from the program the only 2 values in the array are at the 99th position ie.
0, . . . 99, 0
0, . . . 0.35, 0
01-24-2012 03:22 PM - edited 01-24-2012 03:23 PM
double post.
01-24-2012 03:23 PM
Here is the updated code. To be honest, I don't really care about the realtime monitoring stuff at the moment, I am just trying to get my arrays to save properly, so if you could please focus any help in that area, I would appreciate it.
All of the loops have been replaced with For loops and I believe everything is initialized now.
01-24-2012 03:23 PM
aethelwulf wrote:Is there a way to see what the values of an array are while stepping through the code without coding an output to the front panel?
Use a conditional array probe in the desired location.
01-24-2012 04:16 PM
I forgot to invclude a shift register, it's all working now.