• 0

AD2 Loading .csv file for Scripting Pattern Generator


Question

Hi,

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

8 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?

 

Thanks,

Brandon 

Edited by brha0386
Link to post
Share on other sites
  • 0

image.thumb.png.175461cb059f471700fe3e0be05c96b1.png

Hello and Thank You.

Above... trying to import from default.csv into patterns. Had to get the names aligned (now "HANK" in script and in Patterns) to get Run to not throw an "object not found" error. The default.csv file content is below. Now, when I run the script... no errors in Output... but also the pattern does not load into HANK channel. : /

Ideas?  Thank you!

0,0
0.001,1
0.002,1
0.003,0
0.004,1
0.005,0

Link to post
Share on other sites
  • 0
Posted (edited)

image.thumb.png.ad84d5e3fb482d61a05f5e18a95a9829.png 

Thank You Sincerely! All is now working as expected.

My confusion was this...

I first EXported from patterns to .csv to try and understand what the expected format of .csv should be on IMport. Apparently... bad thinking. The EXported .csv file is in the form TIME,DATA.  The IMported .csv file should instead be in the form DATA,DATA,DATA (with the frequency control within Patterns defining the time steps).

Outstanding tools! Thank you @attila and AD2 for making my"work from home" lab nearly as capable as my bench at work (at about 1/100th the cost). The AD2 tools are allowing me to focus on the device under study (and not spend so much time trying to get the instrumentation right).   CHEERS!  Doug

p.s. I recently completed a PLL study, using AD2's: logic analyzer (PLL Controller's State Machine), oscilloscope, spectrum analyzer... so yea, GREAT TOOL!

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