• RE: Tektronix MDO4104B-6 oscilloscope failing to respond during traces' collection process

    We are communicating with the instrument via USB. In order to avoid TekVisa timeout issues, we are adding some sleep time (delay) after every iteration. With this extra delay, we are successfully able to capture data from channel 1 without any issue only until some iterations. After that, the process gets paused, and it takes indefinite time to resume. But, when we extract data from both channel 1 and channel 2, even with the extra delay, tekVisa is getting timed out very soon.<br> <br> Some portion of the code:<br> &#160; <p>Random rand = new Random();</p> <br> int loop = 0;<br> // int delayTime = Delay;<br> int sampleLength = samples;<br> bool error = false;<br> <br> byte[] text_in = new byte[16];<br> byte[] text_out = new byte[16];<br> byte[] text_ans = new byte[16];<br> <br> VISA TVA = new VISA();<br> // Print list of VISA resources<br> TVA.FindResources(&quot;?*&quot;, out instrlist);<br> //TVA.Timeout(10000);<br> Console.WriteLine(&quot;Visa Resources&quot;);<br> for (j = 0; j &lt; instrlist.Count; j++)<br> {<br> Console.WriteLine(j.ToString() + &quot; : &quot; + instrlist[j]);<br> }<br> Console.WriteLine(&quot;\n&quot;);<br> <br> // Connect to a known instrument and print its IDN<br> TVA.Open(OSCILLOSCOPE);<br> TVA.Write(&quot;*IDN?&quot;);<br> status = TVA.Read(out response);<br> if (status)<br> {<br> Console.WriteLine(response);<br> }<br> <br> <br> // FILE READER<br> //StreamWriter myWriter;<br> // myWriter = new StreamWriter(&quot;output.csv&quot;);<br> //Console.WriteLine(&quot;reading from file&quot;);<br> <br> // Initialization<br> hw.setKey(key, 16); // Hardware<br> sw.setKey(key); // Software<br> <br> string path = @&quot;E:\VS\plaintexts\PlainText_1000000.txt&quot;;<br> // string path = @&quot;D:\sanjana_laptop\downloads\PlainText_1000000.txt&quot;; //@&quot;E:\VS\plaintexts\pt_9000.txt&quot;; //pt_117000<br> // Main loop<br> progress = 0;<br> worker.ReportProgress(progress, (object)(new ControllerReport(loop, text_in, text_out, text_ans)));<br> <br> // myWriter.WriteLine(BitConverter.ToString(key).Replace(&quot;-&quot;, &quot; &quot;));<br> <br> <br> using(StreamReader file = new StreamReader(path)) {<br> //int loop = 0;<br> string ln;<br> while ((ln = file.ReadLine()) != null &amp;&amp; (loop &lt; num_trace)) {<br> progress = (int)(100.0d * loop / num_trace);<br> <br> <br> // Generate plain text<br> for (int i = 0; i &lt; 16; i++) text_in[i] = (byte) Convert.ToInt32(ln.Substring(i*2,2),16);<br> loop++;<br> // for (int i=0; i&lt;16; i++) text_in[i] = 0;<br> // Software encryption<br> text_ans = sw.encrypt(text_in);<br> <br> // Hardware encryption<br> hw.writeText(text_in, 16);<br> hw.execute();<br> hw.readText (text_out, 16);<br> <br> // Get curve data for channel 1, and scale to volts.<br> byte[] rawwave1;<br> float[] wave1;<br> TVA.Write(&quot;DATA:SOU CH1&quot;);//, CH2*/<br> TVA.Write(&quot;DATA:WIDTH 2&quot;);<br> TVA.Write(&quot;DATA:ENC RPB&quot;);<br> TVA.Query(&quot;WFMPRE:YMULT?&quot;, out response);<br> ymult1 = float.Parse(response, CultureInfo.InvariantCulture.NumberFormat);<br> TVA.Query(&quot;WFMPRE:YZERO?&quot;, out response);<br> yzero1 = float.Parse(response, CultureInfo.InvariantCulture.NumberFormat);<br> TVA.Query(&quot;WFMPRE:YOFF?&quot;, out response);<br> yoff1 = float.Parse(response, CultureInfo.InvariantCulture.NumberFormat);<br> TVA.Query(&quot;WFMPRE:XINCR?&quot;, out response);<br> xincr1 = float.Parse(response, CultureInfo.InvariantCulture.NumberFormat);<br> TVA.Write(&quot;CURVE?&quot;);<br> TVA.ReadBinary(out rawwave1);<br> TVA.Read(out response);<br> wave1 = new float[rawwave1.Count()];<br> for (j = 0; j &lt; sampleLength /*rawwave1.Count()*/; j++)<br> {<br> wave1[j] = (rawwave1[j] - yoff1) * ymult1 + yzero1;<br> <br> }<br> <br> //write waveform to a csv file<br> <a href="http://System.IO" rel="noreferrer noopener" target=_blank title="http://system.io/">System.IO</a>.StreamWriter file1 = new <a href="http://System.IO" rel="noreferrer noopener" target=_blank title="http://system.io/">System.IO</a>.StreamWriter(&quot;cfb_64_&quot; + loop + &quot;.csv&quot;);<br> file1.WriteLine(&quot;TIME,CH1&quot;);<br> //file1.WriteLine(&quot;TIME,CH1,CH2&quot;);<br> //Console.WriteLine(rawwave1.Count());<br> for (j = 0; j &lt; sampleLength /*wave2.Count()*/; j++)<br> {<br> timepoint = j * xincr1;<br> // file1.WriteLine(timepoint.ToString() + &quot;,&quot; + wave1[j].ToString() + &quot;,&quot; + wave2[j].ToString());<br> file1.WriteLine(timepoint.ToString() + &quot;,&quot; + wave1[j].ToString());<br> }<br> file1.Close();<br> <br> //Console.WriteLine(&quot;\nPress Enter to exit&quot;);<br> //Console.ReadLine();<br> <br> // COMPARE SW &amp; HW GENERATED CIPHERTEXTS<br> //for (int i=0; i &lt; 16; i++)<br> // if (text_out[i] != text_ans[i])<br> // error = true;<br> <br> //WRITING TRACE NUMBER TO FILE<br> //myWriter.Write(loop+&quot;,&quot;);<br> <br> // WRITING PLAINTEXT TO FILE<br> //string tempString1 = BitConverter.ToString(text_in).Replace(&quot;-&quot;, &quot; &quot;);<br> //myWriter.WriteLine(tempString + &quot;,&quot;);<br> <br> // WRITING CIPHERTEXT TO FILE<br> //string tempString2 = BitConverter.ToString(text_out).Replace(&quot;-&quot;, &quot; &quot;);<br> //myWriter.WriteLine(loop + &quot;,&quot; + tempString1 + &quot;,&quot; + tempString2 );<br> //myWriter.WriteLine();<br> <br> worker.ReportProgress(progress, (object)(new ControllerReport(loop, text_in, text_out, text_ans)));<br> <br> if (worker.CancellationPending || error)<br> break;<br> <br> // Sleep for given period of time<br> System.Threading.Thread.Sleep(500/*delayTime*/);<br> <br> } //endof loop<br> <br> if(TVA!=null) {<br> TVA.Clear();<br> TVA.Close();<br> }<br> file.Close();<br> } <p></p>
  • RE: Default .csv file name while saving traces in Tektronix MDO 4104B-6

    Thank you, Sir!
  • RE: Tektronix MDO4104B-6: Trace samples collection using commands

    Thank you, Sir!
  • Tektronix MDO4104B-6: Trace samples collection using commands

    Can someone kindly assist by providing a sample code using commands for acquiring trace samples shown on the oscilloscope screen to the PC in the form of .csv files?&#160; The code in any platform, such as, MATLAB, Python, is fine, however, C# is preferable.<br> <br> Attaching the oscilloscope programmer manual for reference.&#160;<br> <br> &#160;
  • Traces saving into a USB drive with Tektronix MDO4104B-6 working in "Fast Acquisition mode"

    Hi all!<br> <br> I wish to capture trigger events and save the samples corresponding to the trace patterns observed on the scope, into a USB drive. I was able to do it while using the &quot;<strong>Single</strong>&quot; trigger mode capture which was a very slow process (1 trace /second).<br> <br> However, upon starting to use the&#160;<strong>Fast Acquisition mode</strong>, I am unable to do the samples saving into the USB. Also, the &quot;Single&quot; trigger mode capture can't be enabled and the &quot;<strong>Run/Stop</strong>&quot; trigger mode capture gets activated automatically. The aim of using&#160;the&#160;Fast Acquisition mode is to speed up the trace samples saving process (to ~100 traces/second).<br> <br> Also, I am told that in the Fast Acquisition mode, the trace samples might be saved in the &quot;<strong>internal buffer</strong>&quot; of the oscilloscope.&#160;<br> <br> Can anyone assist me in saving the traces in the USB or accessing the internal buffer of the scope while working with the fast acquisition mode ?<br> <br> A video which explains about my situation.&#160;https://youtu.be/zkYdOeVSfRQ
  • RE: Default .csv file name while saving traces in Tektronix MDO 4104B-6

     Thank you for your kind reply, Afonso Teles!

    I wish to clarify that I am capturing the traces at "trigger" as an "act on event" which does not allow me to manually change the file name using the save waveform button on the scope.

    I am not using any SCPI command or the TekScope Utility for my experiment. I am attaching a video for better clarification.

    Birjit Singha
    IIT Guwahati, India
     
     
  • Default .csv file name while saving traces in Tektronix MDO 4104B-6

    Hi all!

    I am using Tektronix MDO 4104B-6 to record traces. The .csv files get saved with default names, as tek0000All.csv, tek0001ALL.csv, tek0002ALL.csv, and so on.

    Due to only 4 numerals being allowed in the default names, I am able to save only 9,999 files whereas I wish to extend up to 20,000 files. 

    Kindly assist in changing the default file naming of the .csv files in the aforementioned MDO.


    Thanks and regards,

    BIrjit Singha
    IIT Guwahati, India