Programming Examples
Example: Module
Self-Test
Chapter 2
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com
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.
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
command performs a device reset on the module and sets it to
* R S T
its power-on state. (Saved module states and status information are not
affected by
* R S T
match the configurations programmed using the
NOTE
results are unpredictable if you use register -based programming or
* T S T ?
or
D I A G : C L O S
D I A G : O P E N
should be a "0". Any other value indicates the actual state of the relays do
not match the configuration programmed by the
See Chapter 3 for details.
/ * S e l f - T e s t .
T h i s p r o g r a m r e s e t s t h e E 1 4 7 0 A , r e a d s t h e I D s t r i n g , p e r f o r m s a
s e l f - t e s t , r e a d s a n y s e l f - t e s t e r r o r m e s s a g e s , a n d c l o s e s a n d v e r i f i e s
a s i g n a l p a t h * /
# i n c l u d e < v i s a . h >
# i n c l u d e < s t d i o . h >
# i n c l u d e < s t d l i b . h >
v o i d e r r _ h a n d l e r ( ) ;
v o i d m a i n ( )
{
c h a r b u f f [ 2 5 6 ] = { 0 } ;
i n t e r r _ n o , c h _ c l o s e d ;
/ * C r e a t e a n d O p e n a D e v i c e S e s s i o n . E 1 4 7 0 i s a t l o g i c a l a d d r e s s 1 2 0 * /
V i S t a t u s e r r ;
V i S e s s i o n d e f a u l t R M , r f _ m u x ;
v i O p e n D e f a u l t R M ( & d e f a u l t R M ) ;
v i O p e n ( d e f a u l t R M , " G P I B - V X I 0 : : 9 : : 1 2 0 " , V I _ N U L L , V I _ N U L L , & r f _ m u x ) ;
. ) The
command verifies that the relay positions
* T S T ?
to control individual relays. The value returned
Programming the RF Switch 21
commands.
R O U T : P A T H
command.
R O U T : P A T H