26 Programming the RF Switch
Chapter 2
/* Close multiple signal paths and save as state number 1 */
err = viPrintf (rf_mux,"PATH:COMM 01,011;:PATH:COMM
13,100;:PATH:COMM 31,301\n");
if (err < VI_SUCCESS) err_handler (rf_mux,err);
err = viPrintf (rf_mux,"*SAV 1 \n");
if (err < VI_SUCCESS) err_handler (rf_mux,err);
/* Close additional signal paths and save as state number 2 */
err= viPrintf (rf_mux,"PATH:COMM 02,010;:PATH:COMM 22,202;:
PATH:COMM 24,232\n");
if (err < VI_SUCCESS) err_handler (rf_mux,err);
err = viPrintf (rf_mux,"*SAV 2\n");
if (err < VI_SUCCESS) err_handler (rf_mux,err);
/* Reset the module */
err = viPrintf (rf_mux,"*RST;*CLS:OPC?\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);
/* Recall state number 1 */
err= viPrintf (rf_mux,"*RCL 1\n");
if (err < VI_SUCCESS) err_handler (rf_mux,err);
/* Verify that a signal path from state number 1 is closed */
err = viPrintf (rf_mux,"PATH:COMM? 01,011\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 01,011 is closed");
else printf ("Signal path 01,011 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