Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Record readings off keithley 24xx power supply and save into a file

Hi all,

 

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!

 

0 Kudos
Message 1 of 15
(4,325 Views)

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.

 

good luck

greetings from the Netherlands
0 Kudos
Message 2 of 15
(4,323 Views)

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?

0 Kudos
Message 3 of 15
(4,322 Views)

fileIO snippet.pngTry this and play with it

greetings from the Netherlands
Message 4 of 15
(4,306 Views)

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?

0 Kudos
Message 5 of 15
(4,270 Views)

I meant to include this screen capture of my VI.

 

  Capture.PNG

0 Kudos
Message 6 of 15
(4,263 Views)

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.

National Instruments
0 Kudos
Message 7 of 15
(4,260 Views)

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?

0 Kudos
Message 8 of 15
(4,258 Views)

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.

National Instruments
0 Kudos
Message 9 of 15
(4,256 Views)

Or add a case staement around your write to spreadsheet that only executes each 5 seconds or each 10th loop

greetings from the Netherlands
0 Kudos
Message 10 of 15
(4,250 Views)