Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

JavaScript GPIB Communication using a COM ActiveXObject

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?

0 Kudos
Message 1 of 8
(7,331 Views)

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?

Douglas Choisnet
0 Kudos
Message 2 of 8
(7,305 Views)

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.

 

 

 

0 Kudos
Message 3 of 8
(7,294 Views)

@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?

0 Kudos
Message 4 of 8
(7,286 Views)

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.

0 Kudos
Message 5 of 8
(7,276 Views)

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

http://forums.ni.com/t5/Instrument-Control-GPIB-Serial/Is-there-an-OCX-for-accessing-the-GPIB-interf...

 

 

0 Kudos
Message 6 of 8
(7,272 Views)

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?

0 Kudos
Message 7 of 8
(7,267 Views)

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

 

0 Kudos
Message 8 of 8
(7,263 Views)