06-29-2018 04:58 AM - edited 06-29-2018 05:01 AM
Good day, I use a Labview to communicate with an oscilloscope Rigol. This device use SCPI (Standard Commands for Programmable Instruments) commands and the program in the Labview is based on VISA (Virtual Instrument Software Architecture). I need to use the command ”: DISPlay: DATA?”. After its use the following data comes back: TMC Blockheader (TMC Blockheader ::= #NXXXXXX is used to describe the length of the data stream. Wherein, # is the start denoter of the data stream; N is less than or equal to 9 and the N figures following it denote the length of the data stream in bytes. For example, #9001152054; wherein, N is 9 and 001152054 denotes that the data stream contains 1152054 bytes of effective data.) and Specific image data (BMP24 as example). In programming guide of this device there is an example of use this command:
I want to save the received data as an image, but have some problems. I tried to use “Write To Spreadsheet File VI” and save as BMP, but I could not open the file. I tried to use “Write BMP File VI”, but this function requires an input “image data”.
In the end, tell me please how I can convert “string data” to “image data” or other solutions of my problem?
Thank you.
Solved! Go to Solution.
06-29-2018 10:51 AM - edited 06-29-2018 10:52 AM
Which scope are you using? You can find a bunch of drivers here. My preferred method would be to get the data as waveform data, and then save an image of the graph in LabVIEW if you really want an image.
*Edit: also, great question asking skills!
06-30-2018 12:17 AM
Hello Alexdmk,
You need to use Write BMP file.vi to save the image as BMP file, Write To Spreadsheet File VI will save the data in tabular format in file which can be opened as a text file and not BMP file. In case if you have the image data then upload it so the I can check how to save it.
06-30-2018 06:57 AM
07-02-2018 05:37 AM
Thank you. My device is DS1054Z, I'll look at the information about the driver of other oscilloscopes. I understand, that it is better to work with waveform data, but now I need to have a picture of the oscilloscope screen.
07-02-2018 06:08 AM
Having reread more carefully, you should definitely go with gregoryj's suggestion. This driver might help you out: RIGOL DS1000 Series Oscilloscope.
Once you have the waveform data, you can reconstruct the image on the screen.
If you really want the display, then probably you can take a look at either the Draw Flattened Pixmap (using a Create > Constant for the image data, then Bundle By Name to fill the approriate fields) or perhaps more straightforwardly (but I haven't previously tried) Draw Unflattened Pixmap, which takes a 2D array of data values. If you're getting a string, you'll need to convert to the numeric values - String to Byte Array might be your friend here.
If you upload an example string (perhaps as a text file) I can try and figure out the appropriate handling, without it becoming a lot of back and forth guesswork 🙂 However, I would still suggest the driver and waveform 🙂
07-02-2018 06:37 AM - edited 07-02-2018 06:38 AM
Hello Alex,
I think there is more to do than just saving the stream. Can you explain what exactly ist meant by "a standard image data stream" at point 2? I doubt it is a binary stream of bmp- data, because point 3 states, the stream is terminated by 0xA, and this single binary value is very likely present in the binary representation of a rasterized image.
So you should find out what kind of data is sent by the device (very likely ASCII- coded data, perhaps like Base-64).
07-02-2018 07:12 AM
Does your output looks like this?
If so then upload the data file you ahve created.
07-02-2018 08:02 AM
Dear kartiknattar, I used string as indicator, display style - "Backslash (\) Codes", in the display received the following values:
#9001152054BM6\94\11\00\00\00\00\006\00\00\00(\00\00\00\s\03\00\00\E0\01\00\00\01\00\18\00\00\00\00\00\00\00\00\00\CA\b\00\00\CA\b\00\00\00\00\00\00\00\00\00\00\00$\s\00$\s\1088\00$\s\00$\s\00$\s\00$\s\1088\00$\s\00$\s\00$\s\00$\s\1088
and so on.
How to save data in this format and what to do with them further?
07-02-2018 08:23 AM
Can you save the entire data in a .txt file and upload it as I think you need to split the data and type cast it and then merge the 3 different layers to create a single image.