AnsweredAssumed Answered

Acquire waveform using DSOZ204A and Scilab

Question asked by Kentish on Mar 29, 2018
Latest reply on May 3, 2018 by Kentish

Hello everyone,

 

I'm in trouble acquiring the waveform of my oscilloscope DSOZ204A. I'm connected in LAN and the connexion is ok as *IDN? works.

The function I use is the following

 

 

function [num_values]=DSOZ204A_save_waveform(id)
 
 //Get the waveform type
 DSOZ204A_write(id,":WAVeform:TYPE?")
 ans=DSOZ204A_read(id,128)
 disp("Waveform type :"+string(ans))
 
 //Get the number of waveform points
 DSOZ204A_write(id,":WAVeform:POINts?")
 nb_pt=DSOZ204A_read(id,128)
 disp("Waveform points :"+string(nb_pt))
 nb_pt=strtod(nb_pt);
  
 //Choose the format of the data returned
 DSOZ204A_write(id,":WAVeform:FORMat ASCii")
 DSOZ204A_write(id,":WAVeform:FORMat?")
 ans=DSOZ204A_read(id,128) 
 disp("Waveform format :"+string(ans))
 
 //Display waveform settings
 DSOZ204A_write(id,":WAVeform:XINCrement?") 
 x_increment=DSOZ204A_read(id,128)
 disp("Waveform X increment "+string(x_increment))
 x_increment=strtod(x_increment)
 
 DSOZ204A_write(id,":WAVeform:XORigin?") 
 x_origin=DSOZ204A_read(id,128)
 disp("Waveform X origin "+string(x_origin))
 x_origin=strtod(x_origin)
 
 DSOZ204A_write(id,":WAVeform:YINCrement?") 
 y_increment=DSOZ204A_read(id,128)
 disp("Waveform Y increment "+string(y_increment)) 
 
 DSOZ204A_write(id,":WAVeform:YORigin?") 
 y_origin=DSOZ204A_read(id,128)
 disp("Waveform Y origin "+string(y_origin))
 
 //read waveform data
 DSOZ204A_write(id,":WAVeform:DATA? 1, 50") 
 num_values=DSOZ204A_read(id,1200)
 num_values=strsubst(num_values,","," ") //replace "," by " " in the string
 num_values=strsplit(num_values," ")
 [num_values]=strtod(num_values) //Converts from string to double
 num_values=num_values(1:50);    //delete NaN value

 nb_loop=(nb_pt-pmodulo(nb_pt,50))/50
 for (i=1:nb_loop-1)
  start_pt=50+(i-1)*50+1
  end_pt=50+i*50;
  cmd=":WAVeform:DATA? "+string(start_pt)+", "+string(end_pt)
  DSOZ204A_write(id,cmd) 
  num_values_int=DSOZ204A_read(id,1200)
  num_values_int=strsubst(num_values_int,","," ") //replace "," by " " in the string
  num_values_int=strsplit(num_values_int," ")
  [num_values_int]=strtod(num_values_int) //Converts from string to double
  //num_values_int=num_values_int(1:50);
  
  //concatenation of vectors
  num_values=[num_values',num_values_int']
  num_values=num_values'
 end
 
 tempo=linspace(x_origin,x_origin+length(num_values)*x_increment,length(num_values))
 tempo=tempo(1:length(num_values))
 tempo=tempo'
 plot(tempo,num_values)
  
 disp("end of process")
 
endfunction

I first tried to read all the data using ":WAVeform:DATA?" and "DSOZ204A_read(id,1200)" but Scilab crash and lacks of memory. So I tried to acquire less points and it works with about fifty points. Thus, my idea was to acquire the waveform segment after segment -which is honestly not a good idea-. By setting the number of points by 200 it works but still not work with more points.

 

Does anyone have an idea to solve my problem?

 

NB: I link the code used.

 

Regards,

Quentin

Attachments

Outcomes