I was exactly looking for a project like yours to control my Rigol scope from Java, so thanks for sharing it ! :-)
However, I'm stuck for hours trying to initialize (!) the library without success, so I thought I'd post a few questions.
First, my setup:
Rigol uses Native Instruments, so that's the Visa DLL installed on my setup, along with all their bloatware. I can succesfully use it with pyvisa - http://pyvisa.readthedocs.org/
I'm using IntelliJ Idea instead of Netbeans, but as long as I can build your classes and run them, that shouldn't matter I guess
My lab PC OS is Win7 32b...
(Well, I guess all of the above points are different from your setup :-))
First, one thing I'm not sure is when you say "use JOscilloscope for oscilloscopes, and JVisa for other instruments".
Does that mean that the JOscilloscope project is an alternative way to access equipments, or that JOscilloscope duplicates only the JVisa code relevant for scopes, or that it depends builds upon the JVisa project that must be build beforehand ? Anyway, I started with JVisa thinking it would be simpler.
Second, I started with the lower levels, using your jvisa.JVisaNGTest class, and particularly the setupClass() method which calls instance.openDefaultResourceManager().
After having copied Native Instrument's visa32.dll from c:\windows\system32 and put it in the classpath as win32-x86/visa.dll, the VisaLibrary.INSTANCE.viOpenDefaultRM(pViSession) call succeeded.
However, the visaStatus object it returns is "Proxy interface to native function@0xbfff009e (visa.VisaLibrary$ViStatus)" so we're getting a callback address while the code seems to expect a null response, making the assertion fail.
Do you think this is due to a difference between Tek and NI's libraries? Any idea if this is a severe issue or if it can be ignored ?
Any help or comment is welcome.
Kind regards,
Vicne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Vicne,
first, which version are you using? The older JVisaOscilloscope version had bugs related to receiving binary and string data correctly.
Second, the newest version of JVisa and JVisaOscilloscope work but only for 64-bit Windows. I have stopped supporting 32-bit Windows.
Third, JVisa is the basic library for any VISA instrument. JVisaOscilloscope uses it and implements oscilloscope related functions such as acquire waveform. So, yes it depends on JVisa.
Fourth, JVisa expects NULL for success, otherwise it extracts the error code from the status toString function. (I tried hard but couldn't find any other way.) Such, your visa.dll returns error 0xbfff009e to the call to resource manager and not, as you state, success. (The callback function is actually only an integer. I think the JNA tool made a mistake there in the C header translation.) You can find the error description in visa.h or call the get error description function.
Fifth, I am glad to help. I'll look up the error code tomorrow and also look at the code and build configuration. The problem could be lying in the JNA tool (and not in a difference between NI and TekVisa DLL). Before I had fixed all bugs I abandoned 32-bit and might not have created a working JnaVisa32.jar. But I can help you creating one yourself (where to download jnaerator and how to run it).
By the way, here at Colorado School of Mines our data acquisition software JSeisLab is running on several computers (64-bit Windows with TekVisa) using JVisa and JVisaOscilloscope (that drives a TDS3000 scope).
I could not get registering the error handler / callback function to work using viInstallHandler.
(A null value for success is obvious. The DLL will not call a registered error handler when the status was success.)
I think the problem you are seeing is because either one or more of the jars in your project are 64 bit,
or NiVisa needs another library that is not in your class path. Maybe you could try the visa DLL from Tektronix.
Just register on their website and download TekVISA_404.exe.
I have attached the command lines that generate JnaVisa32.jar and JnaVisa64.jar for your reference.
Finally regarding thanking me for having posted JVisa as Open Source: You are most welcome.
Exploring the best countries to move to from the USA can be daunting yet exciting. Factors like quality of life, healthcare, and job opportunities play pivotal roles. Whether you seek European charm, Asian dynamism, or Latin American warmth, choices abound. Websites like Govisafree offer detailed insights on popular destinations, aiding in informed decisions. From Canada's friendly embrace to New Zealand's scenic beauty, each country offers unique perks, ensuring a smooth transition. Plan your move wisely with expert guidance at https://govisafree.com/best-countries-to-move-to-from-usa/.
Last edit: Muhammad Amirr 2024-07-01
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Please refrain from posting comments about immigration visas. This software library supports driving an oscilloscope using Virtual Instrument Software Architecture (VISA). It has nothing to do with a issuing a visa.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I was exactly looking for a project like yours to control my Rigol scope from Java, so thanks for sharing it ! :-)
However, I'm stuck for hours trying to initialize (!) the library without success, so I thought I'd post a few questions.
First, my setup:
(Well, I guess all of the above points are different from your setup :-))
First, one thing I'm not sure is when you say "use JOscilloscope for oscilloscopes, and JVisa for other instruments".
Does that mean that the JOscilloscope project is an alternative way to access equipments, or that JOscilloscope duplicates only the JVisa code relevant for scopes, or that it depends builds upon the JVisa project that must be build beforehand ? Anyway, I started with JVisa thinking it would be simpler.
Second, I started with the lower levels, using your jvisa.JVisaNGTest class, and particularly the setupClass() method which calls instance.openDefaultResourceManager().
After having copied Native Instrument's visa32.dll from c:\windows\system32 and put it in the classpath as win32-x86/visa.dll, the VisaLibrary.INSTANCE.viOpenDefaultRM(pViSession) call succeeded.
However, the visaStatus object it returns is "Proxy interface to native function@0xbfff009e (visa.VisaLibrary$ViStatus)" so we're getting a callback address while the code seems to expect a null response, making the assertion fail.
Do you think this is due to a difference between Tek and NI's libraries? Any idea if this is a severe issue or if it can be ignored ?
Any help or comment is welcome.
Kind regards,
Vicne
Hi Vicne,
first, which version are you using? The older JVisaOscilloscope version had bugs related to receiving binary and string data correctly.
Second, the newest version of JVisa and JVisaOscilloscope work but only for 64-bit Windows. I have stopped supporting 32-bit Windows.
Third, JVisa is the basic library for any VISA instrument. JVisaOscilloscope uses it and implements oscilloscope related functions such as acquire waveform. So, yes it depends on JVisa.
Fourth, JVisa expects NULL for success, otherwise it extracts the error code from the status toString function. (I tried hard but couldn't find any other way.) Such, your visa.dll returns error 0xbfff009e to the call to resource manager and not, as you state, success. (The callback function is actually only an integer. I think the JNA tool made a mistake there in the C header translation.) You can find the error description in visa.h or call the get error description function.
Fifth, I am glad to help. I'll look up the error code tomorrow and also look at the code and build configuration. The problem could be lying in the JNA tool (and not in a difference between NI and TekVisa DLL). Before I had fixed all bugs I abandoned 32-bit and might not have created a working JnaVisa32.jar. But I can help you creating one yourself (where to download jnaerator and how to run it).
By the way, here at Colorado School of Mines our data acquisition software JSeisLab is running on several computers (64-bit Windows with TekVisa) using JVisa and JVisaOscilloscope (that drives a TDS3000 scope).
Best wishes,
Guenter
The error is listed in visa.h as
By the way, Jnaerator did not make a mistake when translating visa.h. ViStatus
is defined as a callback function:
I could not get registering the error handler / callback function to work using viInstallHandler.
(A null value for success is obvious. The DLL will not call a registered error handler when the status was success.)
I think the problem you are seeing is because either one or more of the jars in your project are 64 bit,
or NiVisa needs another library that is not in your class path. Maybe you could try the visa DLL from Tektronix.
Just register on their website and download TekVISA_404.exe.
I have attached the command lines that generate JnaVisa32.jar and JnaVisa64.jar for your reference.
Finally regarding thanking me for having posted JVisa as Open Source: You are most welcome.
Exploring the best countries to move to from the USA can be daunting yet exciting. Factors like quality of life, healthcare, and job opportunities play pivotal roles. Whether you seek European charm, Asian dynamism, or Latin American warmth, choices abound. Websites like Govisafree offer detailed insights on popular destinations, aiding in informed decisions. From Canada's friendly embrace to New Zealand's scenic beauty, each country offers unique perks, ensuring a smooth transition. Plan your move wisely with expert guidance at https://govisafree.com/best-countries-to-move-to-from-usa/.
Last edit: Muhammad Amirr 2024-07-01
Hi Muhammad,
Please refrain from posting comments about immigration visas. This software library supports driving an oscilloscope using Virtual Instrument Software Architecture (VISA). It has nothing to do with a issuing a visa.