Hi,
i am trying to get a simple applicaiton to write to a gpib device. the interface is a GPIB-ENET device. i open the interface using ibdev, clear the device using ibclr, check if the device exists using ibln and then write the string " E " to the device (a 2100 computotor indexer). all the commands except the ibwrt return a 0x100 status and no error. the ibwrt returns an ENOL error.
i have tried this same command with the gpib interactive interface gpibintctrl using only ibdev and ibwrt and the command suceeds.
can someone help me witrh what i am doing wrong please.
i have attached the source code.
thanks in advance
regards
sean
#include
#include
#include
#include "ni488.h"
#define ARRAYSIZE 1024 // Size of read buffer
#define ESCAPE 0x1b
// Response byte after serial polling device.
#define SERIALPOLLRESPONSE 0x60
int Dev[8][31];
char ValueStr[8][31][ARRAYSIZE + 1];
char ErrorMnemonic[21][5] = {"EDVR", "ECIC", "ENOL", "EADR", "EARG",
"ESAC", "EABO", "ENEB", "EDMA", "",
"EOIP", "ECAP", "EFSO", "", "EBUS",
"ESTB", "ESRQ", "", "", "", "ETAB"};
char errmsg[1024], str[1024];
int device, ud, board;
long count;
void main(int argc, char *argv[]) {
short exists;
device = 3;
ud = ibdev(board,device,0,13,1,0);
sprintf(errmsg,"Opening GPIB device on board %d at primary address %d. Error = %d. Status = 0x%x\n", 0, device, iberr, ibsta);
printf("%s",errmsg);
ibclr(ud);
sprintf(errmsg,"Clearing GPIB device on board %d at primary address %d. Error = %d. Status = 0x%x\n", 0, device, iberr, ibsta);
printf("%s",errmsg);
ibln(board,device,0,&exists);
sprintf(errmsg,"Checking GPIB device on board %d at primary address %d. Error = %d. Status = 0x%x\n", 0, device, iberr, ibsta);
printf("%s",errmsg);
printf("Device at adress %d exists status = %d\n",device,exists);
strcpy(&str[0]," E ");
count = strlen(str);
ibwrt(ud,&str[0],count);
sprintf(errmsg,"Writing to GPIB device %d on board %d at address %d, %d number of characters. Error = %d. Status = 0x%x.\nString : \"%s\", count = %d\n",ud,0,device, count, iberr, ibsta, str, ibcntl);
printf("%s",errmsg);
}