Home Previous Next


Secondary Address Handling

The following example explains how to handle primary and secondary addressing and how to perform a simple measurement with the CMU. In the example, remote control via the National Instruments GPIB bus driver (NI-488.2) and the programming language C is used. Once the addresses are assigned, the same commands can be used in different function groups.

// Include header files
#include <string.h>
 
/*  NI488.2 header file */
#include <decl.h> 
 
// GPIB board index
#define BdIndx                   0
 
// Primary address
#define pad                      20
 
// Secondary address for Base Definition (National Instruments specific)
#define sad_BASE                 96
 
// Secondary  Address for function groups definition 
// (conforming to IEEE488.2)
#define _RF_NSig                  1
#define _GSM900MS_Sig             2
#define _GSM900MS_NSig            3
#define _GSM1800MS_Sig            4
 
#define sad_RF_NSig             sad_BASE + _RF_NSig
#define sad_GSM900MS_Sig        sad_BASE + _GSM900MS_Sig
#define sad_GSM900MS_NSig       sad_BASE + _GSM900MS_NSig
#define sad_GSM1800MS_Sig       sad_BASE + _GSM1800MS_Sig
 
// Timeout
#define tmo                     (int) 10
 
// EOT
#define eot                     (int) 1
 
// EOS
#define eos                     (int) 0
 
// Command definition for secondary address mapping 
#define Map_Command             "SYST:REM:ADDR:SEC %d,\"%s\""
#define IdStr_RF_NSig                "RF_NSig"
#define IdStr_GSM900MS_Sig      "GSM900MS_Sig"
#define IdStr_GSM900MS_NSig     "GSM900MS_NSig"
#define IdStr_GSM1800MS_Sig    "GSM1800MS_Sig "
 
// Variable declarations
int h_BASE;
int h_RF_NSig;
int h_GSM900MS_Sig;
int h_GSM900MS_NSig;
int h_GSM1800MS_Sig;
 
char InBuffer [100];
char Command [100];
 
// Request of the basesystem handle
h_BASE = ibdev (BdIndx, pad, sad_BASE, tmo, eot, eos);
 
// Mapping of secondary addresses for the function groups
sprintf (Command, Map_Command, _RF_NSig,IdStr_RF_NSig);
ibwrt(h_BASE, Command, strlen(Command));
sprintf (Command, Map_Command, _GSM900MS_Sig, IdStr_GSM900MS_Sig);
ibwrt(h_BASE,Command, strlen(Command));
sprintf (Command, "Map_Command _GSM900MS_NSig, IdStr_GSM900MS_NSig);
ibwrt(h_BASE,Command, strlen(Command));
sprintf (Command, "Map_Command _GSM1800MS_Sig, IdStr_GSM1800MS_Sig);
ibwrt(h_BASE,Command, strlen(Command));
 
// Request of function group handles
h_RF_NSig = ibdev (BdIndx, pad, sad_RF_NSig, tmo, eot, eos);
h_GSM900MS_Sig = ibdev (BdIndx, pad, sad_GSM900MS_Sig, tmo, eot, eos);
h_GSM900MS_NSig = ibdev (BdIndx, pad, sad_GSM900MS_NSig, tmo, eot, eos);
h_GSM1800MS_Sig = ibdev (BdIndx, pad, sad_GSM1800MS_Sig, tmo, eot, eos);

More:

Simple Measurements


Home Previous Next