02-22-2012 10:35 AM
Attached is an image of my block diagram and my front panel for a pretty simple program I am writing. It constantly reads data from a DVM and puts the data into 3 columns, 1 has all the data, 1 has all the data above a certain threshold, and 1 has all the data below a certain threshold. I am trying to get it to display the data it has collected on the front panel and am running into a problem.
In my attached image I have tried to use array indicators and a table control to do this (I was missing a "transpose array" for the table control when I took the screen shot, so those numbers have been moved to across the top row instead of down the first column) but they never show more than 1 line of data at a time. If I take the table control and put it outside the while loop, I am pretty sure it will have all the data but it won't update in real-time. I would like it to show all lines of data in real time, instead of just 1 line of data in real time or all lines of data once the program is over.
02-22-2012 11:36 AM
One thing you are missing here is your shift register and when you are building the array insert the element at the top. But make sure that how long you will be building the array. If it is for short duration there is no problem but if you are running for a long time you will run out of memory. Just check the attached snippet for your reference.
Good luck
02-22-2012 11:56 AM
Thanks for the tip, I'm not exactly sure of the running time yet but there is a good chance it could go on for up to a few hours, in which case memory may start to become an issue. Is there another way around that?
02-22-2012 12:14 PM - edited 02-22-2012 12:18 PM
Few hours means your application would crash because of memory leak. Try this
Open a file reference for .bin file before starting the loop and write the data at regular intervals
Good luck
02-22-2012 02:04 PM
Another problem you'll run into running the code for hours is that the loop time will gradually get longer and longer as LV has to allocate more and more memory. The other solutions are the way to go, just remember that you have a trade-off between execution time and exposure to loss of data.
Mike...
02-23-2012 09:34 AM - edited 02-23-2012 09:35 AM
Just to make sure I've got this straight, I run the risk of running out of memory if it runs for a number of hours because of my use of arrays, and if it runs for so long the arrays will get huge, causing them to eat up more memory, causing the loop time to get longer?
So in theory as long as I don't use arrays+shift registers then I should not have a memory problem.
02-23-2012 10:02 AM
As long as you want to use a table control, you will be using an array so your comment makes no sense to me.
02-23-2012 10:08 AM
That was more of a general programing / knowledge for the future type-question and not so much a specific to this instance type-question
02-23-2012 10:33 AM
@LarsUlrich wrote:
So in theory as long as I don't use arrays+shift registers then I should not have a memory problem.
No as long as you properly handling them they will not create memory issue.
02-23-2012 10:56 AM