Experimental Physics and
| |||||||||||||||||
|
hi, Eric: You've hit a shortcoming in the devGpib support. The problem is with the string you're trying to send. The devGpib code expects the command/format strings to be null-terminated and thus sees the '\000' in your command as the end of the string. If there's no way to avoid sending the NUL character to instrument you'll have to specify GPIBCVTIO in the command table entry and perform all the I/O operations yourself in the custom conversion routine. Here's a very simple example from device support for a MAX1619 digital thermometer. As you can see, the 'read local temperature' command code (Param 2) is a NUL. /* * Custom I/O routines */ static int readRegisterValue(struct gpibDpvt *pdpvt, int P1, int P2, char **P3) { struct longinRecord *pli = ((struct longinRecord *)(pdpvt- >precord)); gpibCmd *pgpibCmd = gpibCmdGet(pdpvt); asynOctet *pasynOctet = pdpvt->pasynOctet; void *asynOctetPvt = pdpvt->asynOctetPvt; size_t ntrans; int eomReason; char reply; if ((pasynOctet->write(asynOctetPvt,pdpvt->pasynUser,pgpibCmd->cmd, 1,&ntrans) != asynSuccess) || (pasynOctet->read(asynOctetPvt,pdpvt->pasynUser,&reply, 1,&ntrans,&eomReason) != asynSuccess) || (ntrans != 1)) { return -1; } if (P1) pli->val = (signed char)reply; else pli->val = (unsigned char)reply; pli->udf = 0; return 0; } . . . . /* Param 0 -- Read manufacturer ID code */ {&DSET_LI, GPIBCVTIO, IB_Q_LOW, "\xFE", NULL, 0, 1, readRegisterValue, 0, 0, NULL, NULL, NULL}, /* Param 1 -- Read Device ID code */ {&DSET_LI, GPIBCVTIO, IB_Q_LOW, "\xFF", NULL, 0, 1, readRegisterValue, 0, 0, NULL, NULL, NULL}, /* Param 2 -- Read local temperature */ {&DSET_LI, GPIBCVTIO, IB_Q_LOW, "\x00", NULL, 0, 1, readRegisterValue, 1, 0, NULL, NULL, NULL}, /* Param 3 -- Read remote temperature */ {&DSET_LI, GPIBCVTIO, IB_Q_LOW, "\x01", NULL, 0, 1, readRegisterValue, 1, 0, NULL, NULL, NULL},
| ||||||||||||||||
ANJ, 02 Sep 2010 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |