DECLARE SUB spgensample (ns%, nfun%, nmain%, i%, samp!) DECLARE SUB spgensamples (ns%, nfun%, nmain%, samp!()) DECLARE SUB pdibreak () DECLARE SUB pdistatbits (regnum%, statbits$) DECLARE SUB pdistatbyte (regnum%, statbyte$, statbits$) '**************************************************************************** 'Module PDI5025 'This module contains subroutines for the Metrolab PDI-5025 precision 'digital integrator. ' 'Zachary Wolf '8/3/95 '**************************************************************************** 'Common block for this module COMMON SHARED /pdi5025/ gpibinP%, gpiboutP%, pdi5025addrP$ SUB pdibreak '**************************************************************************** 'This subroutine stops a PDI5025 measurement cycle. ' 'Zachary Wolf '8/30/95 '**************************************************************************** END SUB SUB pdierr (er%) '**************************************************************************** 'Dummy error routine. ' 'Zachary Wolf '1/7/96 '**************************************************************************** END SUB SUB pdiindexrd '**************************************************************************** 'Dummy index routine. ' 'Zachary Wolf '1/7/96 '**************************************************************************** END SUB SUB pdiindexst (d$) '**************************************************************************** 'Dummy index routine. ' 'Zachary Wolf '1/7/96 '**************************************************************************** END SUB SUB pdiinit '**************************************************************************** 'PDI5025INIT 'This subroutine initializes the Metrolab PDI5025 integrator. ' 'Zachary Wolf '8/3/95 '**************************************************************************** 'Message PRINT PRINT "Resetting the Metrolab PDI5025 Integrator..." END SUB SUB pdioffset (c$, g%) '**************************************************************************** 'This subroutine is used to do an offset adjustment on the PDI5025. ' 'Zachary Wolf '8/30/95 '**************************************************************************** END SUB SUB pdisetpar (gpibin%, gpibout%, pdi5025addr$) '**************************************************************************** 'This subroutine sets all required PDI5025 parameters. ' 'Input: ' gpibin%, GPIB input file number ' gpibout%, GPIB output file number ' pdi5025addr$, PDI5025 GPIB address in a string ' ' 'Zachary Wolf '9/12/95 '**************************************************************************** 'Make sure the input parameters have reasonable values IF gpibin% < 0 OR gpibin% > 100 THEN PRINT "PDI5025: GPIB problem" EXIT SUB END IF IF gpibout% < 0 OR gpibout% > 100 THEN PRINT "PDI5025: GPIB problem" EXIT SUB END IF IF pdi5025addr$ = "" THEN PRINT "PDI5025: GPIB problem" EXIT SUB END IF 'Put the input parameters in the local common block gpibinP% = gpibin% gpiboutP% = gpibout% pdi5025addrP$ = pdi5025addr$ END SUB SUB pdispoll (spoll%) '**************************************************************************** 'PDI5025SPOLL 'This subroutine does a serial poll on the Metrolab PDI5025 integrator.' ' 'Output: ' spoll%, the value returned by the serial poll ' 'Zachary Wolf '8/3/95 '**************************************************************************** END SUB SUB pdistatbits (regnum%, statbits$) '**************************************************************************** 'PDI5025STATUS 'This subroutine displays the status of the Metrolab PDI5025 integrator. ' 'Input: ' regnum%, the status register number to query ' 'Output: ' statbits$, string showing bit pattern making up the status byte ' 'Zachary Wolf '8/31/95 '**************************************************************************** END SUB SUB pdistatbyte (regnum%, statbyte$, statbits$) '**************************************************************************** 'PDI5025STATUS 'This subroutine displays the status of the Metrolab PDI5025 integrator. ' 'Input: ' regnum%, the status register number to query ' 'Output: ' statbyte$, contents of the status register, one byte or two characters ' statbits$, string showing bit pattern making up the status byte ' 'Zachary Wolf '8/3/95 '**************************************************************************** END SUB SUB pdivtrotenc (c$, g%, d$, np%, ns%, n%, vt!(), vtn!) '**************************************************************************** 'This subroutine takes n triggered integrated voltage readings 'and returns the values. ' 'Input: ' c$, the integrator channel, A or B ' g%, the gain value, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000 ' d$, the encoder rotation direction ' np%, the number of encoder pulses per revolution ' ns%, the number of vt samples per revolution ' n%, the number of integrated voltage samples (= ns% * #revolutions) ' 'Output: ' vt!(0 to n%-1), the measured integrated voltage values ' vtn!, the n'th sample ' 'Zachary Wolf '8/30/95 '**************************************************************************** 'Generate samples ns% = n% nfun% = 8 nmain% = 1 CALL spgensample(ns%, nfun%, nmain%, 0, vt0!) FOR i% = 0 TO ns% - 1 CALL spgensample(ns%, nfun%, nmain%, -i%, vt!(i%)) vt!(i%) = vt!(i%) - vt0! NEXT i% CALL spgensample(ns%, nfun%, nmain%, -ns%, vtn!) vtn! = vtn! - vt0! 'Generate a ramp FOR i% = 0 TO n% - 1 vt!(i%) = vt!(i%) + (1! * i% / n%) NEXT i% vtn! = vtn! + 1! END SUB SUB pdivtrotencrd (c$, n%, vt!(), vtn!) '**************************************************************************** 'This subroutine collects n triggered integrated voltage readings 'and returns the values. ' 'Input: ' n%, the number of integrated voltage samples (= ns% * #revolutions) ' 'Output: ' vt!(0 to n%-1), the measured integrated voltage values ' 'Zachary Wolf '8/30/95 '**************************************************************************** 'Generate samples ns% = n% nfun% = 8 nmain% = 1 CALL spgensamples(ns%, nfun%, nmain%, vt!()) 'Generate a ramp FOR i% = 0 TO n% - 1 vt!(i%) = vt!(i%) + 1! + (.1 * i% / (n% - 1)) NEXT i% vtn! = vt!(n% - 1) + (vt!(n% - 1) - vt!(n% - 2)) END SUB SUB pdivtrotencsetup (np%) '**************************************************************************** 'Dummy rotary encoder initialization routine. ' 'Zachary Wolf '1/7/96 '**************************************************************************** END SUB SUB pdivtrotencst (c$, g%, d$, np%, ns%, n%) '**************************************************************************** 'This subroutine takes n triggered integrated voltage readings. ' 'Input: ' c$, the integrator channel, A or B ' g%, the gain value, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000 ' d$, the encoder rotation direction ' np%, the number of encoder pulses per revolution ' ns%, the number of vt samples per revolution ' n%, the number of integrated voltage samples (= ns% * #revolutions) ' 'Zachary Wolf '8/30/95 '**************************************************************************** END SUB SUB pdivttimer (c$, g%, n%, t!, vt!()) '**************************************************************************** 'This subroutine takes n integrated voltage readings spaced t seconds apart 'and returns the values. ' 'Input: ' c$, the integrator channel, A or B ' g%, the gain value, 1, 2, 5, 10, 20, 50, 100, 200, 500, 1000 ' n%, the number of integrated voltage samples ' t!, the time between integrated voltage samples ' 'Output: ' vt!(0 to n%-1), the measured integrated voltage values ' 'Zachary Wolf '8/30/95 '**************************************************************************** END SUB