LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get a image file from keysight oscilloscope

Solved!
Go to solution

Please help to get/save a screen capture image file to PC from oscilloscope by Labview.

I could save a file to pc but it can not open. I think my program needs a function colored red? but I don't know the way in labview.

 

 

Keysight manual for python

# --------------------------------------------------------

# Download the screen image.
screen_bytes = do_query_ieee_block(":DISPlay:DATA? PNG")
# Save display data values to file.
f = open("screen_image.png", "wb")
f.write(screen_bytes)
f.close()

# --------------------------------------------------------

 

Nimy2022_0-1664966372656.png

 

0 Kudos
Message 1 of 11
(3,200 Views)

Hi Nimy,

 


@Nimy2022 wrote:

I could save a file to pc but it can not open. I think my program needs a function colored red? but I don't know the way in labview.

 

screen_bytes = do_query_ieee_block(":DISPlay:DATA? PNG")


In the end you just use VISARead - and apply all the information given in the programmer manual for your scope!

Most often you receive a length indicator (number of bytes) and then you can read that number of bytes using another VISARead.

Then you save the bytes, but without their prepended length indicator!

 

In your image you request a fixed number of bytes, which is rather uncommon for PNG files. It also is not clear if you handle TermChars correctly…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(3,172 Views)

Exactly which oscilloscope are you using here?

 

Judging from the function name (do_query_ieee_block), the data is being transferred using a "data block" protocol.  The reply would start with a # followed by a number character that states the number of characters in the length, followed by that number of characters which tells you the number of bytes in the data block, and finally the block of raw data.

 

Here is my code for reading a data block.  The "Query" is just a VISA Write followed by a VISA Read.

 

And here are the contents of the Read Binary:


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
0 Kudos
Message 3 of 11
(3,167 Views)

What model oscilloscope? Have you searched for any LabVIEW "Drivers"?

 

Most modern scopes' Labview driver sets have a VI for retrieving waveforms either as a screen copy (Image) or x/y numeric values.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 11
(3,121 Views)

If you already grabbed the trace as data, you could plot the data on a graph and take grab the graph as a picture.  (There are Vis that can take a snapshot of a control and make a picture out of it.)

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 11
(3,098 Views)

Hi all, 

Thanks for reply. 

I have tried to ideas you gived but I could not make it work well.

It seems the png file has collect hex about header and footer now. 

What should I add more?

 

Best regards.

 

Nimy2022_0-1665476908751.png

Nimy2022_2-1665477061400.png

 

 

 

0 Kudos
Message 6 of 11
(3,030 Views)

My OSC is DSO-X 2004A. I didn't find the vi for screen shot.

0 Kudos
Message 7 of 11
(3,015 Views)

Hi Nimy,

 

why do you convert raw data (U8 array) to string? And why do you delete "0D0A" from your raw data?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 11
(3,009 Views)

Hi GerdW,

 

>why do you convert raw data (U8 array) to string?

That' to delete CRLF...but now it's unnecessary.

 

>why do you delete "0D0A" from your raw data?

That was adjustment for problem which was added unintentional some hexes by binary editor I used, sorry.

But I tried again without "delete CRLF" block, but still not work well.

0 Kudos
Message 9 of 11
(2,986 Views)
Solution
Accepted by topic author Nimy2022

I was able to save a png file to my pc, and here's how to do it.

Thanks for advices.

Nimy2022_1-1665548573614.png

 

I have additional questions, 

- how can I count the picture size in reading?

- "What's this?" block 

 

Best regards,

Nimy 

0 Kudos
Message 10 of 11
(2,955 Views)