Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send ibcmd through Visual Basic 2005?

I am trying to make my life a little easier and automate some verification testing for work. My problem is that the unit I am testing, a Honeywell ADT-222B is only 488.1, and not 488.2 compliant. As such, I guess the handshaking routine used by the device is unique. I can communicate with the instrument and get it to perform properly using ibic.exe; (The interactive control program) however, my aim was to write a small program with Visual Basic 2005 (Express). I have searched for approx 6 hours through the message boards and the NI site itself, but have not had much luck. Here are my problems:
To make the unit actually function correctly, ibcmd must be called and a string of _?@3 must be sent, and then ibwrt can be called with the command for the unit, such as "C2", and the ibcmd must be called again with a "_" sent.
Basically this breaks down to a ibcmd with Untalk, Unlisten, Primary Talker Address, Primary Listener Address, the actual command to be executed and then a  Untalk again. I have tried using ibwrt for this instead, but the unit will then not respond.
As for the Visual Basic part, I have to admit I am lost as to what object, property or method I have to use in the National Instruments/NI488.2 heirarchy, or if that is even the Reference I should have added to my project.
 
So here is my plea,
Help Obi-Wan GPIB-Expert VB2005-Expert, I need your help!
 
Respectfully,
James K
0 Kudos
Message 1 of 9
(5,310 Views)
 

Hi James,

 

You can find Visual Basic examples that are installed with the NI-488.2 drivers in the following directory:

C:\Documents and Settings\All Users\Documents\National Instruments\NI-488.2\Languages\Visual Basic

Since this application may require some advanced programming, you may want to consider contacting an alliance member. The NI Partner Program is a network of more than 600 consultants, system integrators, developers, channel partners, and industry experts partnering with NI to provide complete, high-quality virtual instrumentation solutions to customers.

Regards,

Rima

Rima H.
Web Product Manager
0 Kudos
Message 2 of 9
(5,263 Views)

Hi James,

You can also use the NI-488.2 .NET Framework 2.0 Help, which is located in the same directory as the NI-488.2 Help.  Once the NI Measurement Studio Help is open, navigate in the tree on the left-hand side to NI Measurement Studio Help >> NI Measurement Studio .NET Class Library.  Then you can navigate to either Reference or Using the Measurement Studio .NET Class Libraries to find additional help for the NI-488.2 .NET Library.  Good luck!

Regards,

Rima

Rima H.
Web Product Manager
0 Kudos
Message 3 of 9
(5,256 Views)

Rima,

 

Thank you for the reply and the help. All of the code examples I have seen in those places have been either, VB6 or VB .net using 488.2 commands. I unfortunately seem to be stuck in between. I am trying to use a 488.1 board level command in VB .net. I am trying to find out how to replicate the following in VB .net;

ibfind "gpib0"

ibsic

ibcmd "_?@#"

ibwrt "C2"

ibcmd "_"

I thought this would be easier, but I guess I am stuck going to another language or employing someone from the group you mentioned.

 

Respectfully,

James

0 Kudos
Message 4 of 9
(5,235 Views)

Hi James,

The 488.1 standard defines the hardware, and not the syntax, so you should reference the manual of the Honeywell device to find the proper commands and termination character.  The NI-488.2 driver is backwards compatible with the NI-488.1 language interface.  Good luck!

Regards,

Rima

Rima H.
Web Product Manager
0 Kudos
Message 5 of 9
(5,200 Views)

Rima,

 

Absolutely! Hits the nail right on the head. That is why I am so focused on the ibcmd command. The handshaking for this unit by the manual, and by my tinkering around requires the steps from my former post, (ibcmd with Untalk, Unlisten, the MTA, and MLA and then a ibwrt with the actual command ( for example "C2" ) and then another ibcmd with an "_" )to make the unit actually do anything via GPIB. These units were made around early 1970 and as such are only 488.1 compliant. Honeywell made up their own handshaking and syntax. Only the later "C" models of these units are capable of understanding 488.2 commands.



Message Edited by shard923 on 12-19-2007 04:18 PM
0 Kudos
Message 6 of 9
(5,196 Views)

Hi James,

I'm curious how your application is going, have been able to code successfully in VB.net?  If you are able to control your device from ibic, you should be able to control it by calling those same commands you used in ibic, but from a VB program. Let me know how things are going.

Ted



Message Edited by Ted H on 12-20-2007 12:28 PM
Ted H
Applications Engineering
National Instruments
0 Kudos
Message 7 of 9
(5,168 Views)

Ted,

 

Not well. I can indeed get my unit(s) to respond through ibic.exe, but still have not been able to find the equivalent commands in VB.net. I have tried instantiating(sp) an object as a 'board', sending a command to set the ATN line high, and then use a board.Write to send the command, but it does not seem to work. I cannot find what the equivalent command of ibcmd is in .Net. In fact I have just tried to code the same in C++, but I am running into different roadblocks in that direction. (compiler errors, differences between Microsoft C++ and regular C++)

 

James



Message Edited by shard923 on 12-20-2007 12:26 PM

Message Edited by shard923 on 12-20-2007 12:27 PM
0 Kudos
Message 8 of 9
(5,162 Views)

Hi James,

Unfortunately, there is no easy way to program ibic commands such as ibcmd with VB.net.  The most transparent way to do this is to use the gpib-32.dll (installed with NI-488.2).  The gpib-32.dll, located at C:\WINDOWS\system32, contains all of the ibic commands, and are implemented as explained in the NI-488.2 help file.

Here is a link to a vb project on the NI webiste which uses the GPIB-32.dll to make ibcmd function calls.  I hope this helps.

Regards,

Ted

Ted H
Applications Engineering
National Instruments
0 Kudos
Message 9 of 9
(5,128 Views)