Closed changhexuefei closed 1 year ago
Right now JVisa does not have a method to parse a binary block. I think it is easy, I will add it.
Documentation in this discussion: https://github.com/pfroud/JVisa/discussions/10#discussioncomment-5059595
Links to PyVisa functions:
We look forward to your upgrade of the JVisa library
Please post a sample of the data you want to parse. You can use the VISA Test Panel in NI-MAX. I only need to see the beginning of the bytes.
For example, a screenshot from dist:data?
on a Rigol oscilloscope returns
#9001152054BM6\94\11\00\00\00\00\006\00\00\00(\00\00\00\s\03\00...
The following is the data 1: Write Operation (:WAVeform:DATA?)
Return Count: 15 bytes
2: Read Operation Return Count: 1024 bytes
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\ 80\80\80\80\80\80\80\80\80\80\80
I added code on branch add-data-block. I can take a screenshot from my instrument:
byte[] bytes = instrument.queryBinaryBlock("display:data?");
Files.write(Paths.get("screenshot.bmp"), bytes);
Check the programming manual for your instrument about waveform:data?
. For the Rigol DS1000Z series oscilloscope, it says
Before reading the waveform data in the internal memory, you need to judge whether the waveform data can all be read at one time according to the memory depth of the oscilloscope and the maximum number of waveform points that can be read each time.
When using the new method, such an error was reported, "in viRead(): VI_SUCCESS_MAX_CNT: The number of bytes read is equal to count (0x3FFF0006)"
Below is the programming documentation for the instrument I am using.
When this problem occurs, pyvisa handles it as follows:
The VI_SUCCESS_MAX_CNT
status should be handled, see
and
Sorry, I just copied part of the code, now after copying all the code, it can work, thank you
The following is the return value obtained by sending the "waveform data?" command using PyVisa and JVisa, and why they are different. The first picture is the result of pyvisa, and the second picture is the result of JVisa.
I think it is different signed vs unsigned interpretation of byte
primitive. Try this
for (int i = 0; i < bytes.length; i++) {
System.out.println(i + " = " + Byte.toUnsignedInt(bytes[i]));
}
yes,thank you ,I get it
Hi, if the queryBinaryBlock()
method works, can we close this issue?
Yes, we can close this issue.
Is it considered to publish the newly added part as an official version?
Yes, I plan to make an official release with the newly added features
PyVisa uses query_binary_values method to parse blocks of binary data,does JVisa support parsing binary block data?