04-07-2014 05:39 AM
Is there a way to preform GPIB communication using JavaScript? Perhaps by creating an "NiVisaCom" object?
There are about 20 different progid's for the NI VISA VXIPNP dll registered on my computer after installing the GPIB drivers, however all of these seem to return an empty object when created using "new ActiveXObject()"
Looking at the documentation I would think this would work:
gpib = new ActiveXObject("NiVisaCom.NIGpibIntfc");
gpib.viOpenDefaultRM(session);
The first line "works" but returns an empty object. The second line throws an error.
Another route would be to create an html page with an <object> tag with the CLSID assigned to match the progid, but this has not worked for me either.
Has anyone had luck with GPIB in JavaScript?
04-08-2014 11:45 AM
Hi EE_Steve,
From quickly looking at your code, I am wondering if this is the correct syntax.
By searching "viOpenDefaultRM" in this article, I dont see your syntax lining up with the ones shown there.
Also, you said that you were receiving an error, could you give more information to us on the error youre seeing and possibly some screenshots so we can understand what you're going through?
04-09-2014 06:58 AM
Thanks for your reply. I don't see a JavaScript example in that document. Perhaps you could point me to it?
The C code example there uses the visa.h header file which is not available in JavaScript. There it would also need the visa lib files added to the linker. Do you know of a way to do this in JavaScript?
The problem I have is that no methods are associated with the object after creating it using new ActiveXObject. JavaScript debuggers show it as empty. If I create a FileSystemObject the same way it shows all of the associated methods and properties.
04-09-2014 09:10 AM - edited 04-09-2014 09:13 AM
@EE_Steve wrote:
The problem I have is that no methods are associated with the object after creating it using new ActiveXObject.
What documentation have you seen that makes you believe that NiVisaCom.NIGpibIntfc returns an ActiveXObject?
04-09-2014 10:22 AM
I have not read any documentation that suggests that this is possible. Perhaps my initial question was not well formed. I am hoping that someone can point me to documentation, or otherwise explain, how to connect to a GPIB COM object using JavaScript.
04-09-2014 11:24 AM
@EE_Steve wrote:
I have not read any documentation that suggests that this is possible. Perhaps my initial question was not well formed. I am hoping that someone can point me to documentation, or otherwise explain, how to connect to a GPIB COM object using JavaScript.
You might to take a look at Measurement Studio. It isn't free however.
04-09-2014 11:54 AM
Thanks! That is a good thread.
I will take a look at the demo version of Measurement Studio to evaluate the possibility of using it.
Unfortunately we do not have Measurement Studio installed on our test platform, and would like to avoid additional software at this point in development. Is there a way to do this with just the simple 488.1 driver that comes with MAX?
04-09-2014 12:34 PM - edited 04-09-2014 12:35 PM
@EE_Steve wrote:
Thanks! That is a good thread.
I will take a look at the demo version of Measurement Studio to evaluate the possibility of using it.
Unfortunately we do not have Measurement Studio installed on our test platform, and would like to avoid additional software at this point in development. Is there a way to do this with just the simple 488.1 driver that comes with MAX?
With Javascript, I don't know, but I doubt it. I don't know of anyone using Javascript. That's used mainly for websites.
You might want to look to using Python or the free Visual Studio Express if cost is a concern.