DECLARE SUB vtcheckdata (n%, vt!(), ok$) DECLARE SUB pdiindexrd () DECLARE SUB pdiindexst (d$) DECLARE SUB pdivttimer (c$, g%, n%, t!, vt!()) DECLARE SUB pdivtrotencsetup (np%) DECLARE SUB vtoffsetcorr (n%, vt!()) DECLARE SUB gpibinit (gpibin%, gpibout%) DECLARE SUB cm2100avd (a!, v!, d!) DECLARE SUB cm2100init () DECLARE SUB cm2100setpar (gpibin%, gpibout%, cm2100addr$) DECLARE SUB pdierr (er%) DECLARE SUB pdiinit () DECLARE SUB pdioffset (c$, g%) DECLARE SUB pdisetpar (gpibin%, gpibout%, pdi5025addr$) DECLARE SUB pdivtrotencinit (np%) DECLARE SUB pdivtrotencrd (c$, n%, vt!()) DECLARE SUB pdivtrotencst (c$, g%, d$, np%, ns%, n%) DECLARE SUB pdivtrotencindexrd () DECLARE SUB pdivtrotencindexst (d$) DECLARE SUB hp3457init () DECLARE SUB hp3457setpar (gpibin%, gpibout%, hp3457addr$) DECLARE SUB spcalcfft (ns%, samp!(), fftm!(), fftp!()) DECLARE SUB spcalchar (ns%, fftm!(), fftp!(), nfun%, nh%, harm!(), harp!()) DECLARE SUB spplotfft (ns%, fftm!(), fftp!()) DECLARE SUB spplothar (nh%, harm!(), harp!()) DECLARE SUB spplotsamp (ns%, samp!()) 'Include parameter definitions REM $INCLUDE: 'param.inc' 'Initialize the GPIB CALL gpibinit(gpibinP%, gpiboutP%) 'Initialize the HP3457 CALL hp3457setpar(gpibinP%, gpiboutP%, hp3457addrP$) CALL hp3457init 'Initialize the CM2100 CALL cm2100setpar(gpibinP%, gpiboutP%, cm2100addrP$) CALL cm2100init 'Initialize the PDI5025 CALL pdisetpar(gpibinP%, gpiboutP%, pdi5025addrP$) CALL pdiinit 'Message PRINT PRINT "Beginning test..." 'Test the motor 'a! = .5 'v! = 1! 'd! = 2! 'CALL cm2100avd(a!, v!, d!) 'STOP 'Make a measurement using the timer 'c$ = "A" 'g% = 10 'n% = 512 't! = .02 'DIM vt!(0 TO n% - 1) 'CALL pdivttimer(c$, g%, n%, t!, vt!()) 'CALL spplotsamp(n%, vt!()) 'DIM fftm(0 TO n% / 2) 'DIM fftp(0 TO n% / 2) 'CALL spcalcfft(n%, vt!(), fftm!(), fftp!()) 'CALL spplotfft(n%, fftm!(), fftp!()) 'STOP 'Perform an offset adjustment of the integrator 'PRINT 'PRINT "Offset Adjustment" 'c$ = "A" 'g% = 10 'CALL pdioffset(c$, g%) 'CALL pdierr(e%) 'Do a measurement using the rotary encoder for triggering 'Assign Measurement Parameters c$ = "A" g% = 5 d$ = "+" notd$ = "-" np% = 1024 ns% = 64 n% = 1024 a! = .5 v! = 1! d! = 18! DIM vt!(0 TO n% - 1) 'Initialize the PDI5025 for rotary encoder triggering CALL pdierr(e%) CALL pdivtrotencsetup(np%) CALL pdierr(e%) 'Locate the index pulse PRINT PRINT "-------------Index " + d$ CALL pdiindexst(d$) CALL cm2100avd(a!, v!, 2!) CALL pdiindexrd CALL pdierr(e%) 'Perform a measurement with d$ rotation PRINT PRINT "------------Measurement " + d$ CALL pdivtrotencst(c$, g%, d$, np%, ns%, n%) CALL cm2100avd(a!, v!, d!) CALL pdivtrotencrd(c$, n%, vt!()) CALL vtcheckdata(n%, vt!(), ok$) GOTO plot 'Locate the index pulse with notd$ rotation 'PRINT 'PRINT "-------------Index " + notd$ 'CALL pdiindexst(notd$) 'CALL cm2100avd(a!, v!, -2!) 'CALL pdiindexrd 'CALL pdierr(e%) 'Perform a measurement with notd$ rotation PRINT PRINT "------------Measurement " + notd$ CALL pdivtrotencst(c$, g%, notd$, np%, ns%, n%) CALL cm2100avd(a!, v!, -d!) CALL pdivtrotencrd(c$, n%, vt!()) CALL vtcheckdata(n%, vt!(), ok$) 'Plot the samples, FFT, and the harmonics plot: CALL spplotsamp(n%, vt!()) DIM fftm(0 TO n% / 2) DIM fftp(0 TO n% / 2) CALL spcalcfft(n%, vt!(), fftm!(), fftp!()) CALL spplotfft(n%, fftm!(), fftp!()) nh% = 16 nfun% = n% / ns% DIM harm!(1 TO nh%) DIM harp(1 TO nh%) CALL spcalchar(n%, fftm!(), fftp!(), nfun%, nh%, harm!(), harp!()) CALL spplothar(n%, harm!(), harp!())