EasyManua.ls Logo

HP 8168E - Page 128

HP 8168E
262 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
6
Example 5 - Increased Tuning Linearity
if (argc != 2)
exit(-1);
sscanf(argv[1], "%lf", &theWvl);
return (SetExactWvl (theWvl));
}
/*-------------------------------------------------------------------------*/
int SetExactWvl (double theWvl)
/*-------------------------------------------------------------------------*/
{
/* open the instruments: */
INST laserSource = iopen("hpib,24"); /* laser source at hpib address 24 */
INST waveMeter = iopen("hpib,06"); /* wave meter at hpib address 6 */
int trialCnt;
int trialMax = 10;
double actWvl;
double diffWvlMax = 1.5e-12; /* 1.5 pm */
iprintf (laserSource, "WAVE %lg\n", theWvl); /* set the wavelength */
iprintf (laserSource, "OUTP ON\n"); /* turn the laser on */
for (trialCnt = 0; trialCnt < trialMax; trialCnt++)
{
actWvl = GetWavelength (waveMeter); /* read the wavelength */
if (fabs(actWvl - theWvl) < diffWvlMax) /* break if near enough */
break;
iprintf (laserSource, "WAVEACT %lg\n", actWvl);/* tell the laser source */
/* the actual wavelength */
}
iclose (laserSource); /* close the instruments */
iclose (waveMeter);
return trialCnt;
}
/*-------------------------------------------------------------------------*/
double GetWavelength (INST theInstrument)
/*-------------------------------------------------------------------------*/
{
double actualWvl;
6-18 Programming Examples

Related product manuals