Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Where do I find a tutorial/ code samples for GPIB control with Visual Basic?

Using VISA, an IEEE488.1 "get" message can be sent to multiple devices at a time with the following method.  Mind that you must have an INTFC session (equivalent to NI-488.2M board-level session).

' Open INTFC session, then reference to INTFC interface
Dim gpintfc As IGpibIntfc
Set gpintfc = rm.Open("GPIB0::INTFC")   
   
' If needed, send IFC and REN (probably unneeded)
' gpintfc.SendIFC
' gpintfc.ControlREN GPIB_REN_ASSERT

' Send ATN-true command
Dim cmd(0 To 4) As Byte
cmd(0) = &H3F   '
cmd(1) = &H40 + gpintfc.PrimaryAddress
cmd(2) = &H20 + 1
cmd(3) = &H20 + 2
cmd(4) = 8
gpintfc.Command cmd, 5

0 Kudos
Message 31 of 36
(2,675 Views)

Using VISA, an IEEE488.1 "get" message can be sent to multiple devices at a time with the following method.  Mind that you must have an INTFC session (equivalent to NI-488.2M board-level session).

' Open INTFC session, then reference to INTFC interface
Dim gpintfc As IGpibIntfc
Set gpintfc = rm.Open("GPIB0::INTFC")   
   
' If needed, send IFC and REN (probably unneeded)
' gpintfc.SendIFC
' gpintfc.ControlREN GPIB_REN_ASSERT

' Send ATN-true command
Dim cmd(0 To 4) As Byte
cmd(0) = &H3F    '
cmd(1) = &H40 + gpintfc.PrimaryAddress
cmd(2) = &H20 + 1
cmd(3) = &H20 + 2
cmd(4) = 8
gpintfc.Command cmd, 5

0 Kudos
Message 32 of 36
(2,675 Views)
Hi George,

1) a first remark, I would have preferred to send TRIG:SOUR:BUS first
then TRIG but it is not the reason why it does not work for sure so ...
no matter

2) it is not sure that you can manage to do that with visa except if
you know how to make an "interface" session ( a session where you send
messages to the interface address). What is sure is that it is possible
to do it with the GPIB-32 api from ni. With VISA perhaps some guru can
help ?
If you know how to define this interface session then you would have
to:
- define a first voltmeter to listen
- define a second voltmeter to listen
- write the TRIG/INIT/GET commands of the voltmeter to the interface (
defined as address 0 preferably )
- send a GET to the interface ( so simultaneous measurement for the
meters )
- define a first voltmeter to talk
- read the interface
- define a second voltmeter to talk
- read the interface

3) A low-level method is to define an interface address of 0 , then to
send the following low-level commands:

unl
unt
listen 1 ' with an address of 1 for the first voltmeter
listen 2 ' with an address of 2 for the first voltmeter
mta
get ' group executive trigger

Then you can use high level reading (ibread) to get the measurement of
each meter.
I am sure it works and it reduces the phase noise between the two
measurements by a factor of ten so worth the time.

As I program with my own program "labtab" , I cannot give you more
accurate information except to read the "ib" functions manuals "ibsend"
"ibread" "ibwrite" ... of the "NI" api to achieve your goal.

If you want to control the sending of low level gpib commands you can
use a direct dialog tool www.ieee-488.com/ni_gpib0 and see the code in
VBScript or VBA Excel.

If you do not succeed into achieving what you want, I shall do it for
you and let you know since I think have two voltmeters of this type (
34401A ? ) . But I prefer to let you work ;=)

As a matter of fact, learning how to use low-level commands over the
GPIB bus is a good investment since you have the highest flexibility in
programming GPIB ( and power )

4) a last alternative not to difficult is to define TRIG SOUR:EXT on
the second voltmeter and to put a wire on the trig entry of the second
meter coming from the synchro of the first one. This is analog trigger
and is the best in time delay.

Regards,

FG

0 Kudos
Message 33 of 36
(2,650 Views)

Just wondering why .. so many questions on these forurms are not really answered..

This is just an example of such

0 Kudos
Message 34 of 36
(1,811 Views)

@hickock6 wrote:

Just wondering why .. so many questions on these forurms are not really answered..

This is just an example of such


And you decided to ressurect a 7-year old thread because you were bored ??????

0 Kudos
Message 35 of 36
(1,807 Views)

ya ..*chuckle*..

0 Kudos
Message 36 of 36
(1,799 Views)