DSA800 series programming guide - Page 230

For DSA815.

Loading ...
Loading ...
Loading ...
RIGOL Chapter 3 Programming Demos
3-8 DSA800 Programming Guide
strAddr.ReleaseBuffer();
//Open a VISA resource
status = viOpenDefaultRM(&m_SessRM);
if (status == 0)
{
//Open the device
status = viOpen(m_SessRM, SendAddr, VI_NULL, VI_NULL, &m_SessInstr);
//If you fails to open the connection, close the resource
if (status != 0)
{
viClose(m_SessRM);
}
}
return status;
}
ViStatus CDemoForDSADlg::CloseVisaDevice() //Close a VISA device
{
ViStatus status;
//Close the device
status = viClose(m_SessInstr);
if (status == 0)
{
//close the resource
status = viClose(m_SessRM);
}
return status;
}
bool CDemoForDSADlg::InstrWriteEx(CString strAddr, CString strContent) //Write operation with
exception handling
{
ViStatus status;
ViUInt32 retCount;
char * SendBuf = NULL;
bool bWriteOK = true;
// Change the address's data style from CString to char*
SendBuf = strContent.GetBuffer(strContent.GetLength());
strcpy(SendBuf,strContent);
strContent.ReleaseBuffer();
do
{
//Write command to the instrument
status = viWrite(m_SessInstr, (unsigned char *)SendBuf, strlen(SendBuf), &retCount);
//If an error occurs, perform error handing
if (status < 0)
Loading ...
Loading ...
Loading ...