LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why is my source memory sweep running twice? ** Keithley 2400 ** SCPI **

Solved!
Go to solution

The purpose of my VI is to perform an voltage sweep across 6 seperate solar cell devices both in a dark state and with a light on. To do this, I am first loading this sweep onto the Keithley 2400 and saving it in the memory slot 1.

 

(Please disregard the _s. I needed to insert them so the code wouldn't be filled with emoticons...)

 

*RST
*CLS
*SRE 1
:_STAT:MEAS:ENAB 512
:_SOUR:CLE:AUTO ON
:_SOUR:FUNC VOLT
:_SENS:CURR:_PROT 0.1
:_SENS:FUNC:CONC ON
:FORM:ELEM VOLT,CURR
:_SOUR:VOLT 0
:_SOUR:_DEL 0
:_SOUR:_SWE:RANG BEST
:_SOUR:VOLT:MODE SWE
:_SOUR:_SWE:_SPAC LIN
:_SOUR:VOLT:_STAR -0.5
:_SOUR:VOLT:_STOP 2
:_SOUR:_SWE:_POIN 100
:ARM:COUN 1
:TRIG:CLE
:TRIG:COUN 100
:TRAC:_POIN 100
:TRAC:FEED SENS
:TRAC:FEED:CONT NEXT

:_SOUR:MEM:_SAVE 1

 

Then I call on this source memory sweep later in the program with these commands:

 

:_SOUR:MEM:_POIN 1
:_SOUR:MEM:_STAR 1

:INIT

 

For some reason, the Keithley 2400 sweeps twice every time I want it to sweep once. In other words, it does device 1 dark, then device 1 dark, *delay*, device 1 light, then device 1 light...

 

I only get one set of data each time so I do not know which sweep's data is being reported. This is important because running the sweep sometimes does something to the solar cell so I do not know if the data I am collecting is the first or second sweep.

 

My VI and subVIs are attached, please take a look at them and give me your thoughts.

 

Thank you

0 Kudos
Message 1 of 24
(4,585 Views)

Here is the last subvi, for some reason I couldn't attach 4 files

0 Kudos
Message 2 of 24
(4,583 Views)

Hi,

 

Have you tried using NI spy to see what the code is actually sending, Vs. what it should be sending, and in what order? 

 

Also, you might try a few break points at strategic steps to see how the VISA sends are being activated?  Have you been able to step through the code?

 

Are you sure the instrument memory commands are not being duplicated?

 

Just a few general questions to ask before plowing into this set of VI's.

 

 

-------
Mark Ramsdale
-------
0 Kudos
Message 3 of 24
(4,579 Views)

I am working on figuring out how to run an NI I/O Trace. I think that is a newer version of NI Spy.

 

I am not sure what you mean by break points/ stepping through the code.

 

I have highlighted the execution and watched the lines of code get individually written.

 

I don't think the memory commands are being duplicated, the save command just gets sent once.

0 Kudos
Message 4 of 24
(4,574 Views)

Hi,

 

I/O trace will let you know what is being written, get that going 🙂

 

Breakpoints and stepping through, and/or highlighting are the debugging tools.  If you step through or highlight and watch the code execute you should be able to see where the duplication of VISA calls is being made.  This is assuming that the memory call to the instrument is occurring twice, and there is not a duplicate set of commands sent at once.

 

Can you call the memory in the instrument directly from MAX?  If so, does it sweep once or twice?

 

***

 

It seems that dividing the problem into either a) Two calls, or b) one call with twice the commands ( or some incorrect command) is a great starting point.

 

Watching the code execute should tell you exactly where the offending call is located.  You can use breakpoints to run the code to a stop point and then turn on highlight execution.  This saves time watching parts of code you know are good.

 

 

-------
Mark Ramsdale
-------
0 Kudos
Message 5 of 24
(4,571 Views)

Thanks for all of the suggestions!

I'm working through them now.

0 Kudos
Message 6 of 24
(4,565 Views)

I've attached the results of my spy run. I can't find any instance of a double call. Lines 15-54 show the script being loaded onto the Keithley and then called once. Any thought?

Download All
0 Kudos
Message 7 of 24
(4,556 Views)

Can you call the script from MAX to verify?

 

Is it possible that when loading the script the script is also being run?

 

What is the symptom, or where are you seeing that the instrument is returning two sets of data?  Which part of the code is this in , and / or what indicator or filesave is this occurring at? 

 

This last one is critical for understanding the actual problem, thus looking to the solution.

 

 

 

-------
Mark Ramsdale
-------
0 Kudos
Message 8 of 24
(4,550 Views)

I just called the script from MAX and the sweep only ran once.

 

When it runs twice, the only indication I have is that it displays it on the Keithley as it is happening. There are not 2 sets of data that get saved.

 

I am now going to compare the Spy capture from the MAX session to the usual one.

0 Kudos
Message 9 of 24
(4,545 Views)

Comparing the two didn't really help. I still can't tell whats wrong.

0 Kudos
Message 10 of 24
(4,536 Views)