Tektronix Technical Forums are maintained by community involvement. Feel free to post questions or respond to questions by other members. Should you require a time-sensitive answer, please contact your local Tektronix support center here.

Capture waveform screenshot from MDO3014 oscilloscope

Post Reply
venu13
Posts: 4
Joined: September 17th, 2020, 6:28 am
Country: India

Capture waveform screenshot from MDO3014 oscilloscope

Post by venu13 » September 17th, 2020, 6:35 am

HI, I am using TekVisa library to communicate with MDO3014 oscilloscope through USB in C#.

I am trying to save screenshot of oscilloscope and write it to image file but the image file is corrupted.

//Code snippet
tekVISA.Write("SAVe:IMAGE FILEF BMP");
tekVISA.Write("HARDCOPY START");
bool status3 = tekVISA.Read(out response);
Console.WriteLine(status3);


string filepath = @"C:\Temp\test.bmp";
using (BinaryWriter binWriter =
new BinaryWriter(File.Open(filepath, FileMode.Create)))
{
binWriter.Write(response);
}
}

Please let me know what mistake I am doing here.
Attachments
waveform_test.png
waveform_test.png (8.58 KiB) Viewed 137 times

w2aew
Tektronix Applications
Tektronix Applications
Posts: 145
Joined: December 2nd, 2008, 2:27 pm
Country: United States
Contact:

Re: Capture waveform screenshot from MDO3014 oscilloscope

Post by w2aew » September 17th, 2020, 6:52 am

What version of firmware are you running? There was an issue with support of the HARDCOPY START command that was addressed in the later firmware versions.

The most recent firmware is v1.30, and can be found here:
https://www.tek.com/oscilloscope/mdo301 ... lease-v130

venu13
Posts: 4
Joined: September 17th, 2020, 6:28 am
Country: India

Re: Capture waveform screenshot from MDO3014 oscilloscope

Post by venu13 » September 17th, 2020, 6:56 am

I am using latest firmware version - v 1.3
Attachments
firmware_version.png
firmware_version.png (3.63 KiB) Viewed 134 times

Carl M
Tektronix Applications
Tektronix Applications
Posts: 801
Joined: July 30th, 2008, 4:45 pm
Country: United States

Re: Capture waveform screenshot from MDO3014 oscilloscope

Post by Carl M » September 17th, 2020, 7:27 am

How many bytes are in response? I would check to make sure you've read all the bytes.
Tektronix Application Engineer

Dave W
Tektronix Applications
Tektronix Applications
Posts: 308
Joined: April 26th, 2010, 12:01 pm
Country: United States

Re: Capture waveform screenshot from MDO3014 oscilloscope

Post by Dave W » September 17th, 2020, 8:31 am

Hi venu13. It looks like you are using the TekVISANET library. You are using the incorrect read method from that library. The one you are using outputs the data as a string. You need to use the ReadBinary() method which outputs the data to an array of bytes (byte[]). Strings in C# are not the same as C/C++ strings and reading to those will cause corruption of the binary data returned from hardcopy.

venu13
Posts: 4
Joined: September 17th, 2020, 6:28 am
Country: India

Re: Capture waveform screenshot from MDO3014 oscilloscope

Post by venu13 » September 18th, 2020, 1:56 am

I tried with ReadBinary method, but not getting any data into byte array from HARDCOPY START command. It is empty.

byte[] waveformResponse;
tekVISA.Write("SAVe:IMAGE FILEF BMP");
tekVISA.Write("HARDCOPY START");
bool status3 = tekVISA.ReadBinary(out waveformResponse);

Here status3 is False, and waveformResponse is empty.

Dave W
Tektronix Applications
Tektronix Applications
Posts: 308
Joined: April 26th, 2010, 12:01 pm
Country: United States

Re: Capture waveform screenshot from MDO3014 oscilloscope

Post by Dave W » September 18th, 2020, 1:48 pm

Looking at your code there looks like a command syntax error in the second line.

Code: Select all

tekVISA.Write("SAVe:IMAGE FILEF BMP");
should read

Code: Select all

tekVISA.Write("SAVe:IMAGE:FILEF BMP");
If that command is not set correctly, the scope could be in a state where it doesn't know the desired format of hardcopy and so it doesn't return anything.

Note: You can check that you haven't sent any bad commands by sending the command *ESR? followed by ALLEV? If *ESR? returns anything other than 0 then there is an event (or error) the scope has in its event queue and ALLEV? will read back the queue.

Post Reply

Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest