Chapter 6 Application Programs
Example Program for C and C++
127
6
if(bGPIB){ /* For use with GPIB 7 address, use "GPIB::7::INSTR" address format */
strcpy(VISA_address,"GPIB::");
strcat(VISA_address,GPIB_Address);
strcat(VISA_address,"::INSTR");
}
else{ /* For use with COM2 port, use "ASRL2::INSTR" address format */
strcpy(VISA_address,"ASRL");
strcat(VISA_address,COM_Address);
strcat(VISA_address,"::INSTR");
}
/* Open communication session with the power supply */
ErrorStatus = viOpenDefaultRM(&defaultRM);
ErrorStatus = viOpen(defaultRM,VISA_address,0,0,&power_supply);
CheckError("Unable to open port");
if(!bGPIB)
SendSCPI("System:Remote");
}
void
SendSCPI(char* pString)
{
char* pdest;
strcpy(commandString,pString);
strcat(commandString,"\n");
ErrorStatus = viPrintf(power_supply,commandString);
CheckError("Can’t Write to Driver");
if (bGPIB == 0)
delay(1000);
/* Unit is milliseconds */
pdest = strchr(commandString, ’?’);
/* Search for query command */
if( pdest != NULL ){
ErrorStatus = viScanf(power_supply,"%s",&ReadBuffer);
CheckError("Can’t Read From Driver");
strcpy(pString,ReadBuffer);
}
}
void
ClosePort()
{
/* Close the communication port */
viClose(power_supply);
viClose(defaultRM);
}
Continued on next page
Содержание E364 A Series
Страница 9: ...8...
Страница 15: ...14 Contents Contents...
Страница 16: ...1 Quick Start...
Страница 27: ...Chapter 1 Quick Start To Rack Mount the Instrument 26...
Страница 28: ...2 General Information...
Страница 40: ...3 Front Panel Operation and Features...
Страница 68: ...4 Remote Interface Reference...
Страница 114: ...5 Error Messages...
Страница 124: ...6 Application Programs...
Страница 135: ...Chapter 6 Application Programs Example Program for Excel 97 134...
Страница 136: ...7 Tutorial...
Страница 147: ...Chapter 7 Tutorial Remote Programming 146...
Страница 148: ...8 Specifications...
Страница 155: ...Chapter 8 Specifications Supplemental Characteristics 154 Figure 8 2 Dimensions for Rack mounting...
Страница 156: ...Appendix Service Information...
Страница 165: ...Appendix Service Information General Disassembly 164 General Disassembly...
Страница 193: ...Appendix Service Information Replaceable Parts 192...
Страница 197: ......
Страница 198: ......
Страница 199: ......
Страница 200: ......
Страница 201: ......
Страница 202: ......
Страница 203: ......
Страница 204: ......
Страница 205: ......