Hello,
I am implementing an EPICS IOC to control a device connected via GPIB to an Keysight E5810 LAN/GPIB Gateway. Therefore I am using devGPIB of the asyn module and connect to the gateway over LAN via the VXI11 Protocol.
I am able to send simple commands to the device. However, for a measurement routine a more complex protocol is required by the device. This includes not only sending and receiving binary data but also reading out the status byte (VXI: “Word
Serial Read STB”) and sending a trigger (VXI: “Word Serial Trigger”).
Therefore I have chosen a GPIBCVTIO command with a custom convert function that takes care of all I/O that the protocol requires. However I cannot figure out how to read the STB and trigger the device.
Below is a draft of the custom I/O function with the missing parts.
How can I get the STB and do Serial Triggering?
Thanks in advance for your help,
Philipp
/* file XXXSup/devXXX.c */
//...
static int measurement(struct gpibDpvt *pgpibDpvt, int P1, int P2, char **P3) {
size_t count = 0;
// initiate measurement by sending single byte "\x17"
asynStatus status = pgpibDpvt->pasynOctet->write(
pgpibDpvt->asynOctetPvt, pgpibDpvt->pasynUser,
"\x17", 1, &count);
// TODO: check that STB equals 0xA to continue (device will not raise SRQ)
// TODO: start measurement by triggering the device (Serial Trigger)
// TODO: check STB:
// 0x8 --> measurement completed, data ready
// 0x2 --> error occurred, abort
// TODO: initiate data sending by triggering the device again
// read data (128 bytes)
char buffer[128];
asynStatus status = pgpibDpvt->pasynOctet->read(
pgpibDpvt->asynOctetPvt, pgpibDpvt->pasynUser,
buffer, 128, &count, 0);
// DONE
return 0;
}
//...
static struct gpibCmd gpibCmds[] = {
//...
{&DSET_SI, GPIBCVTIO, IB_Q_LOW, 0, 0, 0, 0, measurement, 0, 0, 0, 0, 0},
};
//...