Hello,
I have a MSO7104A device that I control with LAN. I would like to transfer print screen from oscilloscope to my local computer by LAN connection.
I use the VISA api to read/write data by C/C++ (tekVisa). Until now, I have not been able to find relevent commands to perform the transfer. There is an interesting note "How To Save and Transfer a Screenshot from the 5 or 6 Series MSO" dedicated to the MSO 5 and 6. But I have the 7 I guess. Is there an equivalent note for my oscilloscope. Indeed, the SCPI commands are different and I was not able to use the same commands and to find the corresponding one in the MSO7104A documentation.
Is it possible to perform such a transfer and how ? Is there an existing piece of code ? I look for the way to read screen - by LAN.
I tried the example in the documentation.
With no success, i tried :
/* IMAGE_TRANSFER - In this example we will query for the image
* data with ":DISPLAY:DATA?" to read the data and save the data
* to the file "image.dat" which you can then send to a printer.
*/
viSetAttribute(vi, VI_ATTR_TMO_VALUE, 30000);
printf("Transferring image to c:\\scope\\data\\screen.bmp\n");
img_size = IMG_SIZE;
viQueryf(vi, ":DISPLAY:DATA? BMP8bit, SCREEN, COLOR\n", "%#b\n",
&img_size, image_data);
printf("Read display data query (%d bytes).\n", img_size);
/* Write image data to file. */
fp = fopen ("c:\\scope\\data\\screen.bmp", "wb");
img_size = fwrite(image_data, sizeof(unsigned char), img_size, fp);
fclose (fp);
printf("Wrote image data (%d bytes) to file.\n", img_size);
viSetAttribute(vi, VI_ATTR_TMO_VALUE, 5000);
With that, I have a file with data but when i try to open it, data format seems to be not correct and viewer displays an error. Is there a trick ? Then oscilloscope displays a remote action (the print screen) and freezes. It is strange.
Thanks.
Best regards.
Your effective code worked fine with the Visa Driver that comes with the Keysight IO Libraries Suite (I did have to change to "unsigned char image_data[IMG_SIZE];"). I have the Keysight Visa driver installed as the secondary, and the NI Visa driver is installed as the primary.
With the "Interactive IO" application that comes with the IO Libraries Suite, you can send and read individual SCPI commands to see how they work. I verified the "Remote Command Running" message appears as soon as you send the :DISPlay:DATA? query, not after a timeout.
Another thing that's useful in isolating problems is the "IO Monitor" application, included with the IO Libraries Suite, that lets you capture VISA messages as remote programs run.
Best Regards,
Pat