Sorry if this is a very elementary question - I'm working as an intern and have been trying to learn labview, so bear with me here. I am controlling a power supply (Keithley 24xx) via GPIB, and its supposed to run for an extended period of time (needs to run from as little time as 30 min to +20 hrs). While running, I would like it to save and record data (time elapsed / Voltage / Current) as it's running, either into a CSV file, spreadsheet, or something similar. Ideally I'd want to take a reading every 5seconds or so.
What is the best way to go about doing this? Its my understanding that I should create arrays for each of the values, and merge them into one, but I'm still trying to figure out how to do that as well. Thanks all for your help!
In this case I would start with opening and initializing the 24xx
and make sure the file you want to write to exists by adding the first line with e.g. "Voltage Current" as header.
then have a while loop in which I read out the parameters from the 24xx and immediately write to a file with write to spreadsheetfile
with add to the already existing file.
Since the power supply will already be outputting a voltage, i think i can skip the open/initializing. Is there a way i can merge all 3 of the files (time elapsed, voltage, current) into a single spreadsheet?
Also, would it be more space-efficient if I were to plot and save it as a graph instead of having 5 second strings of data?
Thanks. That really helped a lot. Now i'm facing a problem where I have the 'write to spreadsheet' in my main loop. Is there a way that I can configure a timer so that it writes every 5 seconds, but doesn't make the whole entire loop run every 5 seconds?
It looks like that is what this loop does. The wait function doesn't actively wait, it passively waits (like sleep). This is the best way to have code with a 5 second delay between each iteration. The Wait Until Next ms Multiple function will allow the code to run once every 5 seconds. If you added more functionality to this loop that you do not want to run every 5 seconds, you will need to split you code up into separate loops.
yeah. but i would like only the 'write to spreadsheet' portion to run every 5 seconds. I would like the rest to continuously run - how can i go about doing that?
Sorry I was working on my post when you added the screenshot. It looks like you do have a lot of other functionality in your loop that you do not want running every 5 seconds. This might be a good opportunity to use the Produce/Consumer architecture. It will allow you to separate the reading of your data from the recording of your data.
Check out this Developer Zone article.