• 0

AD2 Loading .csv file for Scripting Pattern Generator



I am attempting to script the pattern generator using a custom defined waveform. My perspective is that I have two options: (1) entering the custom values for the 1-1024 buffer slots through waveforms scripting or (2) loading in a .csv file that I create in another program. I have successfully done this using option 2 but the issue is I need for the entire system to be automated and would like to either find a way to script the file Import processes for the csv file or to define the values directly in waveforms scripting. Any help would be appreciated.

Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

My script so far:

Patterns1.Channels.resistor.Output.text = "PP";
Patterns1.Channels.resistor.Type.text = "Custom";
Patterns1.Channels.resistor.Idle.text = "1";
Patterns1.Channels.resistor.Frequency.value = 2e6;

Is there an option to select the Import .csv file or is there a way to enter the values in the script?

Link to post
Share on other sites
  • 0

Hi attila,

I am trying to use the .csv files in a precision timing application for high speed imaging where I need to delay a signal by 1 us increments. I do this by the following.


wait_time_offset = 10e-6; // move start a bit from 0 so easier to see

Patterns1.States.Wait.value = wait_time_offset;

Patterns1.Channels.resistor.custom = resistor_pulse; // string definition which you helped with previously
Patterns1.Channels.resistor.Delay.value = TT; //value I will change programmatically in a for loop to step the delay
Patterns1.Channels.resistor.Output.text = "PP";
Patterns1.Channels.resistor.Type.text = "Custom";
Patterns1.Channels.resistor.Idle.text = "0";
Patterns1.Channels.resistor.Frequency.value = freqeuncy_value; //10 MHz
Patterns1.Channels.resistor.Samples.text = '5k';


The setup works properly for small time delays but then there seems to be significant error after say 20 us of delay. When I don't load in a .csv file, and use the native pulse setups for a single pulsing event, there is no noticeable error. It seems to be when I load in the .csv file. I did increase the sample size to 5K from 1.024K. Could the issue be with the read-in time / processing time to read in a .csv file?




Edited by brha0386
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