Question

Hello there!!
I'm trying to do capacitance measurements over the time with a Analog Discovery 2 NI edition and save then, as the code on the image below.

But now, I need to implement 2 things in this script, wich I would like to know if it is possible to.
   1) Save the measurements acquired automatically in a file on the computer (like a .txt or anything like that)
   2) Make the script change the  frequency of the Impedance meter as it run ( for example, acquisition 0 to 4 runs in 10kHz and  5 to 9 runs in 5kHz)

If it is possible, how could I implement that on my script ?

Thanks everyone for the attencion!

Capture.PNG

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Hi @G.cavinato

var file = File("~/Desktop/ia.txt") // ~ stands for user home path
file.writeLine("Cap\tPhase") // this will clear existing file, \t stands for tab, see Help/Script for more info 
// ...
Impedance1.Frequency.Frequency.value = 10e3 // set frequency in Hertz for Meter mode
// use Impedance1.Frequency.Start/Stop.value for Analyzer mode

Impedance1.single()
Impedance1.wait()
// ...

file.appendLine(Impedance1.Traces.Trace.getData("Cs")[0]+"\t"+Impedance1.Traces.Trace.getData("Phase")[0])
// The getData returns array and [0] addresses the first element. In Meter mode the array has length of one, so [0] is not really needed.

 

Edited by attila

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now