Comparison Between NI-VISA and NI-488.2 APIs
For GPIB users who are familiar with NI-488.2, the following table shows several common, but not all, NI-488.2 device-level function calls and the corresponding VISA operations. As you can see, the APIs are almost identical. The difference is that VISA is extensible to additional hardware interfaces. Therefore, if you are programming multiple devices that communicate over more than one bus type, it might be easier to use VISA for your entire system.
NI-VISA and NI-488.2 Functions and Operations
C NI-488.2 Device Function | C VISA INSTR Operation | LabVIEW NI-488.2 Device Function | LabVIEW VISA INSTR Operation |
---|---|---|---|
ibdev | viOpen | <no equivalent> | VISA Open |
ibonl | viClose | <no equivalent> | VISA Close |
ibwrt | viWrite | GPIB Write | VISA Write |
ibrd | viRead | GPIB Read | VISA Read |
ibclr | viClear | GPIB Clear | VISA Clear |
ibtrg | viAssertTrigger | GPIB Trigger | VISA Assert Trigger |
ibrsp | viReadSTB | GPIB Serial Poll | VISA Read STB |
ibwait | viWaitOnEvent | Wait for GPIB RQS | Wait for RQS |
ibconfig | viSetAttribute | GPIB Initialization | VISA Property Node |
One difference in the event mechanism between NI-488.2 and VISA is worth noting. In VISA, you must always call viEnableEvent() prior to being allowed to receive events. While this was not the case with NI-488.2, this is required in VISA to avoid the race condition of trying to wait on events for which the hardware may not be enabled. Thus, you should enable the session for events not just immediately before calling viWaitOnEvent(), but before the device has even been triggered or configured to generate a service request event.