02-12-2016 06:35 AM - edited 02-12-2016 06:52 AM
Hello,
I'm currently trying to read the curve from the scope. I'm using Labwindows (C), and the VISA Library to do so. The scope is connected via Ethernet.
So far, I have successfully read the curve while in ASCII Mode (with 1 byte/2 bytes.), and in Binary Mode (1 byte). I've a problem reading in Binary mode with 2 Byte.
When I use the ASCII Mode, here is my code:
status = viWrite(instr, "DATa:SOUrce CH1", 16, &retCount); status = viWrite(instr, "DATa:STARt 1", 13, &retCount); status = viWrite(instr, "DATa:STOP 10000", 16, &retCount); status = viWrite(instr, "DATa:ENCdg ASCIi", 17, &retCount); status = viWrite(instr, "DATa:WIDth 2", 13, &retCount); status = viWrite(instr, "HEADer 1", 9, &retCount); status = viWrite(instr, "VERBose", 8, &retCount); status = viWrite(instr, "WFMOutpre?", 11, &retCount); status = viRead(instr, buffer_parameter, COUNT, &retCount); status = viWrite(instr, ":HEADer 0", 10, &retCount); status = viWrite(instr, "WFMOutpre:YMULT?", 16, &retCount); status = viRead(instr, buffer_ymult, COUNT, &retCount); status = viWrite(instr, "WFMOutpre:YZERO?", 16, &retCount); status = viRead(instr, buffer_yzero, COUNT, &retCount); status = viWrite(instr, "WFMOutpre:YOFF?", 15, &retCount); status = viRead(instr, buffer_yoff, COUNT, &retCount); status = viWrite(instr, "WFMOutpre:XINCR?", 16, &retCount); status = viRead(instr, buffer_xincr, COUNT, &retCount); status = viWrite(instr, ":CURVe?", 8, &retCount); status = viRead(instr, wave, NOMBRE_DATA, &retCount);
And I have in "wave" what I expect (a char with data, that I can transform in an array of integer, and then I do the conversion in Volt and everything is fine, with both 1 and 2 byte (change by the command DATa:WIDth 2).
In BInary, I change the DATa:ENCDg and the DATa:WIDth:
status = viWrite(instr, "DATa:ENCdg RIBinary", 20, &retCount);
status = viWrite(instr, "DATa:WIDth 2", 13, &retCount);
With 1 byte, this works. With 2 bytes, it transfer a first part, and I do not have the rest. For example, with 1 byte, wave is a char 10008 long., but in 2 bytes, it is a char whose length varies beetween 300 and 2000, instead of 20008. However, retCount is 20008. The problem is that the length of the char varies ! So it's not the size of NOMBRE_DATA that is the problem ( which is 700 000 by the way).
Here is an example of what I have in wave with 2 bytes:
http://img15.hostingpics.net/pics/174458test1.png
http://img15.hostingpics.net/pics/755368test2.png
My opinion is: the binary is weirdly interpreted by Labwindows in some char, and somewhere it transforms it into an "end of line" and end the char.
Both thoses guy seems to have the same problem:
http://www1.tek.com/forum/viewtopic.php?f=5&t=5905&p=11377&hilit=transfer+curve#p11377
http://www1.tek.com/forum/viewtopic.php?f=5&t=6209&p=12297&hilit=2+byte+data#p12297
Any clue, idea ?
Also, jsute done before, but I posted the same topic on Tektronik forum:
http://www1.tek.com/forum/viewtopic.php?f=5&t=6733
NB: I don't know why, but when I try to post DATa : ENCdg RIBinary, it transforms itself into
DATa:ENCdg RIBinary
02-12-2016 09:05 AM
02-12-2016 09:35 AM
When I do that procedure:
http://digital.ni.com/public.nsf/allkb/8202E71D2A1A718D862564D7007B44A7
The first one (Termination character Enable) works.
However, still not the full data, and the second option "Serial End Mode for Reads" does not work since I control the scope by ethernet.
Idea on how to choose the end mode for visa with ethernet ?
Thank you,
Melponeme.