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.

TekVISA C++ x86 vs x64: issue when reading waveform data

OpenChoice TekVISA
Post Reply
fabienteulieres
Posts: 2
Joined: October 19th, 2018, 6:52 pm
Country: United States

TekVISA C++ x86 vs x64: issue when reading waveform data

Post by fabienteulieres » October 19th, 2018, 8:22 pm

Hello TekVISA support,

I'm experiencing the following issue in my C++ code when I run it in x64 (the same code works fine in x86). My C++ code is querying the waveform on a TBS1052B oscilloscope. I'm using Visual Studio 2017 on a Windows 10 machine. I'm communicating with the scope via the USB driver. I'm using TekVISA 4.1.1. with the C++ API (visa.h and visa64.lib).

For some reason, the data I get from the "viQueryf" call is correct in x86 (I do get a byte array corresponding to the waveform displayed on the scope's screen). However, when running the same exact code in x64, I cannot get any data that makes sense. My hunch is that I may not be querying the data with the right format, or there is an issue with the padding, or I should query the data using a different "byte width". But I'm not really sure and all my trials have failed so far on x64.

The strange thing is that the "viQueryf" does not return an error code. It just returns an array of bytes that is not set to anything.

Here's my code (once again, working fine in x86, but not running in x64 when querying the waveform data bytes) (I'm not showing the initial scope handshake)

Code: Select all

   float xincr = 0.0;
   float xzero = 0.0;

   float ymult = 0.0;
   float yoffset = 0.0;
   float yzero = 0.0;

   ViInt32 data_capture_size = 0;
   
   const long MAX_DATA_PTS = 2500;
   ViByte b_data[2500];
   ViInt8 i8_data[MAX_DATA_PTS];

   /* Here, I already have a valid vi session handler */

   status = viWrite(vi, (ViBuf) "DATA:SOU CH2\r\n", 14, &retCnt); // Channel 2
   if (status < VI_SUCCESS) goto error;

   status = viWrite(vi, (ViBuf) "DATA:WIDTH 1\r\n", 14, &retCnt); // Width of data retrieval: 1 byte
   if (status < VI_SUCCESS) goto error;

   status = viWrite(vi, (ViBuf) "DATA:ENC RPB\r\n", 14, &retCnt);
   if (status < VI_SUCCESS) goto error;

   status = viQueryf(vi, (ViString) "WFMPRE:XINCR?\r\n", (ViString) "%f", &xincr);
   if (status < VI_SUCCESS) goto error;

   status = viQueryf(vi, (ViString) "WFMPRE:XZERO?\r\n", (ViString) "%f", &xzero);
   if (status < VI_SUCCESS) goto error;

   status = viQueryf(vi, (ViString) "WFMPRE:YMULT?\r\n", (ViString) "%f", &ymult);
   if (status < VI_SUCCESS) goto error;

   status = viQueryf(vi, (ViString) "WFMPRE:YOFF?\r\n", (ViString) "%f", &yoffset);
   if (status < VI_SUCCESS) goto error;

   status = viQueryf(vi, (ViString) "WFMPRE:YZERO?\r\n", (ViString) "%f", &yzero);
   if (status < VI_SUCCESS) goto error;

   // *** Waveform data query ***

   // Get record length value
   status = viQueryf(vi, (ViString)"hor:reco?\n", (ViString)"%ld", &data_capture_size);
   if (status < VI_SUCCESS) goto error;

   status = viQueryf(vi, (ViString) "CURVE?\n", (ViString) "%b", b_data); // Works in x86 - NOT in x64! Why???
   if (status < VI_SUCCESS) goto error;

   status = viQueryf(vi, (ViString) "CURVE?\n", (ViString) "%b", i8_data); // Works in x86 - NOT in x64! Why???
   if (status < VI_SUCCESS) goto error;
If anyone can explain to me why my "viQueryf ("CURVE?\n")" calls do not work in x64, I'd really appreciate it!

Thanks.

Post Reply

Return to “TekVISA”

Who is online

Users browsing this forum: No registered users and 1 guest