controlling GPIB from VBA
controlling GPIB from VBA
(OP)
Anyone able to give me some insight on how to controll a GPIB device via VBA. How do I Address, open, listen and talk through the port?
Todd
Todd
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS Come Join Us!Are you an
Engineering professional? Join Eng-Tips Forums!
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting GuidelinesJobs |
|
RE: controlling GPIB from VBA
RE: controlling GPIB from VBA
2. I found the NIGLOBAL.BAS and VBIB-32.BAS and imported them as modules. But the example files do not work with VBE. How can I find out more about calling the functions in the module? This is a first time for me trying to call and run modules.
Todd
RE: controlling GPIB from VBA
I'm not sure exactly what you have to do, but controlling instruments from VBA usually involves only a few command calls. Here's some code that I have used recently to extract
measurements from a Yokogawa WT1600 power analyzer:
YokoAddr = 5 ' GPIB address of WT1600
bdIndx = 0 ' GPIB board index#
Call ibdev(bdIndx, YokoAddr, 0, T10s, 1, 0, ud%) 'Open and initialize
EL1volt = "NUMERIC:NORMAL:VALUE? 1" 'Yokogawa command string
Data = Space$(20) 'define string length
Call ibwrt(ud%, EL1volt) 'send command string
Call ibrd(ud%, Data) 'read data from a device into a user buffer
In this case, I am just providing the initialization of the communication parameters, and sending the Yokogawa command string to tell it I need a voltage reading, and then reading the value back and placing it in a variable.
National Instruments generally has excellent documentation, and non-NI cards should have similar command calls, but you'll have to obtain the correct language interface code modules.
Hope this helps.
Mike