RIGOL
Chapter 4 Programming Examples
4-22
DG900 Programming Guide
}
status = viOpen(defaultRM, SendAddr, VI_NULL, VI_NULL, &instr);
//write command to the instrument
status = viWrite(instr, (unsigned char *)SendBuf, strlen(SendBuf), &retCount);
//close the instrument
status = viClose(instr);
status = viClose(defaultRM);
return bWriteOK;
}
2)
Encapsulate the read operation of VISA for easier operation.
bool CDGDG900_Demo_VCDlg::InstrRead(CString strAddr, CString *pstrResult)
//Read from the instrument
{
ViSession defaultRM,instr;
ViStatus status;
ViUInt32 retCount;
char * SendAddr = NULL;
unsigned char RecBuf[MAX_REC_SIZE];
bool bReadOK = false;
CString str;
//Change the address's data style from CString to char*
SendAddr = strAddr.GetBuffer(strAddr.GetLength());
strcpy(SendAddr,strAddr);
strAddr.ReleaseBuffer();
memset(RecBuf,0,MAX_REC_SIZE);
//open the VISA instrument
status = viOpenDefaultRM(&defaultRM);
if (status < VI_SUCCESS)
{
// Error Initializing VISA...exiting
AfxMessageBox("No VISA instrument was opened !");
return false;
}
//open the instrument
status = viOpen(defaultRM, SendAddr, VI_NULL, VI_NULL, &instr);
//read from the instrument
status = viRead(instr, RecBuf, MAX_REC_SIZE, &retCount);
//close the instrument
status = viClose(instr);
status = viClose(defaultRM);
(*pstrResult).Format("%s",RecBuf);
return bReadOK;
}
7.
Add the control message response codes.
1)
Connect to the instrument
Содержание DG952
Страница 2: ......
Страница 168: ......
Страница 181: ...Chapter 4 Programming Examples RIGOL DG900 Programming Guide 4 7 ...
Страница 185: ...Chapter 4 Programming Examples RIGOL DG900 Programming Guide 4 11 ...
Страница 187: ...Chapter 4 Programming Examples RIGOL DG900 Programming Guide 4 13 ...
Страница 199: ...Chapter 4 Programming Examples RIGOL DG900 Programming Guide 4 25 ...
Страница 200: ......