07-28-2011 06:03 PM
I was wondering if it is actually possible to issue simple commands accross the GPIB bus via the rundll32.exe option in a command prompt window. Ultimately what I am trying to accomplish is to issue generic GPIB commands via VBScript, however after searching high and low I have come to the conclusion that this not a simple function call type procedure. So my workaround is to use a command prompt to call rundll32 and use the gpib-32.dll library to issue my commands.
rundll32.exe gpib-32.dll,ibwrt <arguments>
When using the NI spy and calling this line without any arguments, the bus does recognize that an ibwrt command came across, however it does not have any argument values (obviously). However, I can find no syntactical way of specifying the arguments that I want that causes the bus to process them correctly. All of my write commands result in this:
Can someone point me in a general direction or explain to me what I might be doing wrong? Or if possible, is there a simpler way of issuing GPIB via VBScript that I am just not aware of? Any help is greatly appreciated.
08-10-2011 08:26 PM
I believe your attempt is impossible. Any DLL functions that can be invoked through rundll32 must be a specific function prototype as described in the following syntax. There is no such function in gpib-32.dll that matches with the syntax.
void _stdcall EntryPoint(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);
See the MS document - http://support.microsoft.com/kb/164787/en-us
If you want to control GPIB from inside VB script, you should try using ActiveX (.OCX) version of GPIB DLL. I think it is available as a part of NI Measurement Studio. Other approaches are, 1)Use VISA COM DLL through the "Script Adapter" wrapper, or 2)Create your own COM DLL that supports IDispatch interfaces wrapping NI gpib-32.dll. The DLLs that can be invoked from VB Script are IDispatch-based COM DLLs.
As for Script Adapter, see http://paulhollingsworth.com/Articles/ScriptAdapte