/* ************************* MessInst ************************** */

void MessInst::SendMessage(const char *message) { unsigned long ActualLen;

char Buf[BUFLEN+1];

strcpy(Buf,message);

strcat(Buf,"\n");

iwrite(Inst,Buf,strlen(Buf),0,&ActualLen);

}

char *MessInst::ReceiveMessage(char *message, int maxLen) { int Reason;

unsigned long ActualLen; char *SPtr, Buf[BUFLEN+1];

iread(Inst,message,maxLen,&Reason,&ActualLen); message[ActualLen] = ’\0’;

SPtr = message + strlen(message) - 1; while (SPtr >= message && *SPtr == ’\n’)

*SPtr-- = ’\0’;

while (Reason == I_TERM_MAXCNT) iread(Inst,Buf,BUFLEN,&Reason,&ActualLen);

return message;

}

char *MessInst::GetErrorMessage(char *message, int maxLen) { char *MPtr;

SendMessage("SYST:ERR?");

ReceiveMessage(message,maxLen); MPtr = (atoi(message)) ? message : NULL; return MPtr;

}

Chapter 2

Using the Digitizer 81

Page 81
Image 81
HP E1429A manual Chapter Using the Digitizer