if(err < VI_SUCCESS)err_handler(rf_mux,err);

/* read the ID and Device Type registers */

err = viIn16(rf_mux,VI_A16_SPACE,0x00,&id_reg); if(err < VI_SUCCESS)err_handler(rf_mux,err);

err = viIn16(rf_mux,VI_A16_SPACE,0x02,&dt_reg); if(err < VI_SUCCESS)err_handler(rf_mux,err); printf("ID register = 0x%4X\nDevice Type register =

0x%4X\n",id_reg,dt_reg);

/* read the Status Register */

err = viIn16(rf_mux,VI_A16_SPACE,0x04,&stat_reg); if(err < VI_SUCCESS)err_handler(rf_mux,err);

printf("Status register = "0x%4X\n",stat_reg);

/* close relays on registers 20h & 28h for signal path */ /* from CH031 to COM05. 20840 decimal = 5000h and */ /* 38 decimal = 26h */

err = viOut16(rf_mux,VI_A16_SPACE,0x20,0x5000);

if(err < VI_SUCCESS)err_handler(rf_mux,err); err = viOut16(rf_mux,VI_A16_SPACE,0x28,0x26); if(err < VI_SUCCESS)err_handler(rf_mux,err);

/* read relay control registers and print their values */

err = viIn16(rf_mux,VI_A16_SPACE,0x20,®_20h); if(err < VI_SUCCESS)err_handler(rf_mux,err);

err = viIn16(rf_mux,VI_A16_SPACE,0x22,®_22h); if(err < VI_SUCCESS)err_handler(rf_mux,err);

err = viIn16(rf_mux,VI_A16_SPACE,0x24,®_24h); if(err < VI_SUCCESS)err_handler(rf_mux,err);

err = viIn16(rf_mux,VI_A16_SPACE,0x26,®_26h); if(err < VI_SUCCESS)err_handler(rf_mux,err);

err = viIn16(rf_mux,VI_A16_SPACE,0x28,®_28h); if(err < VI_SUCCESS)err_handler(rf_mux,err);

printf("\n\nLeft-hand Assembly Register 20h = 0x%4X\n",reg_20h); printf("Left-hand Assembly Register 22h = 0x%4X\n", reg_22h); printf("Right-hand Assembly Register 24h = 0x%4X\n", reg_24h); printf("Right-hand Assembly Register 26h = 0x%4X\n", reg_26h); printf("Register 28h for Both Assemblies = 0x%4X\n",reg_28h);

/* wait 5 seconds before resetting module */

wait (5);

/* reset the E1470A to open all closed channels */

/* writing a 0 to the relay control registers also opens channels */

err = viOut16(rf_mux,VI_A16_SPACE,0x04,1); if(err < VI_SUCCESS)err_handler(rf_mux,err);

50 Register-Based Programming

Appendix B

Page 50
Image 50
Agilent Technologies E1470A user manual Wait 5 seconds before resetting module