09-11-2013 11:06 AM
Hi,
I am displaying elapsed time on the display panel. I also have a "record" button on the panel and I would like it to take the current elapsed time value and write it to a spreadsheet. Currently my code runs the elapsed time and resets when I press record, but it records every single value and overwrites itself.
Solved! Go to Solution.
09-11-2013 11:32 AM
You need to set up a shift register instead of your tunnel you currently have. What's happening is when you finally press stop, it takes the last value it saw for your elapsed time, record data, and time stamp and puts that in your spreadsheet. You simply need to put a shift register and a build array that has one input as the current data and the next input as the new data. You need to do that for each of your records that are going to change during a run.
Also why are you building into an array before the spreadsheet? I would think you might want to concatenate those strings instead.
09-11-2013 11:44 AM
Thank you. I will try the shift register instead. I honestly havent heard of concatenating before and I saw an example like this online that sent to a speadsheet so i tried to mimc it.
09-11-2013 11:50 AM
Just keep in mind you need to initialize the shift register outside of the while loop as a 1D array of strings.
You can find the concatenate under Programming>Strings>Concatenate. You could build it into array though as you are doing and have the tab as the delimiter. That would just change your 1D array into a 2D array. Concatenating is useful if you want a specific format i.e. Time Stamp : Record Data/Time Elapsed. Though if you wanted this in Excel, you should indeed build an array because as just mentioned it will put each one into its own individual column.
09-11-2013 12:13 PM
The Shift Register worked great! Thanks
Currently my code records every single elapsed value during operation. This make 100000+ entries, not good. What loop structure would you suggest or funtion block to only record the elapsed time when I press record?
09-11-2013 12:21 PM
An event structure. Just house all of your code into an event structure that waits for record to be pressed. Note you would also have to add an event for the stop button, so that it exits the while loop properly.
09-11-2013 01:05 PM
I have tried putting the event structure around my code as you suggested and I added the record triggered action but what happend was when I ran the program nothing happend until I pressed record and then It ran my normal code. I then tried putting the event around the output string to the array so that it would block the signal until callled upon but that didnt work either. I suggested labview to my company because I remember it being use friendly in college so now i just feel stupid.
09-11-2013 01:25 PM
Can you go over the steps you want for your VI? There are a lot of stray indicators and a random run button. You really first need to think of what you want your VI to do. Then make an architecture from that. You need to plan out what happens when one button is pressed. I really feel you need to write all of these things down in a pseudo-code like format first. LabVIEW is, indeed, more user-friendly than trying to do what you are currently doing in C++ or some other language mainly because of what it takes to make a GUI. You'll eventually get the hang of it.
09-11-2013 01:38 PM
The stray indocators at the bottom are going to be used for parts/per hour indication. simple items that I am ignoring for now. The meat and potatos of the program is that it will show a machine operator the time it has taken for a part or cylce compared to the accepted time. Got that. Now the difficulty is getting the data to record properly. I would like to press the record button and the current elapsed time be saved along with the timestamp and part number. Then the elapsed time will restart and i will be able to press record agian. I want one excel data entry everytime I press record.
09-11-2013 01:50 PM
@hturner wrote:
I have tried putting the event structure around my code as you suggested and I added the record triggered action but what happend was when I ran the program nothing happend until I pressed record and then It ran my normal code. I then tried putting the event around the output string to the array so that it would block the signal until callled upon but that didnt work either. I suggested labview to my company because I remember it being use friendly in college so now i just feel stupid.
You don't put the event structure around your code, you put it inside the outermost while loop. It has taken me a while to get used to event structures, too (I still don't always do them right the first time). Go to the help file first.
If your company bought LabVIEW with a SSP, then you're in luck! As long as the SSP is in force, you can go onto NI's website and go through the Core 1, 2, and 3 classes online for free (Event structures are Core 2, Lesson 3). There, you'll learn a LOT about LV. It is a relatively user friendly language, just like you thought, but there is a non-trivial learning curve involved.
Oh, and if you upload your code as LV12 VIs, there will be many more people (including myself) who can help you, since many haven't upgraded to LV13 yet.
Cameron