Communication via GPIB/IEEE488


We again start with a short example, which writes something to the GPIB device with id 7 and reads back a text string:

#include <vflgpib.h> extern "C" bool run() { GPIBDevice d(7); d.write(":fetch?"); CharArray resp =; return true; } For this to work VIMMS must have been compiled with GPIB extension enabled. To do this, when calling the configure script before compilation, specify the option CPPFLAGS='-DVFL_USE_GPIB' and link against the GPIB-library by specifying LDFLAGS='-lgpib -lpthread'. The LINUXGPIB package must have been installed.

Now here is the reference of the GPIBDevice class:

GPIBDevice(int id, int board = 0, int timeout = T3s, int eos = 0x0a)
Constructor of GPIBDevice. id contains the GPIB id of the device that should be accessed. The other options have the following meaning: board is the index of the gpib board, it is 0 when only one gpib interface card exists. timeout is the reading / writing timeout. Default value is 3 seconds. For possible values look in the documentation of the LINUXGPIB package or in the headcer file ib.h. eos is the end of string character.
bool isOk()
This function returns true if initialization was successful.
int getUd()
Returns the device descriptor that can be used for accessing or configuring the device. using the ibxxx functions of the LINUXGPIB package.
bool write(const CharArray& s)
Writes the text string s to the device and returns true if the write was successful.
CharArray read(int maxCount = 0xFFFF);
Reads a text string from the device. Up to maxCount bytes are read.


The Vimms User Manual