Showing results for 
Search instead for 
Did you mean: 

Automated IV measurement, changing sweep direction when threshold current is reached

Go to solution



I am writing a labview program to automate the measurement of the IV characteristic of a diode-like device. The device starts passing current only above a critical voltage which is not known a priori, above the critical voltage the current depends ~exponentially on the voltage, and too high of a current can damage the device. With these facts in mind, I need a program that sweeps up the voltage applied to the device while measuring the current, and when the current reaches a specified threshold value, the voltage sweep should change direction and decrease until it reaches a user-set stopping voltage.



  • NI-DAQ USB6341 for analog input and output
  • Stanford Research Systems HV325 HV Power supply to supply the high voltage
  • Stanford Research Systems SR570 Current preamplifier to measure the currents

The program allows you to define the starting voltage, voltage step size, a threshold current, a maximum voltage (program stops if threshold current is not reached before maximum voltage is reached), a stopping voltage, and the time to spend on each step.


The program works decently well, but I'm having a problem where the voltage always increases by one extra step after the threshold is crossed and I'm struggling to understand why. I also noticed that an error that occurs if I set the step time to greater than 10 seconds, which I haven't figured out the cause of.


I'm still a labview novice so I'm sure there are some things in the program that are sub-optimal, so I'm open to any suggestions for improvement.

0 Kudos
Message 1 of 3
Accepted by topic author ndrach

It is because you write data to DAQ despite of whether you want to stop or not.


You should write to DAQ only if you want to continue. Enclose the write to DAQ with a case structure based on the decision.


Your code could be made a lot better, that is aside from getting the functionality right.


Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 3 of 3