Programming the RF Switch 21
Chapter 2
Programming Examples
The following C-language programs show one way to verify initial operation
for the Cascade RF Switch module, to close signal paths, and to save and
recall module states. To run these programs, you must have installed the
E1470A SCPI Device Driver, Agilent IO Libraries for Windows, and a GPIB
module in your PC.
Example: Module
Self-Test
This program:
•
Identifies the module and device driver
•
Resets the module
•
Closes a path (source/destination)
•
Verifies that the path is closed
•
Executes the module self-test
The
*RST
command performs a device reset on the module and sets it to
its power-on state. (Saved module states and status information are not
affected by
*RST
.) The
*TST?
command verifies that the relay positions
match the configurations programmed using the
ROUT:PATH
commands.
NOTE
*TST?
results are unpredictable if you use register -based programming or
DIAG:CLOS
or
DIAG:OPEN
to control individual relays. The value returned
should be a "0". Any other value indicates the actual state of the relays do
not match the configuration programmed by the
ROUT:PATH
command.
See Chapter 3 for details.
/* Self -Test.
This program resets the E1470A, reads the ID string, performs a
self-test, reads any self-test error messages, and closes and verifies
a signal path */
#include <visa.h>
#include <stdio.h>
#include <stdlib.h>
void err_handler();
void main()
{
char buff[256] = {0};
int err_no, ch_closed;
/* Create and Open a Device Session. E1470 is at logical address 120 */
ViStatus err;
ViSession defaultRM,rf_mux;
viOpenDefaultRM (&defaultRM);
viOpen (defaultRM,"GPIB-VXI0::9::120",VI_NULL,VI_NULL,&rf_mux);
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com