BNC 1201 - 6 1/2 Digit Digital Multimeter User Manual

Page 175

Advertising
background image

176

// Write command "*IDN?" and read the 1201 identification string

len = 64;

pStrout = new char[len];

ZeroMemory(pStrout, len);

strcpy(pStrout, "*idn?");

status = PviWrite_usb(m_instr_usbtmc, (unsigned char *)pStrout, 6,

&nWritten);

Sleep(30);

if (status != VI_SUCCESS)

{

MessageBox(NULL, "Write to device error.", "1201 multimeter device

test", MB_OK);

PviClose_usb(m_defaultRM_usbtmc);

hUSBTMCLIB = NULL;

m_defaultRM_usbtmc = 0;

return;

}

else

{

printf(" output : *IDN?\n");

}

Sleep(1000);

// Read data from device

len = 64;

if (hUSBTMCLIB)

{

status = PviRead_usb(m_instr_usbtmc, pStrin, len, &nRead);

if (nRead > 0)

{

for (len=0; len < (long) nRead; len++)

{

buffer[len] = pStrin[len];

}

}

buffer[nRead] = '\0';

printf(" input : %s\n\n",buffer);

}

Advertising