Code Monkey home page Code Monkey logo

Comments (18)

pfroud avatar pfroud commented on May 30, 2024

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: #10 (comment)

Links to PyVisa functions:

from jvisa.

changhexuefei avatar changhexuefei commented on May 30, 2024

We look forward to your upgrade of the JVisa library

from jvisa.

pfroud avatar pfroud commented on May 30, 2024

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...

from jvisa.

changhexuefei avatar changhexuefei commented on May 30, 2024

The following is the data
1: Write Operation (:WAVeform:DATA?)

Return Count: 15 bytes

2: Read Operation
Return Count: 1024 bytes
#800488251\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80\80
80\80\80\80\80\80\80\80\80\80\80

from jvisa.

pfroud avatar pfroud commented on May 30, 2024

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.

from jvisa.

changhexuefei avatar changhexuefei commented on May 30, 2024

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)"

from jvisa.

changhexuefei avatar changhexuefei commented on May 30, 2024

Below is the programming documentation for the instrument I am using.

4000X-Programming.pdf

from jvisa.

changhexuefei avatar changhexuefei commented on May 30, 2024

When this problem occurs, pyvisa handles it as follows:

image

from jvisa.

pfroud avatar pfroud commented on May 30, 2024

The VI_SUCCESS_MAX_CNT status should be handled, see

JVisaLibrary.VI_SUCCESS_MAX_CNT,

and

if (statusCode != 0 && !SUCCESS_CODES.contains((int)statusCode)) {

from jvisa.

changhexuefei avatar changhexuefei commented on May 30, 2024

Sorry, I just copied part of the code, now after copying all the code, it can work, thank you

from jvisa.

changhexuefei avatar changhexuefei commented on May 30, 2024

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.
image

image

from jvisa.

pfroud avatar pfroud commented on May 30, 2024

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]));
}

from jvisa.

changhexuefei avatar changhexuefei commented on May 30, 2024

yes,thank you ,I get it

from jvisa.

pfroud avatar pfroud commented on May 30, 2024

Hi, if the queryBinaryBlock() method works, can we close this issue?

from jvisa.

changhexuefei avatar changhexuefei commented on May 30, 2024

Yes, we can close this issue.

from jvisa.

changhexuefei avatar changhexuefei commented on May 30, 2024

Is it considered to publish the newly added part as an official version?

from jvisa.

pfroud avatar pfroud commented on May 30, 2024

Yes, I plan to make an official release with the newly added features

from jvisa.

pfroud avatar pfroud commented on May 30, 2024

Released in 2.0.0

from jvisa.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.