HP E1340A Service Manual page 101

Function generator
Hide thumbs Also See for E1340A:
Table of Contents

Advertisement

Appendix A
#define ADDR "hpib7,9,10"
#define DMM "hpib7,22"
#define PM "hpib7,14"
void main (void)
{
INST id, dm, pm;
char cr[256] = {0};
double reading, freq_step = 1342177.28, corr_factor, freq, dmm_rdg, pm_rdg;
double error_db, reference;
int cal_point = 0, this_point, err_num = 0;
#if defined(__BORLANDC__) && !defined(__WIN32__)
_InitEasyWin();
#endif
ionerror(I_ERROR_EXIT);
id = iopen (ADDR);
dm = iopen (DMM);
pm = iopen (PM);
/*--------------------Initialize AFG---------------------------------------*/
iprintf (id, "*RST;*CLS\n");
/*--------------------Get Power Meter correction factor--------------------*/
freq = 1.0E5;
iprintf (id, "VOLT 1VPK;\n");
iprintf (id, ":FREQ %lf\n", freq);
iprintf (id, "INIT:IMM\n");
printf ("\n\nConnect Power Meter to AFG output and press ENTER");
getchar ();
iprintf (pm, "IP\n");
iprintf (pm, "AU M4 WT\n");
iprintf (pm, "%lfMHZ\n", freq/1E6);
iprintf (pm, "T3\n");
iscanf (pm, "%lf", &pm_rdg);
pm_rdg = sqrt (abs (pm_rdg) * 50);
printf ("\n\nConnect DMM to AFG output and press ENTER");
getchar ();
iprintf (dm, "PRESET NORM;FUNC ACV;SETACV SYNC;TRIG HOLD\n");
iprintf (dm, "END ALWAYS\n");
iprintf (dm, "RANGE 10;DELAY .1\n");
iprintf (dm, "ACBAND %lf,%lf\n", freq*.9, freq*1.1);
iprintf (dm, "TRIG SGL\n");
iscanf (dm, "%lf", &dmm_rdg);
iscanf (dm, "%t", cr);
corr_factor = dmm_rdg/pm_rdg;
/* Address of device */
/* Address of multimeter */
/* Address of power meter */
/* Define id as an instrument */
/* Open instrument session */
/* Set AFG to 1 V peak, 100 kHz sine */
/* Measure output with power meter */
/* Convert from watts to volts */
/* Measure output with DMM */
Verification Tests - C Programs 103

Advertisement

Table of Contents
loading

Table of Contents