void lecroy_clear_sweeps(VXI11_CLINK * clink) { /* Needs to send an INR? query, in order to reset the registers * (we don't care what the value is) */ vxi11_obtain_long_value(clink, "INR?"); vxi11_send_printf(clink, "CLSW"); }
/* This version of the function, rather than using the "INSP? WAVE_ARRAY_1" query, * uses VBS commands. The difference is that the VBS responses get updated the moment * a setting (like the timebase) is set. However, there is no simple command that * gives you they same number as the actual number of bytes returned, there is usually * an extra single byte on the maths channels, and an extra 2 bytes on the acquisition * channels. */ long lecroy_calculate_no_of_bytes_from_vbs(VXI11_CLINK * clink, char chan) { int bytes_per_point; long no_of_points, no_of_segments, no_of_bytes; no_of_points = vxi11_obtain_long_value(clink, "VBS? 'Return=app.Acquisition.Horizontal.NumPoints'"); bytes_per_point = lecroy_get_bytes_per_point(clink); // Check whether we've been passed a maths channel or not. If so, then it // doesn't matter whether we're in segmented mode or not, as we will be taking // the average of all the segments, in which case the number of segments is // irrelevant as it will not affect the number of bytes. Also, maths channels // return an array which is 1+app.Acquisition.Horizontal.Points, acquisition // channels return 2+app.Acquisition.Horizontal.Points (x no of bytes per point) if (lecroy_is_maths_chan(chan) == 1) { no_of_bytes = bytes_per_point * (1 + no_of_points); } else { no_of_segments = lecroy_get_segmented(clink); // returns 1 if not in segmented mode no_of_bytes = bytes_per_point * no_of_segments * (2 + no_of_points); } return no_of_bytes; }
/* Checks to see if we are in segmented mode, if we are then return the number of * segments (minimum = 2), if not then return 1 */ int lecroy_get_segmented(VXI11_CLINK * clink) { if (lecroy_get_segmented_status(clink) == 1) { return (int)vxi11_obtain_long_value(clink, "VBS? 'Return=app.Acquisition.Horizontal.NumSegments'"); } else { return 1; } }
int lecroy_get_averages(VXI11_CLINK * clink, char chan) { char maths_chan; char maths_chan_str[20]; char source[20]; char cmd[256]; if (lecroy_is_maths_chan(chan) == 0) { maths_chan = lecroy_relate_function_to_source(chan); } else { maths_chan = chan; chan = lecroy_relate_function_to_source(maths_chan); } lecroy_scope_channel_str(maths_chan, maths_chan_str); sprintf(cmd, "VBS? 'Return=app.Math.%s.Operator1Setup.Sweeps'", maths_chan_str); return (int)vxi11_obtain_long_value(clink, cmd); }
/* Lazy wrapper function with default read timeout */ long vxi11_obtain_long_value(CLINK *clink, const char *cmd) { return vxi11_obtain_long_value(clink, cmd, VXI11_READ_TIMEOUT); }