22 Programming the RF Switch
Chapter 2
/*Reset the E1470A */
err= viPrintf (rf_mux,"*RST;*CLS;*OPC?\n');
if (err < VI SUCCESS) err_handler (rf_mux,err);
err= viScanf (rf_mux,"%s",&buf);
if (err < VI_SUCCESS) err_handler (rf_mux,err);
/* Read and display the ID String. Should return
HEWLETT-PACKARD,E1470A,0,A.01.00 */
err = viPrintf (rf_mux "*IDN?\n');
if (err < VI_SUCCESS) err_handler (rf_mux,err);
err= viScanf (rf_mux,"%s",&buf);
if (err < VI_SUCCESS) err_handler (rf_mux,err);
printf ("Module Identification String: %s\n",buf);
/ * Do the Self Test */
printf ("Performing the Self Test\n");
err= viPrintf (rf_mux,"*TST?\n');
if (err < VI_SUCCESS) err_handler (rf_mux,err);
err = viScanf (rf_mux,"%d",&err_no);
while (err < VI_SUCCESS) err = viScanf (rf_mux,"%d",&err_no);
if (err no != 0) printf ("\nSelf Test Error: %d\n",err_no);
else printf ("\nNo Self Test Errors");
/* Close a signal path from COM 02 to Channel 002 */
err= ViPrintf (rf_mux,"PATH:COMM 02,002\n");
if (err < VI_SUCCESS) err_handler (rf_mux,err);
/* Verify the path is closed */
err = viPrintf (rf_mux,"PATH: COMM? 02,002\n');
if (err < VI_SUCCESS) err_handler (rf_mux,err);
err= viScanf (rf_mux,"%d",&ch_closed);
if (err < VI_SUCCESS) err_handler (rf_mux,err);
if (ch_closed ==1) printf ("Signal path is closed");
else printf ("Signal path is NOT closed");
/* Close Session */
viClose (rf_mux);
viClose (defaultRM);
}
void err_handler() /* Error handling routine */
{
ViStatus err;
char err_msg[1024]={0};
viStatusDesc(rf_mux,err,err_msg);
printf ("Error = %s\n",err_msg);
return;
}
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com