Jump to content
  • 0

Scripting example for mosfet Vgs-Id matching


Shifuu

Question

Folks,

I have seen the various curve tracer tutorials but unfortunately I need to get a little more fancy in some respects and simpler in others. I am new to scripting and so could *really* use some help with writing something that will help me measure and save (as a CSV) the Vgs vs Id measurements for mosfets so I can then use VB in excel to find close matches. The typical characteristic curves (Id vs Vds at various Vgs) are not needed so that should make life a little more simple I hope.

So in a nutshell I need a script for me to measure the Id through a mosfet as the Vgs is stepped and, so the task requires AWG, Measure and acquisition and file handling.

In this example, W1 is connected G-S, Ch 1 is measuring the actual voltage G-S, Ch2 is measuring the voltage across a 10 R resistor connected between drain and an external current limited lab supply.

Here is briefly what I'm trying to get the script to do each time i press Run:

i.  AWG W1 step through 3-5V in 0.1V increments

ii. At each step measure Ch1 and Ch2

iii. Add a incremented separator to the CSV so i can distinguish between subsequent runs and then append the data to "Curve.csv"

At (iii) is where things get really hard - the script has to check if the file already exists and if so, add an incremental header (eg Fet-n,) and append the measurements from above. If the file doesn't exist then it creates it.

In the example above, press run would therefore result in 20 lines in the CSV file with two values (ie Ch1 and Ch2) each line.

With each retrigger (aka pressing run again), increment header and append new readings to the SAME file (not create a new file each time I trigger)

My sincere thanks in advance for your help...

Cheers,

Shifuu

 

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Hello @Shifuu

Here you have:

Scope1.Trigger.Trigger.text = "None"
Scope1.Channel1.Offset.value = -2.5
Scope1.Channel2.Offset.value = -2.5
Scope1.run()

Wavegen1.Channel1.Simple.Type.text = "DC"
Wavegen1.Channel1.run()
wait(1.0) // wait 1 sec

var fet
if(isNaN(fet)) fet = 1
else fet++

var file = File("~/Desktop/curve.csv")
file.appendLine("Fet-"+fet)

for(var mvOff = 3000; mvOff <= 5000; mvOff+=100){
    var vOff = mvOff/1000
    Wavegen1.Channel1.Simple.Offset.value = vOff
    wait(1.0) // wait 1 sec
    var v1 = Scope1.Channel1.measure("Average")
    var v2 = Scope1.Channel2.measure("Average")
    // print to output window
    print(vOff+","+v1+","+v2)
    // append file
    file.appendLine(v1+","+v2)
}
Scope1.stop()
Wavegen1.stop()

i1.png

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...