Attribute VB_Name = "Module1" 'Automated Test Software for SCM5Bxx-xx Voltage, 'Current, TC and RTD input models. 'AUTHOR: John Lehman 'DATE: 1/4/96 'USES LIBRARY = LIBATED.BAS 'USES SOURCE CODE = TEST5B1E.BAS, TEST5B2E.BAS ' REVISION RECORD 'DATE REV APPR DESCRIPTION '---- --- ---- ----------- '1/4/96 n/a JL Initial Release. ' ... ' ... See "Revs.txt" file. ' ... '2015/05/29 B.08 PWR Added CONTRES! = 0.1 line to OUTSWITCH$ function to hardcode a value ' for a Cu RTD input module (the allowed 0.3 Ohms measured during test ' head startup would be 13% of the span). Also subtracted CONTRES! from ' MAXIN! when calling OHMSET in OUTSWITCH$. '2016/03/08 B.09 MR Updated PARACITICTCV for SCM5B47K-1820, -1781 and -1782 ' to compensate for SCMX1508 custom CJC for 0 deg C '2016/09/30 B.10 MF Added module SCM5B41-1811 to be tested on gang tester '2018/02/20 B.11 MR Added conditions for SCM5B38-1851 similar to SCM5B38-1788 '2018/04/26 B.12 MR Added SCM5B38-1232 CAL Iteration = 3 in CALSEQ Subroutine '2019/02/08 B.13 MR '2020/10/07 B.14 JL Increased Contact Resistance max value from 0.3 ohms to 0.5 ohms. Const PROGNAME$ = "TEST5B1E.EXE" 'Executable file name of the program. Const VERSION$ = "B.14 2020.10.07 JL" 'Version (Revision Date) and initials of engr. Const SOURCEFILES$ = "TEST5B1E.BAS TEST5B2E.BAS NLIBATED.BAS" 'Source file names '******** Declare some useful constants ******* Const MAXSTATUSINDEX = 21 'Maximum index of the Status array DECLARE SUB CALDAC (TE$) DECLARE SUB CALSEQ (CAL%) 'Determine & perform calibration sequence DECLARE SUB CALTEST (CAL%) 'Test sequence to calibrate modules DECLARE SUB CASEINST () 'Tell user to install a case over the unit DECLARE SUB CHANGEDN (SN$) 'Allows operator to change the dash number only when running finals DECLARE SUB COMPTEST (STATUS$(), CAL%, GENAMPL!, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$(), TOTLRESPEC!) 'Complete set of tests DECLARE SUB CONTINUE () DECLARE SUB ENABLE (ONOFF%) 'Module output switch control DECLARE SUB FOOTER (STATUS$()) 'Sends footer to printer if all tests passed DECLARE SUB FUNCTEST (CAL%) 'Routines for functional test DECLARE SUB GENSET (GENAMPL!) 'Displays message to set signal generator DECLARE SUB GETADD (FILENAME$) 'Gets parallel port/Mux/Testhead address DECLARE SUB GETSN (SN$) 'Gets serial number DECLARE SUB GETSPECS () 'Gets module type and specifications DECLARE SUB HEADERA (SN$) 'Prints test sheet header DECLARE SUB HEADERB (TESTTITLE$) 'Prints test screen header DECLARE SUB INIT488 (DVMADDR%) DECLARE SUB INITPS (ADDR%, OVERI!, OVERV!) DECLARE SUB INDIVID (SEL%, CAL%) 'Performs the tests individually DECLARE SUB LOADMUX (CH%, CHON%) DECLARE SUB LOGIT (STATUS$(), SN$, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$(), TOTLRESPEC!) 'Logs test results to disk DECLARE SUB MODULEOUTLINE () DECLARE SUB NOTES () 'Notes on ATE operation DECLARE SUB OHMSET (OHM!) DECLARE SUB ONESHOTTEST () 'Tests one-shot pulse width DECLARE SUB PASSTHRUTEST (STATUS$(), TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$()) DECLARE SUB PAUSE (TIME!) DECLARE SUB POWERON (Voltage!) 'Sets module supply voltage DECLARE SUB REPORT (STATUS$(), TSPEC$()) 'Prints test data on screen DECLARE SUB RESETTH () 'Reset test head to known condition DECLARE SUB REMEXCPIN (PINSTAT%) DECLARE SUB RTDTHCAL () 'Check test head operation 'DECLARE SUB SETDAC (Voltage!, CH%, VSENATTEN!) DECLARE SUB SETDAC (Voltage!, CH%, VRANGE!, VSENATTEN!) DECLARE SUB SETDACFAST (Voltage!) DECLARE SUB SETTEST (Test%) DECLARE SUB SETTH (DOUT%, CB%) DECLARE SUB SETTHFAST (DOUT%, CB%) DECLARE SUB SETLOAD (LOAD!) 'Set excitation load DECLARE SUB SORTDB (ENDFLAG%) DECLARE SUB TSPECS (TSPEC$(), TOTLRESPEC!) 'Creates a string array of test specifications DECLARE SUB WRITEDVM (CMD$, VALUE!) DECLARE SUB WRITEPS (ADDR%, CMD$) DECLARE SUB FAILSTATUS (TESTVALUE$, YLOC%, XLOC%, TEXTVALUE$, SPACES%) DECLARE SUB LOGMODFILES (STATUS$(), SN$, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$(), TSPEC$(), TOTLRESPEC!, TX%) DECLARE SUB INTERLUDE () ' WAIT FOR USER DECLARE SUB WORKORDERLINE (FAILSTATE%, SN$) DECLARE SUB WORKORDERPRINT (SN$) DECLARE SUB WORKORDERHEADER (SN$) DECLARE SUB GETDSFNAME (SN$, DSSNAME$, DSFNAME$) 'Gets datasheet search and file names from serial number DECLARE SUB DATASHEETWRITE (SN$, STATUS$(), TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$(), TSPEC$(), TX%) DECLARE SUB DATASHEETPRINT (SN$, STATUS$()) DECLARE SUB HARDCOPY () DECLARE SUB SNPARSE (SN$, WO$, ds$) DECLARE FUNCTION GETWOSFNAME$ (SN$) 'Returns work order status file name from serial number DECLARE FUNCTION BESTFIT! (SLOPE!, OFFSETS!, TSIM!(), NUMPTS%, ERRO!()) 'Library fn. Calculates bestfit line and max error DECLARE FUNCTION CALMENU% () 'Option menu after offset/gain cal DECLARE FUNCTION CJCGAIN$ () 'Measure module CJC gain DECLARE FUNCTION EXCCAL$ (CAL%) 'Calibrate isolated excitation voltage DECLARE FUNCTION EXCILIM$ () 'Test excitation current limit DECLARE FUNCTION EXCREG$ () 'Tests excitation load regulation DECLARE FUNCTION FAILS% (STATUS$()) 'Tests for failed tests DECLARE FUNCTION FREQRESP$ (GENAMPL!) 'Performs Frequency response Test DECLARE FUNCTION GAINCAL$ (CAL%, CONTRES!, PFSMEAS!, INTERACT!, OSERR2!, DIRG%) 'Performs Gain Calibration DECLARE FUNCTION GENATTENR! () 'Calculate fn gen attenuator DECLARE FUNCTION GETTHID% () 'Get test head id # DECLARE FUNCTION GETPSID% () DECLARE FUNCTION IEXC2$ (IEXCSENSE!) 'Measure excitation I source #2 DECLARE FUNCTION IEXC1$ (IEXCSENSE!) 'Measure excitation I source #1 DECLARE FUNCTION IMATCH$ (I1$, I2$) 'Check current source matching DECLARE FUNCTION INPUTR$ () 'Performs Input Resistance Test DECLARE FUNCTION KEYBDIN$ () 'Get keyboard input DECLARE FUNCTION LEADREFF$ (TOTLRESPEC!) 'Measure lead resistance effects DECLARE FUNCTION LINTEST$ (ACC$, CONTRES!, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$()) 'Performs Accuracy and Linearity Tests DECLARE FUNCTION MEASRES! (OHM!, RESNUM%, TE$) 'Measure loop current sense resistor DECLARE FUNCTION MENU1% () 'Gets the Test Group selection DECLARE FUNCTION MENU2% () 'Gets the individual test # DECLARE FUNCTION MENU3% () 'Gets the module family DECLARE FUNCTION UTILMENU% () 'Utility menu for Individual Test menu. DECLARE FUNCTION OFFSETCAL$ (CAL%, CONTRES!, DIRO%) 'Performs Offset Calibration DECLARE FUNCTION OPENIN$ () 'Measure open input response DECLARE FUNCTION OUTNOISE$ () 'Performs Output Noise Test DECLARE FUNCTION OUTSWITCH$ () 'Test output switch operation DECLARE FUNCTION PARASITICTCV! (VCJC!) 'Measure VCJC and calculate PTC DECLARE FUNCTION POWERIO$ (ADDR%, CMD$) 'Library fn. Kepco DPS power supply I/O DECLARE FUNCTION READDVM! (TOL!) 'Library fn. Reads Fluke meter to TOL! DECLARE FUNCTION READDATA$ (ADDR%) DECLARE FUNCTION READGPIB$ (ADDR%, CMD$) DECLARE FUNCTION READPS$ (ADDR%, CMD$) DECLARE FUNCTION REPEAT$ (N$) 'Library fn. Ask if you would like to repeat test DECLARE FUNCTION REPEAT2$ (N$, SN$) 'Library fn. Same as REPEAT$ but with an additional menu for running finals DECLARE FUNCTION RTDOHMS! (TEMP!, SENTYPE$) 'Library fn. Convert RTD in temp to ohms DECLARE FUNCTION RTDTEMP! (OHMS!, SENTYPE$) 'Library fn. Convert RTD ohms to temp DECLARE FUNCTION SENSORNUM% () 'Assign a number to each sensor type DECLARE FUNCTION SENSORIN! (MEASVIN!, PTCV!) 'Calculates sensor input DECLARE FUNCTION SENSOROUT! (PVIN!, PTCV!) 'Calculates module input DECLARE FUNCTION SETAC! (ONOFF%, GENAMPL!) 'Sets AC in Off or On DECLARE FUNCTION SETATTEN% (Voltage!) 'Library fn. Sets test head R/2R ladder DECLARE FUNCTION SETPOWER$ (ADDR%, VSUPPLY!, FUNC$) 'Library fn. Set high voltage input power supply DECLARE FUNCTION STEPRESP$ () 'Performs Step Response Test DECLARE FUNCTION STRINGVAL% (A$) 'Library fn. DECLARE FUNCTION SUPPLYI$ (EXCL%) 'Measure module supply current DECLARE FUNCTION SUPPLYSEN$ () 'Performs Power Supply Sensitivity DECLARE FUNCTION TCVOLTS! (TEMP!, TCTYPE$) 'Library fn. Convert TC in temp to V DECLARE FUNCTION TCTEMP! (TCV!, TCTYPE$) 'Library fn. Convert TC in temp to V DECLARE FUNCTION UPSN$ (SN$) 'Library fn. Increments dash# of serial# DECLARE FUNCTION VOREG$ () 'Tests delta Vo with Exc. load DECLARE FUNCTION VOUT! (SENOUT!) 'Calculates module output for a given input DECLARE FUNCTION LIBVERVAL$ () 'Function to return the library source file version DECLARE SUB WAITFORFINISH () DECLARE SUB FINISHSUB () 'Subroutine to run at "FINISH" label (after F10 keypress). DECLARE FUNCTION LIBVERVAL$ () 'Function to return the library source file version DECLARE FUNCTION PROGVERVAL$ () 'Function to return the program source file version DECLARE FUNCTION PROGNAMEVAL$ () 'Function to return the program executable file name DECLARE FUNCTION MENUCODE% () 'Function to return integer value of 0-35 for keypress of 0-9 or A-Z. DECLARE SUB CHECKRESOURCES (SN$) 'Checks whether the datasheet and work order status files can be written. DECLARE FUNCTION CHECKFILECREATE% (FOLDERNAME$, FILENAME$, KEYTOPRESS$) 'Checks whether the file can be written to the folder. DECLARE FUNCTION CHECKPRINTER% (PrinterMessage$) 'Checks to see of the printer can print. DECLARE FUNCTION WAITFORKEY$ (KEY$, TABPOS%, FORECOL%, BACKCOL%) 'Variables to add to database ' PEDOS AS ? 'MAY NOT BE NEEDED, CALCULATE? ' 'Database Record definition for the specifications Type DBASE MODNAME As String * 15 'SCM5B47X-XXXXT SENTYPE As String * 7 'mV, V, mA, xTC, xxRTDxW, FBRIDGE, 2WTX, HBRIDGE ISMAXNEXCL As Single ISMAXFEXCL As Single OUTRES As Single MININ As Single MAXIN As Single IEXC As Single RCONV As Single MINOUT As Single MAXOUT As Single OSCALPT As Single GNCALPT As Single CALTOL As Single VEXC As Single VEXCACC As Single EXCLOAD As Single EXCLOADREG As Single EXCIMAX As Single LINEAR As Single ACCURACY As Single TESTFREQ As Single ATTEN As Single ATTENTOL As Single STEPRMIN As Single STEPRMAX As Single PSS As Single OUTNOISE As Single INPUTRES As Single VOPENINMIN As Single VOPENINMAX As Single LEADRERR As Single LINEARIZED As Integer '1 = linearized, 0 = non-linearized OSCALIN As Single 'input for offset calibration GNCALIN As Single 'input for gain calibration BANDWIDTH As Single 'filter -3dB point IMATCHTOL As Single 'current source matching tolerance End Type Type DBASE2 RECNUM As Integer MODNAME As String * 15 End Type '$INCLUDE: 'QB.BI2' 'define common variables COMMON SHARED /SAMPLE/ SPECS AS DBASE, SORTDATA1 AS DBASE2, SORTDATA2 AS DBASE2 COMMON SHARED /SAMPLE/ PON%, TX%, SN$, LOGDAT%, TE$, PCBNO$ COMMON SHARED CB0VAL%, CB1VAL%, CB2VAL%, CB3VAL% COMMON SHARED MAINMAX!, MAINMIN!, VERNMAX!, VERNMIN! COMMON SHARED BADDRS%, LPTADDR%, MUXADDR%, THADDR%, PSADDR%, VINADDR% COMMON SHARED PSPORT%, DVMADDR%, GENADDR% COMMON SHARED DPSPSADDR%, DPSVINADDR%, ABCPSADDR%, ABCVINADDR% COMMON SHARED PSMODEL$, VINMODEL$ COMMON SHARED /PRTSCR/ inreg AS RegType, outreg AS RegType COMMON SHARED TTYPE%, MAXINVAR! COMMON SHARED FORCEACCLINFAIL%, FORCEVCJCFAIL%, TESTPAUSE% 'assign constants to Fluke meter commands Const OHM4$ = "F4", OHM2$ = "F3", VODC$ = "F1", VOAC$ = "F2", MADC$ = "F5" 'assign constants to test head variables Const CB0% = 0, CB1% = 1, CB2% = 2, CB3% = 3 'control bank addresses Const CON% = 1, COFF% = 0 'channel 'on' defined as '1' 'off' defined as '0' 'CONST DVMADDR% = 1 'GPIB address of Fluke 8842A meter CONST LOOPOFF$ = "SOP=OFF", LOOPON$ = "SOP=ON", LOCAL$ = "LOC" 'OVERV!, PSILIMIT!, VINOVERV!, VINILIMIT! Const OVERV! = 35 'Power supply over voltage limit Const PSILIMIT! = 500 'Power supply over current limit Const VINOVERV! = 125 'High voltage input voltage limit Const VINILIMIT! = 32 'High voltage input current limit 'assign specifications which are constant for all modules Const IEXCSEN! = 714 'Iexc sense resistor, 2.5Kohm Const RSERIES! = 5100000! '5.1M ohm, test head series input R Const RFNGN! = 6800 'Function generator attenuator series R, 6.8Kohm 'DIM STATUS(21) AS STRING, TSPEC(21) AS STRING Dim STATUS(MAXSTATUSINDEX) As String, TSPEC(MAXSTATUSINDEX) As String Dim TSIM!(5), OUTCALC!(5), OUTMEAS!(5), ERROROUT!(5), ACCSTAT$(5) ' Variable initialization TX% = 0 PON% = 0 '1 = Print test results to printer FORCEACCLINFAIL% = 0 'Flag set "1" to force acc/lin input measurements to fail. FORCEVCJCFAIL% = 0 'Flag set "1" to force Vcjc errors for debug. TESTPAUSE% = 0 '1 = Pause after the status display of each test BADDRS% = &H250 'Base address of PC4311 '488 controller CB0VAL% = &HFF 'Set all lines off CB1VAL% = &HFF CB2VAL% = &HFF CB3VAL% = &HFF 'TE1005 (pcb1044 Rev A) configuration: '(all control lines are active low) 'Use Relay/Mux TE1004 (see below) ' 'Control Bank Line Assignment '------------ ------ ---------- ' 0 7 MSB 0 = Connect Vo to S/H, Start timer ' 6 0 = Connect 2Kohm || 220pF load ' 5 1 = CJC 25C simulation, 0 = CJC 50C simulation ' 4 0 = Tie module inputs to analog ground ' 3 0 = Short module inputs ' 2 0 = Short out 5.1Mohm series input R ' 1 1 = DAC input to module, 0 = Freq. Gen. input ' 0 LSB 0 = Enable output switch ' ' 1 7 MSB 0 = R/2R ladder ' 6 0 = R/2R ladder LSB ' 5 0 = 1Kohm excitation load (0 = Loaded Vs for PSS on Rev A PCB) ' 4 0 = 330ohm excitation load ' 3 0 = 120ohm excitation load ' 2 0 = D.U.T CJC Sensor, 1 = Reference CJC Sensor (LED #2 on Rev A PCB) ' OR 0 = Enable shunt 0.5uF input cap, 1 = Disable ' 1 Vsupply control MSB (0 = 1Kohm excitation load on Rev A PCB) ' 0 LSB Vsupply control LSB (LED #1 on Rev A PCB) ' ' 2 7 MSB 0 = R/2R ladder MSB ' 6 0 = R/2R ladder ' 5 0 = R/2R ladder ' 4 0 = R/2R ladder ' 3 0 = R/2R ladder ' 2 0 = R/2R ladder ' 1 0 = R/2R ladder ' 0 LSB 0 = R/2R ladder ' ' (Control bank 3 not present on Rev A PCB) ' 3 7 MSB 0 = High voltage to +/-IN, inverted polarity ' 6 0 = High voltage to +/-IN, normal polarity ' 5 D.U.T. input; 0 = current source, 1 = R/2R ladder ' 4 Input current sourced from; 0 = +EXC, 1 = +15V ' 3 0 = LED4 ON and CH6+ --> -IN, 1 = CH6+ --> +EXC ' 2 0 = LED3 ' 1 0 = LED2 ' 0 LSB 0 = LED1 'TE1004 Relay/Mux channel assignments 'Mux Channel Assignment '----------- ---------- ' 1 Vin (R/2R ladder output) ' 2 Vout ' 3 Supply current sense resistor ' 4 Simulated CJC sensor output ' 5 Sample/Hold output ' 6 Isolated excitation ' 7 Supply voltage ' 8 DAC output 'TE1012 (pcb1128 Rev A + pcb1129 Rev A daughter card) '(all control lines are active low) 'Use Relay/Mux TE1013 (see below) ' 'Control Bank Line Assignment '------------ ------ ---------- ' 0 7 MSB 0 = Connect 2Kohm || 220pF load ' 6 0 = Connect Vo to S/H, Start timer ' 5 0 = Enable output switch ' 4 Vsupply control MSB ' 3 Vsupply control LSB ' 2 Test Select MSB (See legend below) ' 1 Test Select ' 0 LSB Test Select LSB ' ' 1 7 MSB 0 = R DAC MSB, line 20 of 20 ' 6 0 = R DAC, line 19 ' 5 0 = R DAC, line 18 ' 4 0 = R DAC, line 17 ' 3 0 = LED4 on & CH1- to AC input, 1 = LED4 off & CH1- to -IN ' 2 0 = LED3 on & enable 10 ohm input R during RDAC measurement ' 1 0 = LED2 on & apply 10uF across +5V and GND to check for CD4047 oscillator ' 0 LSB 0 = LED1 on & K11 enable ' ' 2 7 MSB 0 = R DAC, line 16 ' 6 0 = R DAC, line 15 ' 5 0 = R DAC, line 14 ' 4 0 = R DAC, line 13 ' 3 0 = R DAC, line 12 ' 2 0 = R DAC, line 11 ' 1 0 = R DAC, line 10 ' 0 LSB 0 = R DAC, line 9 ' ' 3 7 MSB 0 = R DAC, line 8 ' 6 0 = R DAC, line 7 ' 5 0 = R DAC, line 6 ' 4 0 = R DAC, line 5 ' 3 0 = R DAC, line 4 ' 2 0 = R DAC, line 3 ' 1 0 = R DAC, line 2 ' 0 LSB 0 = R DAC LSB, line 1 'TE1012 Test Select Menu 'Test Description '---- ----------- ' 0 Measure current source #1 (+IN lead) ' 1 Measure current source #2 (-IN lead) ' 2 Standard operation, any R input ' 3 Measure test head contact resistance in input circuit ' 4 Lead resistance effects, 3.3 ohm in each lead ' 5 Lead resistance effects, 0 ohm in each lead ' 6 Frequency generator input ' 7 Disconnect input R and measure 'TE1013 Relay/Mux channel assignments 'Mux Channel Assignment '----------- ---------- ' 1 DUT +/-IN terminals or Function Generator input ' 2 Vout ' 3 Supply current sense resistor ' 4 Iexc sense resistor ' 5 Sample/Hold output ' 6 Contact resistance sense lines, 4-wire ohms ' 7 Supply voltage ' 8 DUT Rin sense lines, 4-wire ohms '****************** MAIN PROGRAM************************************ KEY(10) ON 'Activates F10 key On Key(10) GoSub FINISH 'Traps for F10 key Exits if pressed 'MAXINVAR! = 10.0 'From SETDAC max. DAC voltage (later set in GETSPECS). MAXINVAR! = 0! 'Set to zero to revert to using VOLTAGE! for DAC accuracy (PWR 2014-11-04). TESTPAUSE% = 0 '1 = Pause after the status display of each test Color 11, 0 'Cyan with a black background Cls TX% = 0 PON% = 0 '1 = Print test results to printer LOCATE 5, 23: Print "SCM5Bxx-xx AUTOMATED TEST EQUIPMENT" Print Tab(23); "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" 'LOCATE 10, 20 'PRINT "Initializing test system. Please wait." Cls LOCATE 5, 20: Print "Initializing test system. Please wait." LOCATE 7, 10: Print "EXECUTABLE: "; PROGNAMEVAL$ 'Executable file name LOCATE 8, 10: Print "VERSION: "; PROGVERVAL$ 'Main source code version LOCATE 9, 10: Print "LIB.VERSION: "; LIBVERVAL$ 'Library code version LOCATE 10, 10: Print "SOURCE FILES: "; SOURCEFILES$ 'List of all code files for the program Call CONTINUE Cls FILENAME$ = "ABC5BVIN.ADR" 'Parallel port, mux & test head addresses Call GETADD(FILENAME$) 'Gets the Parallel port, Mux and Testhead address Call INIT488(DVMADDR%) 'Initialize the GPIB interface PSID% = GETPSID% 'Determine and initiate communication with Power supply Call CONTINUE LOCATE 10, 10 Print Tab(20); "Initializing DVM..." Call WRITEDVM("*T2S1", 0) 'Initialize Fluke meter Print Tab(20); "Initializing relay mux..." Call LOADMUX(0, CON%) 'Resets MUX TE$ = "TE1005" 'Assign test head #, defines channel THID% = GETTHID% 'Get test head ID # ' PRINT "THID% = "; THID% If THID% = 0 Then Print Tab(20); "Initializing test head "; TE$; "..." CBVAL% = &HFF For BANK% = 0 To 3 'open all relays Call SETTH(CBVAL%, BANK%) Call PAUSE(0.05) Next Print Tab(20); "Initializing DAC..." Call CALDAC(TE$) 'Calibrate DAC If TE$ = "ERROR" Then 'BEEP Print Print Tab(20); "SYSTEM STARTUP ERROR" Print Tab(20); "DAC is not connected or is faulty." Print Tab(20); "Check system setup and restart program." Stop End If Call SETDAC(0!, 1, MAXINVAR!, 0) 'Clear attenuator, short inputs Print Tab(20); "Initializing power supply..." Call POWERON(0!) Else F% = F% + 1 End If TE$ = "TE1012" 'Assign test head #, defines channel 'PRINT "TE$ = TE1012" 'used for DAC input. 'CALL CONTINUE FILENAME$ = "ABC5BRIN.ADR" 'Parallel port, mux & test head addresses Call GETADD(FILENAME$) 'Gets the Parallel port, Mux and Testhead address Call LOADMUX(0, CON%) 'Resets MUX in the event that is wasn't reset above. If THID% = 1 Then Print Tab(20); "Initializing test head "; TE$; "..." Open "C:\ATE\5BDATA\TE1012DT.DAT" For Input As #5 Input #5, DT$ Close #5 If DT$ <> Date$ Then Call RTDTHCAL Open "C:\ATE\5BDATA\TE1012DT.DAT" For Output As #5 Write #5, Date$ Close #5 End If NOMRIN! = 100! Call OHMSET(NOMRIN!) 'Nominal resistance input RSIM! = MEASRES!(NOMRIN!, 3, "") Call SETTEST(2) 'Initialize RTD test head for standard operation Print Tab(20); "Initializing power supply..." Call POWERON(0!) Else F% = F% + 1 End If If F% = 2 Then LOCATE 10, 10 Print "Test heads not connected or faulty connections." Stop 'No test heads connected End If START: KEY(9) ON 'Activates F9 key On Key(9) GoSub START 'Traps for F9 key and returns to the main menu if pressed If SENSORNUM% = 1 And (SPECS.MAXIN > 10 Or SPECS.MININ < -10 Or SPECS.OSCALIN < -10) Then SL$ = SETPOWER(VINADDR%, 999!, LOOPOFF$) 'Turn off loop power SL$ = SETPOWER(VINADDR%, 999!, LOCAL$) 'Return to local mode End If LOGDAT% = -1 'Log linearity test data OFF Do 'Main program loop SN$ = "" 'Reset serial number SEL% = MENU1% 'Gets the # of the sub program Select Case SEL% 'Branches to the specific Tests '*********************** Offset/Gain and Excitation Calibration ****************************** Case 1 TX% = 0 'No datasheet file 'PON% = 0 'Do not send results to printer CAL% = 0 'Calibrate o.s. & gain. Call GETSPECS 'Gets module test specs If Left$(SPECS.MODNAME, 7) = "SCM5BPT" Or Left$(SPECS.MODNAME, 10) = "SCM5B-1369" Then Cls LOCATE 10, 6: Print SPECS.MODNAME Print Tab(6); "Return to the main menu and use menu selection 6 to test this product." Call CONTINUE ElseIf Left$(SPECS.MODNAME, 4) <> "EXIT" Then Call CALTEST(CAL%) If PON% = 1 Then LPRINT Chr$(12) 'Send form feed to printer if print flag is "on" End If '*********************** Pre-Encap Complete Test ****************************** Case 2 TX% = 0 'No datasheet file 'PON% = 0 'Do not send results to printer CAL% = 0 'Calibrate o.s. & gain. Call GETSPECS 'Gets module test specs If Left$(SPECS.MODNAME, 7) = "SCM5BPT" Or Left$(SPECS.MODNAME, 10) = "SCM5B-1369" Then Cls LOCATE 10, 6: Print SPECS.MODNAME Print Tab(6); "Return to the main menu and use menu selection 6 to test this product." Call CONTINUE ElseIf Left$(SPECS.MODNAME, 4) <> "EXIT" Then Call GENSET(GENAMPL!) 'Displays message to set signal gen. Do 'Complete test loop start Call COMPTEST(STATUS$(), CAL%, GENAMPL!, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$(), TOTLRESPEC!) 'Performs complete set of tests Call TSPECS(TSPEC$(), TOTLRESPEC!) 'Sets up a string with the test specifications WIDTH , 43 'Change screen lines to 43 Call REPORT(STATUS$(), TSPEC$()) 'Prints data to screen If PON% = 1 Then LPRINT Chr$(12) 'Send form feed to printer if print flag is "on" 'CALL INTERLUDE Call WAITFORFINISH WIDTH , 25 'Change screen lines (back) to 25 Loop While REPEAT$(SPECS.MODNAME) <> "N" 'End of Complete Test loop Cls If SENSORNUM% = 1 And (SPECS.MAXIN > 10 Or SPECS.MININ < -10 Or SPECS.OSCALIN < -10) Then Print Print Tab(5); "Insert the yellow connector into the meter +/-SENSE terminals." Call CONTINUE End If If Mid$(SPECS.MODNAME, 10, 4) = "1442" Or Mid$(SPECS.MODNAME, 10, 4) = "1443" Then 'units with +EXC and -IN shorted Call REMEXCPIN(0) 'Reconnect +EXC from the test interface board End If End If '**************** Post-Encap Complete Test *********************************** Case 3 TX% = 1 'Print datasheet file Call HARDCOPY 'Ask for hardcopy printout CAL% = 0 'calibrate o.s & gain Call GETSPECS 'Gets module test specs If Left$(SPECS.MODNAME, 7) = "SCM5BPT" Or Left$(SPECS.MODNAME, 10) = "SCM5B-1369" Then Cls LOCATE 10, 6: Print SPECS.MODNAME Print Tab(6); "Return to the main menu and use menu selection 6 to test this product." Call CONTINUE ElseIf Left$(SPECS.MODNAME, 4) <> "EXIT" Then Call GENSET(GENAMPL!) 'Displays message to set signal generator Call GETSN(SN$) 'Gets module serial # Call CHECKRESOURCES(SN$) 'Check for ability to write datasheet and status files. Call WORKORDERHEADER(SN$) 'Write header to work order status file Do 'Start of Test loop Call HEADERA(SN$) 'Prints data sheet header on printer Call COMPTEST(STATUS$(), CAL%, GENAMPL!, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$(), TOTLRESPEC!) 'Performs complete set of tests Call TSPECS(TSPEC$(), TOTLRESPEC!) 'Creates a string of test parameters WIDTH , 43 'Change screen lines to 43 Call REPORT(STATUS$(), TSPEC$()) 'Displays test results Call FOOTER(STATUS$()) 'Prints footer if no fails 'Log test results to data log, datasheet and work order status files Call LOGMODFILES(STATUS$(), SN$, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$(), TSPEC$(), TOTLRESPEC!, TX%) 'CALL INTERLUDE WIDTH , 25 'Change screen lines (back) to 25 Loop While REPEAT2$(SPECS.MODNAME, SN$) <> "N" 'End of test loop Cls Print Tab(10); "Printing work order status file: "; WO$ + ".TXT" Call WORKORDERPRINT(SN$) 'Print the work order status file after "N" (not testing more of same module type) Cls If SENSORNUM% = 1 And (SPECS.MAXIN > 10 Or SPECS.MININ < -10 Or SPECS.OSCALIN < -10) Then Print Print Tab(5); "Insert the yellow connector into the meter +/-SENSE terminals." Call CONTINUE End If If Mid$(SPECS.MODNAME, 10, 4) = "1442" Or Mid$(SPECS.MODNAME, 10, 4) = "1443" Then 'units with +EXC and -IN shorted Call REMEXCPIN(0) 'Reconnect +EXC from the test interface board End If End If '**************** Sealed Module Re-Test *********************************** Case 4 TX% = 1 'Print datasheet file Call HARDCOPY 'Ask for hardcopy printout (PWR) CAL% = 4 'Check o.s & gain Call GETSPECS 'Gets module test specs If Left$(SPECS.MODNAME, 7) = "SCM5BPT" Or Left$(SPECS.MODNAME, 10) = "SCM5B-1369" Then Cls LOCATE 10, 6: Print SPECS.MODNAME Print Tab(6); "Return to the main menu and use menu selection 6 to test this product." Call CONTINUE ElseIf Left$(SPECS.MODNAME, 4) <> "EXIT" Then Call GENSET(GENAMPL!) 'Displays message to set signal generator Call GETSN(SN$) 'Gets module serial # Call CHECKRESOURCES(SN$) 'Check for ability to write datasheet and status files. Call WORKORDERHEADER(SN$) 'Write header to work order status file Do 'Start of Test loop Call HEADERA(SN$) 'Prints data sheet header on printer Call COMPTEST(STATUS$(), CAL%, GENAMPL!, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$(), TOTLRESPEC!) 'Performs complete set of tests Call TSPECS(TSPEC$(), TOTLRESPEC!) 'Creates a string of test parameters WIDTH , 43 'Change screen lines to 43 Call REPORT(STATUS$(), TSPEC$()) 'Displays test results Call FOOTER(STATUS$()) 'Prints footer if no fails 'Log test results to data log, datasheet and work order status files Call LOGMODFILES(STATUS$(), SN$, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$(), TSPEC$(), TOTLRESPEC!, TX%) 'CALL INTERLUDE WIDTH , 25 'Change screen lines (back) to 25 Loop While REPEAT2$(SPECS.MODNAME, SN$) <> "N" 'End of test loop Cls Print Tab(10); "Printing work order status file: "; WO$ + ".TXT" Call WORKORDERPRINT(SN$) 'Print the work order status file after "N" (not testing more of same module type) Cls If SENSORNUM% = 1 And (SPECS.MAXIN > 10 Or SPECS.MININ < -10 Or SPECS.OSCALIN < -10) Then Print Print Tab(5); "Insert the yellow connector into the meter +/-SENSE terminals." Call CONTINUE End If If Mid$(SPECS.MODNAME, 10, 4) = "1442" Or Mid$(SPECS.MODNAME, 10, 4) = "1443" Then 'units with +EXC and -IN shorted Call REMEXCPIN(0) 'Reconnect +EXC from the test interface board End If End If '***********************Individual Test Routines****************************** Case 5 TX% = 0 'No datasheet file 'PON% = 0 'Do not send results to printer CAL% = 0 'calibrate o.s & gain Do 'Start of loop SEL% = MENU2% 'Gets # of test If SEL% <> 21 Then 'Checks for exit (character L) If SEL% = 18 Then 'Character I Call NOTES 'Print ATE notes ElseIf SEL% = 19 Then 'Character J LPRINT Chr$(12) 'Form feed ElseIf SEL% = 22 Then 'Character M Call ONESHOTTEST If PON% = 1 Then LPRINT Chr$(12) 'Send form feed to printer if print flag is "on" ElseIf SEL% = 23 Then 'Character N 'Toggles "FORCEACCLINFAIL" debug flag If FORCEACCLINFAIL% = 1 Then Cls FORCEACCLINFAIL% = 0 Else 'Turn on "force acc/lin input error" flag 'only if correct password is entered. Cls PWFOP$ = "" 'Clear password LOCATE 10, 10: INPUT "Enter password "; PWFOP$ PWFOP$ = UCase$(PWFOP$) If (PWFOP$ = "DATA4TH") Then FORCEACCLINFAIL% = 1 Else FORCEACCLINFAIL% = 0 End If End If LOCATE 20, 10: Print "Force acc/lin input fails (debug only) flag = "; FORCEACCLINFAIL% Call CONTINUE ElseIf SEL% = 24 Then 'Character O 'Toggles "FORCEVCJCFAIL" debug flag If FORCEVCJCFAIL% = 1 Then Cls FORCEVCJCFAIL% = 0 Else 'Turn on "force acc/lin input error" flag 'only if correct password is entered. Cls PWFOP$ = "" 'Clear password LOCATE 10, 10: INPUT "Enter password "; PWFOP$ PWFOP$ = UCase$(PWFOP$) If (PWFOP$ = "DATA4TH") Then FORCEVCJCFAIL% = 1 Else FORCEVCJCFAIL% = 0 End If End If LOCATE 20, 10: Print "Force Vcjc fails (debug only) flag = "; FORCEVCJCFAIL% Call CONTINUE ElseIf SEL% = 20 Then 'Character K 'Utility Menu. Do 'Start of Utility menu loop SEL4% = UTILMENU% 'Gets # from Utility menu If SEL4% <> 4 Then 'Checks for exit. If SEL4% = 1 Then 'Checks for printer toggle. 'Toggles printer status If PON% = 1 Then PON% = 0 Else PON% = 1 End If ElseIf SEL4% = 2 Then LOGDAT% = -LOGDAT% ElseIf SEL4% = 3 Then 'Checks for pause on each test toggle. 'Toggles "pause on each test" flag If TESTPAUSE% = 1 Then TESTPAUSE% = 0 Else TESTPAUSE% = 1 End If End If End If Loop Until SEL4% = 4 'End of loop Else Call GETSPECS 'Gets module specs If Left$(SPECS.MODNAME, 7) = "SCM5BPT" Or Left$(SPECS.MODNAME, 10) = "SCM5B-1369" Then Cls LOCATE 10, 6: Print SPECS.MODNAME Print Tab(6); "Return to the main menu and use menu selection 6 to test this product." Call CONTINUE ElseIf Left$(SPECS.MODNAME, 4) <> "EXIT" Then Call INDIVID(SEL%, CAL%) 'Performs individual test If PON% = 1 Then LPRINT Chr$(12) 'Send form feed to printer if print flag is "on" End If End If End If Loop Until SEL% = 21 'End of loop (character L) '*************************** Pass-Thru Module Test ********************************* Case 6 TX% = 0 'No datasheet file 'PON% = 0 'Do not send results to printer CAL% = 4 'Check o.s & gain (not actually used here) Call GETSPECS 'Gets module test specs If Left$(SPECS.MODNAME, 7) <> "SCM5BPT" And Left$(SPECS.MODNAME, 10) <> "SCM5B-1369" Then Cls LOCATE 10, 2: Print SPECS.MODNAME Print Tab(2); "Return to the main menu and use another menu selection to test this product." Call CONTINUE ElseIf Left$(SPECS.MODNAME, 4) <> "EXIT" Then Cls TESTTITLE$ = "Test Selection" Call HEADERB(TESTTITLE$) LOCATE 5 Print Tab(27); "1.) Pre-Encapsulation Test" Print Tab(27); "2.) Post Encapsulation Test" Do I$ = INKEY$ Loop While Val(I$) < 1 Or Val(I$) > 2 MENU4% = Val(I$) If MENU4% = 2 Then 'Post-encapsulation test TX% = 1 'Print datasheet file Call HARDCOPY 'Ask for hardcopy printout (PWR) Call GETSN(SN$) 'Gets module serial # Call CHECKRESOURCES(SN$) 'Check for ability to write datasheet and status files. Call WORKORDERHEADER(SN$) 'Write header to work order status file Else TX% = 0 'No datasheet file End If Do 'Start of Test loop If MENU4% = 2 Then Call HEADERA(SN$) 'Prints data sheet header on printer End If Call PASSTHRUTEST(STATUS$(), TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$()) 'Performs complete set of tests Call TSPECS(TSPEC$(), TOTLRESPEC!) 'Creates a string of test parameters WIDTH , 43 'Change screen lines to 43 Call REPORT(STATUS$(), TSPEC$()) 'Displays test results If MENU4% = 2 Then 'Post-encapsulation test Call FOOTER(STATUS$()) 'Prints footer if no fails 'Log test results to data log, datasheet and work order status files Call LOGMODFILES(STATUS$(), SN$, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$(), TSPEC$(), TOTLRESPEC!, TX%) 'CALL INTERLUDE WIDTH , 25 'Change screen lines (back) to 25 LP$ = REPEAT2$(SPECS.MODNAME, SN$) Else If PON% = 1 Then LPRINT Chr$(12) 'Send form feed to printer if print flag is "on" Call CONTINUE 'Waits for key press WIDTH , 25 'Change screen lines (back) to 25 LP$ = REPEAT$(SPECS.MODNAME) End If Loop While LP$ <> "N" 'End of test loop If MENU4% = 2 Then 'Post-encapsulation test Cls Print Tab(10); "Printing work order status file: "; WO$ + ".TXT" Call WORKORDERPRINT(SN$) 'Print the work order status file after "N" (not testing more of same module type) Cls End If End If '*************************** End Program Selection ********************************* Case 7 ENDPROG% = 1 'Sets end program flag End Select Loop While ENDPROG% <> 1 'Loops until end program flag set FINISH: 'Exit program from F10 keypress Call FINISHSUB End 'End of program Function CALMENU%() TESTTITLE$ = "Post Calibration Test Options" Cls Color 14, 0, 0 LOCATE 2, 23: TESTTITLE$ = "Post Calibration Test Options" Call HEADERB(TESTTITLE$) Color 15, 0, 0 LOCATE 6 Print Tab(14); "Please select the desired option for the next test:" LOCATE 8 Color 11, 0, 0 Print Tab(22); "1.) Repeat OFFSET/GAIN calibration" Print Tab(22); "2.) Perform LINEARITY/ACCURACY test" Print Tab(22); "3.) EXIT to individual test menu" Print Print Do I$ = INKEY$ Loop While Val(I$) < 1 Or Val(I$) > 3 SEL2% = Val(I$) CALMENU% = SEL2% End Function Sub CALSEQ(CAL%) 'Determine which calibration sequence is required for the module 'and perform the offset and gain calibration. MININ! = SENSOROUT!(SPECS.MININ, 0) 'Determine min in MAXIN! = SENSOROUT!(SPECS.MAXIN, 0) 'Determine max in MINOUT! = SPECS.MINOUT MAXOUT! = SPECS.MAXOUT ACC! = SPECS.ACCURACY INRANGE! = MAXIN! - MININ! ORANGE! = MAXOUT! - MINOUT! SNM% = SENSORNUM% MN$ = SPECS.MODNAME If Left$(MN$, 12) = "SCM5B41-1117" Then DIRO% = 1 'O.S. pot clockwise = neg chg DIRG% = 1 'Gain pot clockwise = pos chg ElseIf Left$(MN$, 12) = "SCM5B41-1174" Then DIRO% = 1 'O.S. pot clockwise = pos chg DIRG% = 0 'Gain pot clockwise = neg chg Else INTERACT! = 1 DIRO% = 1 'O.S. pot clockwise = pos chg DIRG% = 1 'Gain pot clockwise = pos chg If Left$(MN$, 10) = "SCM5B36-01" Or Left$(MN$, 12) = "SCM5B38-1146" Or Left$(MN$, 12) = "SCM5B38-1232" Then '0 to 100 ohm input. Offset is 'calibrated @ 8 ohms in, resulting 'in slight calibration interaction. ITERATION% = 3 ElseIf Left$(MN$, 12) = "SCM5B35-1760" Then 'To ensure a tighter calibration ITERATION% = 2 ElseIf SNM% = 3 And Abs(INRANGE!) <= 0.015 Then ITERATION% = 2 Else ITERATION% = 1 End If End If If SNM% = 1 Then VF = 2 * (MINOUT! * MAXIN! - MININ! * MAXOUT!) / (MAXOUT! - MINOUT!) INTERACT! = (SPECS.OSCALIN + VF) / (SPECS.GNCALIN + VF) Do If INTERACT <> 0 Then 'If INTERACT! is not equal to zero, then check offset, adjust gain, offset, gain, offset CAL% = 3 A$ = OFFSETCAL$(CAL%, CONTRES!, DIRO%) 'Check offset DATALEN% = Len(A$) OSERR2! = Val(Mid$(A$, 5, DATALEN% - 5)) CAL% = 0 B$ = GAINCAL$(CAL%, CONTRES!, PFSMEAS!, INTERACT!, OSERR2!, DIRG%) 'Calibrate gain DATALEN% = Len(B$) GNERR2! = Val(Right$(B$, DATALEN% - 4)) 'Measured gain error (%) End If 'If there is NO interaction, just adjust OFFSET, then adjust GAIN CAL% = 0 A$ = OFFSETCAL$(CAL%, CONTRES!, DIRO%) 'Calibrate offset DATALEN% = Len(A$) OSERR2! = Val(Right$(A$, DATALEN% - 4)) '% B$ = GAINCAL$(CAL%, CONTRES!, PFSMEAS!, INTERACT!, OSERR2!, DIRG%) 'Calibrate gain DATALEN% = Len(B$) GNERR2! = Val(Right$(B$, DATALEN% - 4)) 'Measured gain error (%) If INTERACT <> 0 Then CAL% = 3 A$ = OFFSETCAL$(CAL%, CONTRES!, DIRO%) 'Measures offset error DATALEN% = Len(A$) OSERR2! = Val(Right$(A$, DATALEN% - 4)) '% GNERR2! = Val(Right$(B$, DATALEN% - 4)) 'Measured gain error (%) End If Loop Until 2 * Abs(OSERR2!) < ACC! And 2 * Abs(GNERR2!) < ACC! End If If INTERACT! = 1 Then 'Standard calibration sequence Do If SNM% >= 5 And SNM% <= 7 Then 'Check if resistance in Call POWERON(0!) Call WRITEDVM("S0", 0) 'Slow reading rate for max accuracy CONTRES! = MEASRES!(1!, 4, "") 'Measure contact resistance End If A$ = OFFSETCAL$(0, CONTRES!, DIRO%) Call POWERON(0!) A$ = GAINCAL$(0, CONTRES!, PFSMEAS!, INTERACT!, OSERR2!, DIRG%) ITERATION% = ITERATION% - 1 Loop While ITERATION% > 0 'Tests for Offset/Gain calibration end End If End Sub Sub CALTEST(CAL%) 'Runs offset and gain calibration tests. ' If SENSOROUT!(SPECS.MININ, 0) = 99! Then 'Check for valid sensor type. Print Tab(10); "Exiting CALTEST for invalid sensor type!." Call CONTINUE Exit Sub End If Call ENABLE(CON%) 'Enable output switch. SNM% = SENSORNUM% If SNM% = 11 Then HALFBRIDGE% = 1 'Enable shunt input cap. CB1VAL% = CB1VAL% And &HFB '1 1 1 1 1 0 1 1 Call SETTH(CB1VAL%, CB1%) Else HALFBRIDGE% = 0 End If If Left$(SPECS.MODNAME, 12) = "SCM5B38-1146" Then Call CASEINST 'Tell user to install a case over the unit End If Do Call CALSEQ(CAL%) 'Run offset and gain calibration sequence. If SNM% = 8 Or SNM% = 9 Or SNM% = 10 Or SNM% = 11 Then A$ = EXCCAL$(0) 'Run excitation calibration test. End If Call CONTINUE Call POWERON(0!) 'Turns off module power Loop While REPEAT$(SPECS.MODNAME) <> "N" If SNM% = 1 And (SPECS.MAXIN > 10 Or SPECS.MININ < -10 Or SPECS.OSCALIN < -10) Then Print Print Tab(5); "Insert the yellow connector into the meter +/-SENSE terminals." Call CONTINUE End If If HALFBRIDGE% = 1 Then 'Disable shunt input cap. CB1VAL% = CB1VAL% Or &H4 '0 0 0 0 0 1 0 0 Call SETTH(CB1VAL%, CB1%) End If If Mid$(SPECS.MODNAME, 10, 4) = "1442" Or Mid$(SPECS.MODNAME, 10, 4) = "1443" Then 'units with +EXC and -IN shorted Call REMEXCPIN(0) 'Reconnect +EXC from the test interface board End If End Sub Function CJCGAIN$() 'Measure gain of the CJC input (Seebeck coefficient) 'Reference TC theory notes on 12/20/96 for details. 'Method is based on the measured module gain around 'delta Ta = 25C. ' TCTYPE$ = Left$(SPECS.SENTYPE, 1) 'Determine TC type MINTIN! = SPECS.MININ MAXTIN! = SPECS.MAXIN MINOUT! = SPECS.MINOUT MAXOUT! = SPECS.MAXOUT GCJCMAXERR! = 0.035 '3.5% error limit, 0.5C error over 25C Ta change ORANGE! = MAXOUT! - MINOUT! INRANGE! = MAXTIN! - MINTIN! 'Input range (deg. C) Cls TESTTITLE$ = "Cold Junction Compensation Gain" Call HEADERB(TESTTITLE$) LOCATE 10, 10 SNM% = SENSORNUM% If SNM% <> 3 Then Print Tab(10); "This test is performed on thermocouple input modules only," Print Tab(10); "(except Type B)." Call CONTINUE Exit Function Else Print "Testing, please wait..." End If PTCV! = PARASITICTCV!(VCJC!) If VCJC! = 99! Then Print Tab(10); "Error in CJCGAIN$ test:" Print Tab(10); "Vcjc = 99 (error value)!" CJC$ = "FAIL" 'Set FAIL status. SOUND 1000, 0.5 'Beep to alert to failure. CJCGAIN$ = CJC$ + "V" 'Set function output to FAIL status with trailing "V" for special formatting. Call FAILSTATUS(CJC$, 15, 10, "Status: ", 40) 'Print test status to screen Exit Function End If MININ1! = SENSOROUT!(MINTIN, PTCV!) 'Calc. minin, MININ2! = SENSOROUT!(MINTIN!, PTCV!) + PTCV! 'Calc. minin ' '2nd simulated CJC temp is 0C 'MININ2! = SENSOROUT!((MINTIN! + .1 * INRANGE!), PTCV!) 'Calc. minin 'JL 10/22/04. 25C change for input gain measurement too small for R, S. 'Most linearizers will have 1st breakpoint after 10%, therefore use 'delta Vin = 10%. 'CG 10/25/04. Change back to 25C change in order to match CJC change. '2nd simulated CJC temp is 0C Call SETDAC(MININ1!, 1, MAXINVAR!, 0) 'Set -f.s. input 'Medium reading rate for speed. Measure Vout with 'approx 0.5100V (25C) input to CJC port. Call WRITEDVM("S1", 0) Call WRITEDVM(VODC$, MINOUT!) 'Sets meter to read output Call LOADMUX(2, CON%) VOUT4! = READDVM!(0.0001) Call LOADMUX(2, COFF%) MININ1MEAS! = MININ1! 'Use ideal value 'Measure Vout with approx 0.5100V '(25C) input to CJC port. Call SETDAC(MININ2!, 1, MAXINVAR!, 0) 'Set -f.s. input LOCATE 15, 10 Print "Measuring Vout @ Tin = -f.s and Ta = 25C..." ' CALL WRITEDVM(VODC$, VOUT(MINTIN! + 25!)) 'Sets meter to read output Call WRITEDVM(VODC$, 999!) 'Sets up Meter (Autorange) 'CALL WRITEDVM(VODC$, VOUT(MINTIN! + .1 * INRANGE!)) 'Sets meter to read output 'JL 10-22-04. 25C change for input gain measurement too small for R, S. 'Most linearizers will have 1st breakpoint after 10%, therefore use 'delta Vin = 10%. 'CG 10/25/04. Change back to 25C change in order to match CJC change. Call LOADMUX(2, CON%) VOUT1! = READDVM!(0.0001) Call LOADMUX(2, COFF%) MININ2MEAS! = MININ2! 'Use ideal value TAMB1! = 25! + (VCJC! - 0.51) / -0.0025 CB0VAL% = CB0VAL% And &HDF '1 1 0 1 1 1 1 1 Call SETTH(CB0VAL%, CB0%) 'CJC 0C simulation Print Tab(10); "Measuring simulated Ta = 0C..." Call WRITEDVM(VODC$, 0.5725) 'Sets meter to read output Call LOADMUX(4, CON%) VCJC2! = READDVM!(0.0001) 'Measured on SLOW reading rate 'Force error value for debug (PWR 2014-11-12). If FORCEVCJCFAIL% = 1 Then VCJC2! = 99! End If If VCJC2! > 0.5825 Then 'Check for > 0C simulated SOUND 1000, 0.5 Print Print Tab(10); "Error in CJCGAIN$ test:" Print Tab(10); "Test head temperature sensor malfunction." Print Tab(10); "Vcjc = "; VCJC2!; "V" CJC$ = "FAIL" 'Set FAIL status. SOUND 1000, 0.5 'Beep to alert to failure. CJCGAIN$ = CJC$ + "V" 'Set function output to FAIL status with trailing "V" for special formatting. Call FAILSTATUS(CJC$, 15, 10, "Status: ", 35) 'Print test status to screen Exit Function End If Call LOADMUX(4, COFF%) TAMB2! = 25! + (VCJC2! - 0.51) / -0.0025 SEEBECK! = (TCVOLTS!(50!, TCTYPE$) - TCVOLTS!(0!, TCTYPE$)) / 50! Print Tab(10); "Measuring Vout @ Tin = -f.s and Ta = 0C..." Call WRITEDVM(VODC$, MINOUT! + 1) 'Sets meter to read output Call LOADMUX(2, CON%) VOUT2! = READDVM!(0.0001) Call LOADMUX(2, COFF%) Call WRITEDVM("S1", 0) 'Medium reading rate CB0VAL% = CB0VAL% Or &H20 '0 0 1 0 0 0 0 0 Call SETTH(CB0VAL%, CB0%) 'CJC 25C simulation GCJCMEAS! = (VOUT2! - VOUT1!) * (MININ2MEAS! - MININ1MEAS!) / (VOUT1! - VOUT4!) / (TAMB2! - TAMB1!) If Abs((GCJCMEAS! - SEEBECK!) / SEEBECK!) <= GCJCMAXERR! Then CJC$ = "PASS" Else CJC$ = "FAIL" SOUND 1000, 0.5 End If LOCATE 16, 10 Print Spc(25); 'LOCATE 15, 10 'PRINT "Status: "; CJC$; 'CALL FAILSTATUS (CJC$, 15, 10, "Status: ") 'Print test status to screen Print Spc(31); Print Tab(10); "Measured CJC gain is"; Print Tab(35); USING; "###.## uV/C"; GCJCMEAS! * 1000000! Print Tab(10); "Required CJC gain is"; Print Tab(35); USING; "###.## uV/C to ###.## uV/C"; SEEBECK! * 1000000! * (1 - GCJCMAXERR!); SEEBECK! * 1000000! * (1 + GCJCMAXERR!) Print Spc(75); Call FAILSTATUS(CJC$, 15, 10, "Status: ", 30) 'Print test status to screen CJCGAIN$ = CJC$ + Str$(GCJCMEAS! * 1000000!) + "2" Call RESETTH 'Reset the test head Call PAUSE(0.2) End Function Sub COMPTEST(STATUS$(), CAL%, GENAMPL!, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$(), TOTLRESPEC!) 'Runs complete set of tests. If SENSOROUT!(SPECS.MININ, 0) = 99! Then 'Check for valid sensor type Print Tab(10); "Exiting COMPTEST for invalid sensor type!." SOUND 1000, 0.5 'Beep to alert to failure. Call CONTINUE Exit Sub End If For X = 1 To MAXSTATUSINDEX 'Clear test result array STATUS$(X) = "" Next X SNM% = SENSORNUM% Call ENABLE(CON%) 'Enable output switch If SNM% = 11 Then HALFBRIDGE% = 1 'Enable shunt input cap. CB1VAL% = CB1VAL% And &HFB '1 1 1 1 1 0 1 1 Call SETTH(CB1VAL%, CB1%) Else HALFBRIDGE% = 0 End If If Left$(SPECS.MODNAME, 12) = "SCM5B38-1146" Then Call CASEINST 'Tell user to install a case over the unit End If STATUS$(1) = SUPPLYI$(0) 'Supply current test. Sets Vs to +5.0V, no excitation load. If Left$(STATUS$(1), 4) = "FAIL" Then Exit Sub 'Exit on overcurrent. 'Power is shut off within SUPPLYI$. If SNM% >= 8 And SNM% <= 11 Then 'Bridge, 2-wire transmitter or DCLVDT module. Call POWERON(0) 'Set Vsupply to 0V STATUS$(2) = SUPPLYI$(1) 'Supply current test with full excitation load. Else 'Other modules: skip test and set a PASS status. STATUS$(2) = "PASS" End If If Left$(STATUS$(2), 4) = "FAIL" Then Exit Sub 'Exit on overcurrent. Power is shut off within SUPPLYI$. If SNM% >= 5 And SNM% <= 7 Then 'Resistance input module. Call POWERON(0) 'Set Vsupply to 0V. If SNM% = 5 Or SNM% = 7 Then STATUS$(4) = IEXC2$(IEXCSENSE!) STATUS$(3) = IEXC1$(IEXCSENSE!) STATUS$(5) = IMATCH$(STATUS$(3), STATUS$(4)) Else STATUS$(3) = IEXC1$(IEXCSENSE!) STATUS$(4) = "PASS" STATUS$(5) = "PASS" End If Call RESETTH 'Reset for testhead for standard operation. Else 'Not a resistance-input module: skip tests and set PASS status for each test. STATUS$(3) = "PASS" STATUS$(4) = "PASS" STATUS$(5) = "PASS" End If If (Left$(SPECS.MODNAME, 12) = "SCM5B41-1118") Or (Left$(SPECS.MODNAME, 10) = "SCM5B38SEV") Then 'Skip output switch test and set PASS status for specific modules. STATUS$(6) = "PASS" Else 'Run output switch test for other modules. STATUS$(6) = OUTSWITCH$ 'Output switch test. End If If Left$(STATUS$(6), 4) = "FAIL" Then 'Module failed output switch test. Module not functional, so turn off 'module supply and exit the subroutine to skip remaining tests. Call POWERON(0!) 'Set Vsupply to 0V Exit Sub End If If CAL% <> 4 Then Call CALSEQ(CAL%) End If If SNM% >= 8 And SNM% <= 11 Then 'Bridge, 2-wire transmitter or DCLVDT module, so 'perform excitation tests. STATUS$(8) = EXCCAL$(CAL%) 'Excitation calibration STATUS$(9) = EXCREG$ 'Excitation load regulation STATUS$(10) = VOREG$ 'Vout regulation with exc. load STATUS$(11) = EXCILIM$ 'Excitation current limit Call RESETTH 'Reset the test head Else 'Skip excitation tests and set PASS status for each test for other modules. STATUS$(8) = "PASS" STATUS$(9) = "PASS" STATUS$(10) = "PASS" STATUS$(11) = "PASS" End If If SNM% = 3 Then STATUS$(7) = CJCGAIN$ 'Measure CJC gain End If If SNM% >= 5 And SNM% <= 7 Then 'Resistance input module. Turn off module power and measure contact resistance. Call POWERON(0!) 'Turn off power Call WRITEDVM("S0", 0) 'Slow reading rate for max accuracy CONTRES! = MEASRES!(1!, 4, "") 'Measure contact resistance End If 'Performs linearity and accuracy tests and assign results of linearity test. STATUS$(12) = LINTEST$(ACC$, CONTRES!, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$()) STATUS$(13) = ACC$ 'Assign results of accuracy test. STATUS$(14) = "PASS" 'Skip test and assign PASS result. STATUS$(15) = SUPPLYSEN$ 'Power supply sensitivity test. STATUS$(16) = "PASS" 'Skip test and assign PASS result. If SPECS.VOPENINMIN <> 0 Then STATUS$(17) = OPENIN$ 'Open input response Else STATUS$(17) = "PASS" End If If HALFBRIDGE% = 1 Then 'Disable shunt input cap. CB1VAL% = CB1VAL% Or &H4 '0 0 0 0 0 1 0 0 Call SETTH(CB1VAL%, CB1%) End If STATUS$(18) = FREQRESP$(GENAMPL!) 'Frequency response test/ If SPECS.STEPRMIN < 97 And SENSOROUT!(SPECS.MAXIN, 0) < 25! And (SNM% < 5 Or SNM% > 7) Then STATUS$(19) = STEPRESP$ 'Step response test. Else STATUS$(19) = "PASS" End If STATUS$(20) = OUTNOISE$ 'Output noise test. Call POWERON(0!) 'Turn off module power. End Sub Sub ENABLE(ONOFF%) If ONOFF% = 0 Then 'Disable output switch If TE$ = "TE1012" Then 'TE1012 CB0VAL% = CB0VAL% Or &H20 '0 0 1 0 0 0 0 0 Else 'TE1005 CB0VAL% = CB0VAL% Or &H1 '0 0 0 0 0 0 0 1 End If Else 'Enable output switch If TE$ = "TE1012" Then 'TE1012 CB0VAL% = CB0VAL% And &HDF '1 1 0 1 1 1 1 1 Else 'TE1005 CB0VAL% = CB0VAL% And &HFE '1 1 1 1 1 1 1 0 End If End If Call SETTH(CB0VAL%, CB0%) 'Writes bit pattern to test head End Sub Function EXCCAL$(CAL%) 'Measure and calibrate the isolated excitation voltage source on the 'SCM5B38, SCM5B42 and SCM5B43 modules ' 'SCM5B42-xx and some custom SCM5B43-xx modules do not have an 'adjustment potentiometer. Excitation voltage is 20.4V. VEXC! = SPECS.VEXC 'Isolated excitation ACC! = SPECS.VEXCACC / 100! 'Specified excitation accuracy (%) CALTOL! = ACC! / 3! * VEXC! * 1000! 'Calibration tolerance (mV) INITTOL! = 0.08 'Initial uncalibrated tol. (+/- 8%) Cls TESTTITLE$ = "Isolated Excitation Calibration" Call HEADERB(TESTTITLE$) LOCATE 10, 10 SNM% = SENSORNUM% If SNM% < 8 Or SNM% > 11 Then Print "This test is not performed on model "; SPECS.MODNAME Exit Function Else Print "Testing, please wait." End If Call MODULEOUTLINE POT1% = 34 POT2% = 40 POT3% = 53 ADJ% = 34 TXT% = ADJ% - 9 LOCATE 5, POT1% Print Chr$(233) LOCATE 5, POT2% Print Chr$(233) LOCATE 5, POT3% Print Chr$(233) LOCATE 7 Print Tab(ADJ%); Chr$(24);: Print Spc(20); Print Tab(TXT%); "EXC. POTENTIOMETER"; LOCATE 12, 10 Print "Please wait..." If CAL% = 2 Then XERROR! = INITTOL! * VEXC! * 1000! 'Offset tol. for func. test (mV) Else XERROR! = ACC! * VEXC! * 1000! 'Exc. cal. tolerance (mV) End If Call LOADMUX(6, CON%) 'Measure Vexc Call WRITEDVM(VODC$, VEXC!) LOCATE 12, 10 Print "Excitation Error = " Do ERRORMV! = (READDVM!(0!) - VEXC!) * 1000! 'Error in mV LOCATE 12, 29 ' ERRORMV! = -64 '09/18/07 MR Print USING; "+#####.# mV"; ERRORMV! If VEXC! = 20.4 Then Exit Do 'No calibration for 2WTX input LOCATE 15, 10 If CAL% > 1 Then Exit Do ElseIf Abs(ERRORMV!) < CALTOL! Then SOUND 600, 0.5 Print "Stop turning excitation potentiometer " CONREADS% = CONREADS% + 1 ElseIf ERRORMV! < 0 Then Print "Turn excitation potentiometer clockwise " CONREADS% = 0 Else Print "Turn excitation potentiometer counter-clockwise" CONREADS% = 0 End If LOCATE 20, 10 A$ = INKEY$ If UCase$(A$) = "T" Then Print Tab(10); "Trouble Shooting Mode" Call WRITEDVM("*", VEXC!) Call CONTINUE LOCATE 20, 10 Print Spc(22); ElseIf UCase$(A$) = "C" Then CONREADS% = 5 End If Call PAUSE(0.1) 'Slow loop down Loop While CONREADS% < 5 'Exit loop if calibrated Call LOADMUX(6, COFF%) If Abs(ERRORMV!) <= XERROR! Then EXC$ = "PASS" Else EXC$ = "FAIL" SOUND 1000, 0.5 End If If SNM% = 9 Or SNM% = 11 Then CB0VAL% = (CB0VAL% And &HEB) Or &H8 '1 1 1 0 1 0 1 1 'ground inputs, short series R 'remove short on inputs Call SETTH(CB0VAL%, CB0%) 'test for -IN to -EXC jumper on SCM5B42-xx CB3VAL% = CB3VAL% And &HF7 '1 1 1 1 0 1 1 1 Call SETTH(CB3VAL%, CB3%) 'Connect CH6+ to -IN If SNM% = 9 Then If MEASRES!(1!, 5, "") > 10 Then 'CALL PAUSE(1) Print Print Tab(5); "The required jumper in the R68 location is not installed." EXC$ = "FAIL" SOUND 1000, 0.5 Call CONTINUE End If ElseIf SNM% = 11 Then 'test for inversion of the input terminals 'and for the installation of the internal resistors 'on half bridge models only Call LOADMUX(6, CON%) 'Measure Volt of internal resistor Call WRITEDVM(VODC$, VEXC! * 1.1) VRINTEXP! = 0.5 * VEXC! 'Nominal voltage value VRINTTOL! = VRINTEXP! * 0.01 'Tolerance in volts VRINT! = READDVM!(0!) If Abs(VRINT! - VRINTEXP!) > VRINTTOL Then LOCATE 18, 1 Print Tab(5); "Bridge completion test failed. Check if R4, R5, R6 and R7 are" Print Tab(5); "installed. Also verify that R63, R64, R73, R74 are installed" Print Tab(5); "instead of R61, R62, R72, R75 (all PCB 1212 designators)." EXC$ = "FAIL" SOUND 1000, 0.5 Call CONTINUE End If Call LOADMUX(6, COFF%) 'Turn off measurement channel End If CB0VAL% = CB0VAL% And &HE3 '1 1 1 0 0 0 1 1 Call SETTH(CB0VAL%, CB0%) 'short inputs again CB3VAL% = CB3VAL% Or &H8 '0 0 0 0 1 0 0 0 Call SETTH(CB3VAL%, CB3%) 'Connect CH6+ to +EXC End If 'LOCATE 15, 10 'PRINT "Status: "; EXC$; 'CALL FAILSTATUS (EXC$, 15, 10, "Status: ") 'Print test status to screen LOCATE 15, 10 Print Spc(36); Print Tab(10); "Excitation calibration error is"; Print Tab(50); USING; " +#####.# mV"; ERRORMV! Print Tab(10); "Max. excitation calibration error is"; Print Tab(50); USING; "+/-####.# mV"; XERROR! Call FAILSTATUS(EXC$, 15, 10, "Status: ", 30) 'Print test status to screen EXCCAL$ = EXC$ + Str$(ERRORMV! / 1000! + VEXC!) + "3" 'Convert to absolute Call PAUSE(0.2) End Function Function EXCILIM$() 'Test the isolated excitation voltage source current limit 'on the SCM5B38 and SCM5B42 modules VEXC! = SPECS.VEXC 'Excitation voltage EXCIMAX! = SPECS.EXCIMAX 'Excitation current limit (mA) Cls TESTTITLE$ = "Excitation Current Limit Test" Call HEADERB(TESTTITLE$) LOCATE 10, 10 SNM% = SENSORNUM% If SNM% < 8 Or SNM% > 11 Then Print "This test is not performed on model "; SPECS.MODNAME Exit Function Else Print "Testing, please wait." End If Call SETLOAD(80!) 'Set excitation load (ohms) Call LOADMUX(6, CON%) 'Measure Vexc Call WRITEDVM(VODC$, VEXC!) ILIM! = READDVM(0.001) / 80! * 1000! 'Current limit (mA) Call LOADMUX(6, COFF%) '80 ohms is max load. If ILIM! <= EXCIMAX! Then ELIM$ = "PASS" Else ELIM$ = "FAIL" SOUND 1000, 0.5 'Trouble shooting notes LOCATE 15, 10 Print "Check the excitation current sense resistor." End If 'LOCATE 10, 10 'PRINT "Status: "; ELIM$; 'CALL FAILSTATUS (ELIM$, 10, 10, "Status: ") 'Print test status to screen LOCATE 11, 10 If Left$(SPECS.MODNAME, 12) = "SCM5B38-1788" Or Left$(SPECS.MODNAME, 12) = "SCM5B38-1851" Then Print Spc(10); Print Tab(10); "Excitation current limit is"; Print Tab(50); USING; "#.### mA"; ILIM! Print Tab(10); "Max. allowable current is"; Print Tab(50); USING; "#.### mA"; EXCIMAX! EXCILIM$ = ELIM$ + Str$(ILIM!) + "3" Else Print Spc(10); Print Tab(10); "Excitation current limit is"; Print Tab(50); USING; "####.# mA"; ILIM! Print Tab(10); "Max. allowable current is"; Print Tab(50); USING; "###.# mA"; EXCIMAX! EXCILIM$ = ELIM$ + Str$(ILIM!) + "1" End If Call FAILSTATUS(ELIM$, 10, 10, "Status: ", 30) 'Print test status to screen Call SETLOAD(10000!) 'Set excitation load to 10K ohms Call PAUSE(0.2) End Function Function EXCREG$() 'Test the isolated excitation voltage regulation with load on the 'SCM5B38 and SCM5B42 modules MINOUT! = SPECS.MINOUT MAXOUT! = SPECS.MAXOUT REGSPEC! = SPECS.EXCLOADREG 'Load regulation (ppm/mA) VEXC! = SPECS.VEXC 'Excitation voltage EXCLOAD! = SPECS.EXCLOAD 'Max. exc. load (mA) ORANGE! = MAXOUT! - MINOUT! 'Output range (V) Cls TESTTITLE$ = "Excitation Load Regulation Test" Call HEADERB(TESTTITLE$) LOCATE 10, 10 SNM% = SENSORNUM% If SNM% < 8 Or SNM% > 11 Or Left$(SPECS.MODNAME, 12) = "SCM5B38-1788" Or Left$(SPECS.MODNAME, 12) = "SCM5B38-1851" Then Print "This test is not performed on model "; SPECS.MODNAME Exit Function Else Print "Testing, please wait." End If 'Module inputs are shorted Call LOADMUX(6, CON%) 'Measure Vexc Call WRITEDVM(VODC$, VEXC!) VEXCNL! = READDVM(0.001) 'Excitation V, no load Call LOADMUX(6, COFF%) Call SETLOAD(VEXC! / (EXCLOAD! / 1000!)) 'Set excitation load (ohms) Call LOADMUX(6, CON%) 'Measure Vexc VEXCL! = READDVM(0.001) 'Excitation V, full load Call LOADMUX(6, COFF%) MEASREG! = (VEXCL! - VEXCNL!) / VEXC! / EXCLOAD! * 1000000! 'Measured regulation (ppm/mA) If Abs(MEASREG!) <= REGSPEC! Then ER$ = "PASS" Else ER$ = "FAIL" SOUND 1000, 0.5 'Trouble shooting notes LOCATE 15, 10 Print "Check the signals on the excitation reference and amplifier." Print Tab(10); "If failure still occurs, re-seat module firmly in sockets." End If 'LOCATE 10, 10 'PRINT "Status: "; ER$; 'CALL FAILSTATUS (ER$, 15, 10, "Status: ") 'Print test status to screen LOCATE 15, 10 Print Spc(10); Print Tab(10); "Excitation change with load is"; Print Tab(50); USING; " +##### ppm/mA"; MEASREG! Print Tab(10); "Max. change with load is"; Print Tab(50); USING; "+/-##### ppm/mA"; REGSPEC! Call FAILSTATUS(ER$, 15, 10, "Status: ", 30) 'Print test status to screen EXCREG$ = ER$ + Str$(MEASREG!) + "0" 'ppm/mA Call SETLOAD(10000!) 'Set excitation load to 10K ohms Call RESETTH 'Reset the test head Call PAUSE(0.2) End Function Function FAILS%(STATUS$()) FAILS% = 0 'FOR X = 1 TO 21 For X = 1 To MAXSTATUSINDEX If Left$(STATUS$(X), 1) = "F" Then 'Tests for failed tests FAILS% = 1 End If Next End Function Sub FINISHSUB() 'Sub to run code at "FINISH" label (usually after F10 key is pressed). ' Cls If SENSORNUM% = 1 And (SPECS.MAXIN > 10 Or SPECS.MININ < -10 Or SPECS.OSCALIN < -10) Then SL$ = SETPOWER$(VINADDR%, 999!, LOOPOFF$) 'Turn off loop power SL$ = SETPOWER$(VINADDR%, 999!, LOCAL$) 'Return to local mode SL$ = SETPOWER$(VINADDR%, 999!, "ZER") 'Clear the error queue End If CHAIN "C:\ATE\MENUX" End Sub Function FREQRESP$(GENAMPL!) MININ! = SENSOROUT!(SPECS.MININ, 0) 'Determine min in MAXIN! = SENSOROUT!(SPECS.MAXIN, 0) 'Determine max in IEXC! = SPECS.IEXC / 1000000! 'Convert to A INRANGE! = MAXIN! - MININ! ORANGE! = SPECS.MAXOUT - SPECS.MINOUT SPEC! = SPECS.ATTEN SPECTOL! = SPECS.ATTENTOL Cls TESTTITLE$ = "Frequency Response Test" Call HEADERB(TESTTITLE$) LOCATE 10, 10 Print "Testing, please wait." SNM% = SENSORNUM% If SNM% >= 5 And SNM% <= 7 Then 'Check if resistance in 'Simulated RTD input is the bottom leg in a voltage divider 'from the function generator. The series resistor is 6.8Kohms. R! = GENATTENR! 'Find attenuator shunt R Call OHMSET(R!) THATTEN! = (6800! + R!) / R! VGAIN! = ORANGE! / (INRANGE! * IEXC!) 'Gain in V/V Else If Abs(MAXIN!) > 10 Then MAXIN! = 10 THATTEN! = SETATTEN%(MAXIN!) 'Set test head attenuator VGAIN! = ORANGE! / INRANGE! 'Gain in V/V End If VAC! = SETAC!(CON%, GENAMPL!) 'Turns on AC input Call LOADMUX(2, CON%) 'Turns on mux Call WRITEDVM(VOAC$, 999!) 'Sets up Meter (Autorange) OUTMEAS! = READDVM!(0.001) 'Reads Meter If OUTMEAS! > 0.0002 Then OUTMEAS! = Sqr(OUTMEAS! ^ 2 - 0.0002 ^ 2) 'Account for meter zero-input error End If 'See output noise test for details Call LOADMUX(2, COFF%) 'Turns off mux 'Calculate attenuation 'max 2% error from R/2R ladder 'ideal assumption results in '0.3% error in 60dB measurement. If Mid$(SPECS.MODNAME, 6, 7) = "41-1794" Then ATTEN! = 20 * (Log(OUTMEAS! / (VAC! / THATTEN! * VGAIN!)) / Log(10)) Else ATTEN! = -20 * (Log(OUTMEAS! / (VAC! / THATTEN! * VGAIN!)) / Log(10)) End If If Abs(ATTEN! - SPEC!) <= SPECTOL! Then ATTEN$ = "PASS" Else ATTEN$ = "FAIL" SOUND 1000, 0.5 End If 'LOCATE 10, 10 'PRINT "Status: "; ATTEN$; 'CALL FAILSTATUS (ATTEN$, 10, 10, "Status: ") 'Print test status to screen LOCATE 10, 10 Print Spc(20); Print Tab(10); USING; "Attenuation at ##### Hz is"; SPECS.TESTFREQ!; If Mid$(SPECS.MODNAME, 6, 7) = "41-1794" Then Print Tab(50); USING; "###.### dB"; ATTEN! Print Tab(10); "Required attenuation is"; Print Tab(50); USING; "#.## +/- #.### dB"; SPEC!; SPECTOL! Else Print Tab(50); USING; "###.# dB"; ATTEN! Print Tab(10); "Required attenuation is"; Print Tab(50); USING; "###.# +/- ##.# dB"; SPEC!; SPECTOL! End If Call FAILSTATUS(ATTEN$, 10, 10, "Status: ", 30) 'Print test status to screen If Mid$(SPECS.MODNAME, 6, 7) = "41-1794" Then FREQRESP$ = ATTEN$ + Str$(ATTEN!) + "3" Else FREQRESP$ = ATTEN$ + Str$(ATTEN!) + "1" End If VAC! = SETAC(COFF%, GENAMPL!) 'Turns off AC input Call PAUSE(0.2) End Function Sub FUNCTEST(CAL%) 'Sequence of tests to determine if main module circuits are functional ' MAXOUT! = SPECS.MAXOUT If SENSOROUT!(SPECS.MININ, 0) = 99! Then 'Check for valid sensor type Print Tab(10); "Exiting FUNCTEST for invalid sensor type!." SOUND 1000, 0.5 'Beep to alert to failure. Call CONTINUE Exit Sub End If SNM% = SENSORNUM% Call ENABLE(CON%) 'Enable output switch Do CONFLAG% = 0 For FTEST% = 1 To 3 If FTEST% = 2 Then Call POWERON(5!) 'Set Vsupply to 5.0V Select Case FTEST% Case 1 If Left$(SUPPLYI$(0), 4) = "FAIL" Then 'Check supply current Call CONTINUE CONFLAG% = 1 'Sets exit flag End If Case 2 CONTRES! = 0 'Don't care about DIRO% status If Left$(OFFSETCAL$(CAL%, CONTRES!, DIRO%), 4) = "FAIL" Then Call CONTINUE 'Checks for offset error < 8% span CONFLAG% = 1 End If 'Don't care about DIRG% status If Left$(GAINCAL$(CAL%, CONTRES!, PFSMEAS!, INTERACT!, OSERR2!, DIRG%), 4) = "FAIL" Then Call CONTINUE 'Checks for Gain error < 8% span CONFLAG% = 1 End If Case 3 If SNM% >= 8 And SNM% <= 11 Then If Left$(EXCCAL$(CAL%), 4) = "FAIL" Then Call CONTINUE 'Checks for excitation error < 8% span CONFLAG% = 1 End If End If End Select If CONFLAG% <> 0 Then Exit For Next Call POWERON(0!) 'Turns off module power Loop While REPEAT$(SPECS.MODNAME) <> "N" 'Repeat for another module Call RESETTH 'Reset the test head End Sub Function GAINCAL$(CAL%, CONTRES!, PFSMEAS!, INTERACT!, OSERR2!, DIRG%) 'Calibrate module gain 'Inputs; calibration flag ' measured contact resistance (used for resistance in only) ' SENSOR$ = SPECS.SENTYPE MAXIN! = SENSOROUT!(SPECS.MAXIN!, 0) 'Use to check for high voltage input MINOUT! = SPECS.MINOUT MAXOUT! = SPECS.MAXOUT CALGN! = SPECS.GNCALPT / 100 '% INITTOL! = 8 'Uncalibrated offset tolerance (%) CALTOL! = SPECS.CALTOL 'Calibration tolerance (% span) OSCALIN! = SPECS.OSCALIN 'Module input for offset calibration GNCALIN! = SPECS.GNCALIN 'Module input for offset calibration BANDWIDTH! = SPECS.BANDWIDTH LIN% = SPECS.LINEARIZED SNM% = SENSORNUM% Cls TESTTITLE$ = "Gain Calibration" Call HEADERB(TESTTITLE$) Call MODULEOUTLINE If (SNM% >= 3 And SNM% <= 6) And LIN% = 0 Then 'Adjustment range is +/- x% of +full scale.Output not linear with input. CALSPAN! = VOUT!(SENSOROUT!(GNCALIN!, 0)) - VOUT!(SENSOROUT!(OSCALIN!, 0)) ElseIf OSCALIN! = -2 * MAXIN! Or Left$(SPECS.MODNAME, 10) = "SCM5B-1369" Then CALSPAN! = MAXOUT! - MINOUT! 'For bipolar input, unipolar output modules Else CALSPAN! = VOUT!(GNCALIN!) - VOUT!(OSCALIN!) 'Adjustment range is +/- x% of +f.s. End If INRANGE! = MAXIN! - SENSOROUT!(SPECS.MININ!, 0) ORANGE! = MAXOUT! - MINOUT! 'Output range (V) MN$ = Mid$(SPECS.MODNAME, 6, 2) If SPECS.BANDWIDTH <= 150 Or Mid$(SPECS.MODNAME, 6, 7) = "41-1794" Then 'Assume pcb1122, 1132, 1138, 1107, 1130, 1211, 1214. If PCBNO$ = "1211.1212.1214" Then 'Assume pcb1211, 1214. POT1% = 34 POT2% = 40 ADJ% = 40 TXT% = ADJ% - 9 Else POT1% = 34 POT2% = 53 If MN$ = "40" Or MN$ = "41" Or SNM% = 8 Or SNM% = 9 Or SNM% = 11 And Mid$(SPECS.MODNAME, 6, 7) <> "41-1794" Then If SNM% = 9 Or Mid$(SPECS.MODNAME, 6, 7) = "32-1476" Then POT1% = 0 POT3% = 40 End If ADJ% = 53 TXT% = ADJ% - 9 End If ElseIf PCBNO$ = "1211.1212.1214" Then 'Assume pcb1212 POT1% = 34 POT2% = 40 If Mid$(SPECS.MODNAME, 6, 7) = "41-1794" Then POT1% = 0 If MN$ = "40" Or MN$ = "41" Or SNM% = 8 Or SNM% = 9 Or SNM% = 11 Or Mid$(SPECS.MODNAME, 6, 7) = "32-1476" And Mid$(SPECS.MODNAME, 6, 7) <> "41-1794" Then If MN$ = "40" Or MN$ = "41" Or Mid$(SPECS.MODNAME, 6, 7) = "32-1476" Then POT1% = 0 POT3% = 53 End If ADJ% = 40 TXT% = ADJ% - 9 Else 'Assume pcb1121, pcb1173 POT1% = 34 POT2% = 53 If SNM% <> 2 Then POT3% = 40 End If ADJ% = 53 TXT% = ADJ% - 9 End If If POT1% <> 0 Then LOCATE 5, POT1% Print Chr$(233) End If LOCATE 5, POT2% Print Chr$(233) If POT3% <> 0 Then LOCATE 5, POT3% Print Chr$(233) End If LOCATE 7 Print Tab(ADJ%); Chr$(24);: Print Spc(20); Print Tab(TXT%); "GAIN POTENTIOMETER"; LOCATE 12, 10 Print "Please wait..." If CAL% = 2 Then GERROR! = INITTOL! 'Offset tolerance for func. test (%) TOL! = 0.0001 * ORANGE! 'Measurement tolerance, 1 pass test Else GERROR! = CALTOL! 'Offset calibration tolerance (%) TOL! = 0! 'Measurement tolerance, continuous test End If If SNM% >= 5 And SNM% <= 7 Then 'Check if RTD in MAXIN! = SENSOROUT!(GNCALIN!, 0) 'Calc. +f.s. ohms Call OHMSET(MAXIN! - CONTRES!) 'Set +f.s. input End If Do 'Start overall gain measure/calibration loop. TIME1! = Timer 'Start timer L% = 0 If CAL% = 3 Then LOCATE 11, 10 Print "Measuring module gain error, no adjustment is required." Else LOCATE 12, 10 Print Tab(10); "Measuring input. Please wait..." End If If SNM% >= 5 And SNM% <= 7 Then 'RTD input module. If CAL% = 0 Then Call WRITEDVM("S0", 0) 'Slow reading rate for max accuracy MAXINMEAS! = MEASRES!(MAXIN!, 3, "") + CONTRES! 'Measure simulated resistor 'PAUSE (.5) Call POWERON(5) Call PAUSE(2) ElseIf Left$(SPECS.MODNAME, 10) = "SCM5B-1369" Then If L% = 0 Then Call POWERON(5) Else If L% = 0 Then Call POWERON(5) If SNM% = 3 Then PTCV! = PARASITICTCV!(VCJC!) If VCJC! = 99! Then Print Tab(10); "Error in GAINCAL$ test:" Print Tab(10); "Vcjc = 99 (error value)!" GN$ = "FAIL" 'Set FAIL status. SOUND 1000, 0.5 'Beep to alert to failure. GAINCAL$ = GN$ + "V" 'Set function output to FAIL status with trailing "V" for special formatting. Call FAILSTATUS(GN$, 15, 10, "Status: ", 30) 'Print test status to screen Exit Function End If Else PTCV! = 0 End If MAXIN! = SENSOROUT!(GNCALIN!, PTCV!) 'Calc. maxin volts. Call SETDAC(MAXIN!, 1, MAXINVAR!, 0) 'Set DAC. If CAL% = 0 Or MAXIN! > 10! Then 'Always measure high voltage input to get exact setting. Call WRITEDVM("S0", 0) 'Slow reading rate for max accuracy Call LOADMUX(1, CON%) 'Set to measure Vout. 'Turn off and re-set mux because the mux is occasionally erroneously set on 'some test hardware and/or test stations (sometimes CH4, sometimes CH8). Call LOADMUX(0, CON%) Call LOADMUX(1, CON%) Call WRITEDVM(VODC$, MAXIN!) 'Sets meter to read MAXINMEAS! = READDVM!(INRANGE! * 0.0001) '0.01% tolerance While Abs(MAXIN!) > 10! And Abs(MAXIN!) - Abs(MAXINMEAS!) > 1 'Power supply current limit tripped SL$ = SETPOWER(VINADDR%, Abs(MAXIN!), FUNC$) 'Set Vin MAXINMEAS! = READDVM!(INRANGE! * 0.0001) '0.01% tolerance Wend Call LOADMUX(1, COFF%) Else MAXINMEAS! = MAXIN! End If End If Call WRITEDVM("S1", 0) 'Medium reading rate If (SNM% >= 3 And SNM% <= 6) And LIN% = 0 Then 'TC or RTD with linearity = 0 (output not linear with input). OUTCALC! = VOUT!(MAXINMEAS! + PTCV!) + CALGN! * ORANGE! ElseIf Left$(SPECS.MODNAME, 10) = "SCM5B-1369" Then OUTCALC! = MAXOUT! Else 'Other modules. OUTCALC! = VOUT!(SENSORIN!(MAXINMEAS!, PTCV!)) + CALGN! * ORANGE! End If Call LOADMUX(2, CON%) 'Measure Vout 'Turn off and re-set mux because the mux is occasionally erroneously set on 'some test hardware and/or test stations (sometimes CH4, sometimes CH8). Call LOADMUX(0, CON%) Call LOADMUX(2, CON%) Call WRITEDVM(VODC$, OUTCALC!) If INTERACT! <> 1 Then PFSMEAS! = READDVM!(0.0001) 'CALOS! is included in OSERR2! Convert OSERR2! to V. OUTCALC! = PFSMEAS! - (1 / (1 - INTERACT!)) * (PFSMEAS! - OUTCALC! - ORANGE! * OSERR2! / 100!) End If If BANDWIDTH! < 1 Then P! = 5 Else P! = 0 End If Call PAUSE(P!) 'Pause for filter settling LOCATE 12, 10 Print "Gain Error = "; Print Spc(20); Do 'Start gain meas./adjust loop. L% = L% + 1 ERROROUT! = (READDVM!(TOL!) - OUTCALC!) / CALSPAN! * 100! 'Error (%). LOCATE 12, 24 Print USING; "+###.### %"; ERROROUT! LOCATE 15, 10 If CAL% > 1 Then CONREADS% = 5 ElseIf Abs(ERROROUT!) < GERROR! Then SOUND 400, 0.5 Print "Stop turning gain potentiometer " CONREADS% = CONREADS% + 1 ElseIf ERROROUT! < 0 Then If DIRG% = 1 Then DIREC$ = "CLOCKWISE " Else DIREC$ = "COUNTER-CLOCKWISE" End If Print "Turn gain potentiometer "; DIREC$ CONREADS% = 0 Else If DIRG% = 1 Then DIREC$ = "COUNTER-CLOCKWISE" Else DIREC$ = "CLOCKWISE " End If Print "Turn gain potentiometer "; DIREC$ CONREADS% = 0 End If LOCATE 20, 10 A$ = INKEY$ If UCase$(A$) = "T" Then Print Tab(10); "Trouble Shooting Mode" Call WRITEDVM("*", OUTCALC!) Call CONTINUE Call WRITEDVM("*T2S1", 0) 'Initialize Fluke meter LOCATE 20, 10 Print Spc(22); ElseIf UCase$(A$) = "C" Then CONREADS% = 5 End If Call PAUSE(0.1) 'Pause to slow down loop. 'Re-measure input once every 200 cycles. Exit if enough consecutive measurements match 'with their allow tolerance (CONREADS% is incremented when this happens). Loop While CONREADS% < 5 And (L% < 200 Or CONREADS% < 5) 'End of gain meas./adjust loop. Call LOADMUX(2, COFF%) 'Turn off module power if consecutive measurements within tolerance limit is 'not reached and it is a resistance-input module. If SNM% >= 5 And SNM% <= 7 And CONREADS% < 5 Then Call POWERON(0) Loop While CONREADS% < 5 'End of overall gain meas./cal. loop. If CAL% <> 3 Then If Abs(ERROROUT!) <= GERROR! Then GN$ = "PASS" Else GN$ = "FAIL" SOUND 1000, 0.5 End If 'LOCATE 15, 10 'PRINT "Status: "; GN$; 'CALL FAILSTATUS (GN$, 15, 10, "Status: ") 'Print test status to screen LOCATE 15, 10 Print Spc(30); Print Tab(10); "Gain calibration error is"; Print Tab(50); USING; " +###.### %"; ERROROUT! Print Tab(10); "Max. gain calibration error is"; Print Tab(50); USING; "+/-##.### %"; GERROR! Call FAILSTATUS(GN$, 15, 10, "Status: ", 30) 'Print test status to screen Else GN$ = "PASS" End If GAINCAL$ = GN$ + Str$(ERROROUT!) + "2" Call RESETTH 'Reset the test head Call PAUSE(0.2) End Function Function GENATTENR!() 'This routine is used for RTD or pot. input modules only. 'It determines the simulated RTD input to the module which 'serves as a voltage divider for the function generator. 'Series resistor from the function generator is 6.8Kohms. 'Design for function generator offset of -5V IEXC! = SPECS.IEXC / 1000000! 'Convert to A MININ! = SENSOROUT!(SPECS.MININ, 0) 'Determine min in MAXIN! = SENSOROUT!(SPECS.MAXIN, 0) 'Determine max in RMID! = (MAXIN! - MININ!) / 2 + MININ! VOS! = -5 'Solve the quadratic equation ax^2 + bx + c = 0 where a,b,c are defined below. A! = IEXC! B! = IEXC! * (RFNGN! - RMID!) - VOS C! = -1 * RFNGN! * IEXC! * RMID! 'determine the positive root GENATTENR! = (-B + Sqr(B ^ 2 - 4 * A * C)) / (2 * A) End Function Sub GENSET(GENAMPL!) MININ! = SENSOROUT!(SPECS.MININ, 0) 'Determine min in MAXIN! = SENSOROUT!(SPECS.MAXIN, 0) 'Determine max in INRANGE! = MAXIN! - MININ! ATTEN! = SPECS.ATTEN SNM% = SENSORNUM% GENOS! = -5 If SNM% >= 5 And SNM% <= 7 Then 'Check if resistance in IEXC! = SPECS.IEXC / 1000000! 'Convert to A R! = GENATTENR! 'Find attenuator shunt R GENOS! = -5 GENAMPL! = Int((IEXC! * INRANGE! * (RFNGN! + R!)) / R!) ' IF GENAMPL! < .5 * ABS(GENOS!) THEN GENAMPL! = 2.5 'HP33120A limit. Max offset ' IF GENAMPL! > 20 - 2 * ABS(GENOS!) THEN GENAMPL! = 20 - 2 * ABS(GENOS!) ElseIf SNM% >= 1 And SNM% <= 3 Then 'Check if 5B392 ORANGE! = SPECS.MAXOUT! - SPECS.MINOUT! 'Set amplitude for > 5mV p-p signal out UNATTENOUT! = 10 ^ (ATTEN! / 20) * 0.01 GENAMPL! = UNATTENOUT! / ORANGE! * INRANGE! If GENAMPL! < 0.03 Then GENAMPL! = 1 ElseIf GENAMPL! >= 0.03 And GENAMPL! < 5 Then GENAMPL! = 5 Else GENAMPL! = 10 End If EXPNT% = 10 'first attenuator position GATTEN! = INRANGE! / GENAMPL! 'Attenuator gain GENOS! = (MININ! + INRANGE! / 2!) / GATTEN! If GENAMPL! < 0.5 * Abs(GENOS!) Then GENAMPL! = 0.5 * Abs(GENOS!) End If Else ORANGE! = SPECS.MAXOUT! - SPECS.MINOUT! 'Set amplitude for > 5mV p-p signal out UNATTENOUT! = 10 ^ (ATTEN! / 20) * 0.01 GENAMPL! = UNATTENOUT! / ORANGE! * INRANGE! If GENAMPL! < 0.03 Then GENAMPL! = 1 ElseIf GENAMPL! >= 0.03 And GENAMPL! < 5 Then GENAMPL! = 5 Else GENAMPL! = 10 End If EXPNT% = 10 'first attenuator position GATTEN! = INRANGE! / GENAMPL! * 2 'Attenuator gain GENOS! = (MININ! + INRANGE! / 2!) / GATTEN! If GENAMPL! < 0.5 * Abs(GENOS!) Then GENAMPL! = 0.5 * Abs(GENOS!) End If End If If GENAMPL! < 0.5 * Abs(GENOS!) Then GENAMPL! = 0.5 * Abs(GENOS!) If GENAMPL! > 20 - 2 * Abs(GENOS!) Then GENAMPL! = 20 - 2 * Abs(GENOS!) If Mid$(SPECS.MODNAME, 6, 7) = "41-1794" Then GENAMPL! = 20 End If Cls LOCATE 5, 10 Print "Set the function generator as follows:" LOCATE 10, 27 Print "Function Generator Settings" Print Tab(27); "---------------------------" Print Tab(31); USING; "Frequency: ##### Hz"; SPECS.TESTFREQ Print Tab(31); USING; "Amplitude: ##.# V p-p"; GENAMPL! Print Tab(31); USING; "DC Offset: +##.## V"; GENOS! Call CONTINUE End Sub Sub GETADD(FILENAME$) 'LPT$ = parallel printer port used to control ATE 'MUX$ = multiplexer box address 'TESTHEAD$ = test head address 'PS2ADDR$ = Power Supply #2 address (high voltage input to DUT) 'PSPORTADDR$ = Power Supply serial port address 'DVM$ = DVM address Open "C:\ATE\ADDR\" + FILENAME$ For Random As #3 Len = 15 FIELD #3, 3 AS LPT$, 2 AS MUX$, 2 AS TESTHEAD$, 2 AS DPSPS2ADDR$, 2 AS PSPORTADDR$, 2 AS DVM$, 2 AS ABCPS2ADDR$ GET #3 LPTADDR% = Val(LPT$) MUXADDR% = Val(MUX$) THADDR% = Val(TESTHEAD$) DPSVINADDR% = Val(DPSPS2ADDR$) 'KEPCO DPS address PSPORT% = Val(PSPORTADDR$) DVMADDR% = Val(DVM$) ABCVINADDR% = Val(ABCPS2ADDR$) 'KEPCO ABC address Close #3 End Sub Function GETPSID%() Cls LOCATE 3 Print Tab(10); "Identifying power supplies connected to test system" Print '****** First, assume KEPCO DPS125 for PSMODEL$ string assignment. PSMODEL$ = "DPS125" '****** KEPCO DPS VIN supply address for serial interface. '****** Obtain Identification string from KEPCO DPS 125. '****** Assign corresponding address obtained from address file dependent '****** on if the Power supply is DPS125 or ABC125. '****** Check for High Voltage Power Supply Print Tab(20); "KEPCO DPS125 High-Voltage Input: "; DPSVIN$ = POWERIO$(DPSVINADDR%, "ID") If DPSVIN$ = "KEPCO DPS 125-0.5M" Then VINADDR% = DPSVINADDR% Print Tab(55); "Yes!" Print Call INITPS(DPSVINADDR%, VINILIMIT!, VINOVERV!) DPSVINFLAG! = 1! Else Print Tab(55); "Not present" DPSVINFLAG! = 0! VINADDR% = 0! End If If DPSVINFLAG! = 0! Then PSMODEL$ = "ABC125" Print Tab(20); "KEPCO ABC-125 High-Voltage Input: "; ABCVIN$ = READGPIB$(ABCVINADDR%, "*IDN?") If Left$(ABCVIN$, 14) = "KEPCO,ABC-1251" Then VINADDR% = ABCVINADDR% Call INITPS(ABCVINADDR%, VINILIMIT!, VINOVERV!) Print Tab(55); "Yes!" Print Else Print Tab(55); "Not present" Print End If End If If VINADDR% = 0! Then Print Tab(15); ">>>>>>>> No Power Supplies are connected <<<<<<<<" 'CALL CONTINUE End If GETPSID% = 99 'This has yet to be utilized. At this time there is 'no requirement to pass anything back to function call End Function Sub GETSPECS() 'Get module values from the database. ' Dim POINTER%(1000) Call SORTDB(ENDFLAG%) If ENDFLAG% = 1 Then SPECS.MODNAME = "EXIT" Exit Sub End If Cls 'LOCATE , 30 Print "Model Selection Menu" 'PRINT TAB(30); "--------------------" YINIT% = CSRLIN 'Initialize starting rows Open "C:\ATE\5BDATA\DBSORT2.DAT" For Random As #2 Len = Len(SORTDATA1) Do I% = I% + 1 Get #2, I%, SORTDATA1 If SORTDATA1.RECNUM <> -1 Then NUMRECORD! = NUMRECORD! + 1 Loop While SORTDATA1.RECNUM <> -1 SCRNCTR% = 40 'display center NUMCHAR% = 26 '20 char + 4 char for # + 2 spaces NUMLINES! = 24 '# of lines for model display below header NUMCOLUMNS! = 1 + Int(NUMRECORD! / NUMLINES!) 'Model # length = 20 characters max '-> 3 columns max per screen '3 columns x 26 char = 78 spaces I% = 1 For C% = 0 To NUMCOLUMNS! - 1 Y% = YINIT% TB% = SCRNCTR% - NUMCHAR% / 2 * NUMCOLUMNS! + NUMCHAR% * C% Do Get #2, I%, SORTDATA1 If SORTDATA1.RECNUM <> -1 Then POINTER%(I%) = SORTDATA1.RECNUM LOCATE Y%, TB% Print USING; "##.) &"; I%; SORTDATA1.MODNAME; I% = I% + 1 Y% = Y% + 1 End If Loop While SORTDATA1.RECNUM <> -1 And Y% - YINIT% < NUMLINES! Next C% LOCATE Y%, TB% Print USING; "##.) Exit"; I% Close #2 Close #1 Do 'LOCATE 25, SCRNCTR% - 18 / 2 LOCATE 1, SCRNCTR% - NUMCHAR% / 2 * NUMCOLUMNS! + NUMCHAR% * (C% - 1) Print "Enter Selection "; INPUT SEL% Loop While SEL% < 1 Or SEL% > I% If SEL% = I% Then SPECS.MODNAME = "EXIT" Else Open "C:\ATE\5BDATA\5BMAIN.DAT" For Random As #6 Len = Len(SPECS) Get #6, POINTER%(SEL%), SPECS Close #6 PCBNO$ = "1211.1212.1214" 'Set common PCB numbers. 'IF MID$(SPECS.MODNAME, 6, 7) = "41-1794" THEN If Mid$(SPECS.MODNAME, 6, 7) = "41-1794" Or Mid$(SPECS.MODNAME, 6, 7) = "41-179X" Or Mid$(SPECS.MODNAME, 6, 7) = "41-1811" Then Cls LOCATE 10, 6 Print Tab(6); "*********************************************" Print Tab(6); "*** TEST UNIT ON SCM5B GANG TESTER ONLY ****" Print Tab(6); "*********************************************" Call CONTINUE SPECS.MODNAME = "EXIT-XXX" ElseIf (SENSORNUM% = 1 And (SPECS.MAXIN >= 60 Or SPECS.MININ <= -60)) Then Cls LOCATE 10, 6 Print Tab(6); "*******************************************" Print Tab(6); "***** TEST UNIT ON RMS STATION ONLY ******" Print Tab(6); " ******* SELECT SCM5BHV FROM MENU ********" Print Tab(6); "*******************************************" Call CONTINUE SPECS.MODNAME = "EXIT-XXX" ElseIf SENSORNUM% = 1 And (SPECS.MAXIN > 10 Or SPECS.MININ < -10 Or SPECS.OSCALIN < -10) Then Cls LOCATE 10, 5 Print "This module requires high voltage input." Print Print Tab(5); "Turn on the high voltage power supply and connect it to the test head." Print Print Tab(5); "DO NOT PROBE THE CIRCUITRY DURING TEST" Print Print Tab(5); "Remove the yellow connector from the meter +/-SENSE terminals." Call CONTINUE '****** Obtain communication with either DPS125 or ABC125 KEPCO power supply '****** and assign appropriate PSMODEL$ and VINADDR%. PSCOUNTER! = 0 '03/18/08 TSO While PSFLAG! = 0 And PSCOUNTER! <> 3 PSID% = GETPSID% 'Determine and initiate communication with Power supply If VINADDR% <> 2 And VINADDR% <> 6 Then LOCATE 10, 12: Print "A High Voltage Power Supply must be connected" LOCATE 12, 10: Print "Attach either a KEPCO DPS-125 Power Supply as address 2" LOCATE 13, 25: Print "or" LOCATE 14, 7: Print "If system is KEPCO ABC-125 Compliant, attach this supply" LOCATE 15, 7: Print "and set to address 6" PSCOUNTER! = PSCOUNTER! + 1 Call CONTINUE Else PSFLAG! = 1 End If Wend End If If Mid$(SPECS.MODNAME, 10, 4) = "1442" Or Mid$(SPECS.MODNAME, 10, 4) = "1443" Then Call REMEXCPIN(1) 'Disconnect +EXC from the test interface board End If End If 'MAXINVAR! = MAXINVAL! 'Set maximum module input value variable. MAXINVAR! = 0! 'Set to zero to revert to using VOLTAGE! for DAC accuracy (PWR 2014-11-04). SEL% = POINTER%(SEL%) 'pass back to main code for use in SAVEDATA End Sub Function IEXC1$(IEXCSENSE!) 'This routine tests current source I1 (-IN lead) '4-wire input modules use this current source. ' IEXC! = SPECS.IEXC 'Excitation current (uA) IEXCTOL! = 0.016 'Initial tolerance = +/-1.6% SNM% = SENSORNUM% Cls TESTTITLE$ = "Excitation Current Source #1 Test" Call HEADERB(TESTTITLE$) LOCATE 10, 10 If SNM% < 5 Or SNM% > 7 Then 'Check if resistance in Print "This test is not performed on model "; SPECS.MODNAME Call CONTINUE Exit Function Else Print "Testing, please wait..." End If If SNM% = 5 Or SNM% = 7 Then 'Check for 3-wire input 'IEXCsense was measured in Iexc2 Call SETTEST(1) 'Route I1 through sense R Call LOADMUX(4, CON%) 'check for initial value of 'I1 within spec Call WRITEDVM(VODC$, IEXCSENSE! * IEXC! * 0.000001) IMINUSIN! = READDVM(0.001) / IEXCSENSE! * 1000000! 'Excitation current (uA) Else '4-wire input 'Above test for 3-wire modules will 'saturate 4-wire modules at the + rail CONTRES! = 0 'Output is close enough without measuring MAXIN! = SENSOROUT!(SPECS.MAXIN, 0) 'Calc. +f.s. ohms Call OHMSET(MAXIN!) 'Set +f.s. input MAXINMEAS! = MEASRES!(MAXIN!, 3, "") + CONTRES! 'Measure simulated resistor 'Test 2 set in MEASRES! Call POWERON(5!) 'Set Vs = 5.0V Call LOADMUX(1, CON%) 'Measure input voltage Call WRITEDVM(VODC$, MAXIN! * IEXC!) MEASVIN! = READDVM(MAXIN! * IEXC! * 0.0005) '.05% tolerance IMINUSIN! = MEASVIN! / MAXINMEAS! * 1000000! '(uA) End If If IMINUSIN! < 25 Then 'Check if I1 is working IEXC! = 99 I1STAT$ = "FAIL" SOUND 1000, 0.5 LOCATE 10, 10 Print "Current source I1 (-IN terminal) is not working." Call CONTINUE ElseIf Abs(IMINUSIN! - IEXC!) > IEXC! * IEXCTOL! Then I1STAT$ = "FAIL" SOUND 1000, 0.5 LOCATE 10, 10 Print "Current source I1 is out of tolerance." Print Tab(10); "Check tantalum capacitor for reverse leakage." Print Tab(10); "Check current source resistor, diode, transistor and amplifier." Call CONTINUE Else I1STAT$ = "PASS" End If 'LOCATE 9, 10 'PRINT "Status: "; I1STAT$; 'CALL FAILSTATUS (I1STAT$, 9, 10, "Status: ") 'Print test status to screen LOCATE 10, 10 Print Tab(10); "Measured value of I1 (-IN terminal) is"; Print Tab(50); USING; "####.# uA"; IMINUSIN! Print Tab(10); "Required value of I1 is"; Print Tab(50); USING; "####.# uA +/- ##.# uA"; IEXC!; IEXC! * IEXCTOL! Call FAILSTATUS(I1STAT$, 9, 10, "Status: ", 30) 'Print test status to screen 'IF I1STAT$ = "FAIL" THEN CALL CONTINUE 'Pause to read note Call LOADMUX(4, COFF%) IEXC1$ = I1STAT$ + Str$(IMINUSIN!) + "1" Call RESETTH 'Reset the test head Call PAUSE(0.2) End Function Function IEXC2$(IEXCSENSE!) 'This routine tests current source I2 (+IN lead) '4-wire input modules do not use this current source. ' IEXC! = SPECS.IEXC 'Excitation current uA IEXCTOL! = 0.016 'Initial tolerance = +/-1.6% RIN! = 100 'Fixed input resistance Cls TESTTITLE$ = "Excitation Current Source #2 Test" Call HEADERB(TESTTITLE$) LOCATE 10, 10 SNM% = SENSORNUM% If SNM% < 5 Or SNM% > 7 Then 'Check if resistance in Print "This test is not performed on model "; SPECS.MODNAME Call CONTINUE Exit Function Else Print "Testing, please wait..." End If IEXCSENSE! = MEASRES!(IEXCSEN!, 2, "") Call OHMSET(1E+30) 'Set input R = infinity Call SETTEST(0) 'Route I2 through sense R Call POWERON(5!) 'Set Vsupply to 5.0V Call LOADMUX(1, CON%) 'Measure differential input 'voltage to check sense 'resistor matching Call WRITEDVM(VODC$, 0.05) DIFFIN! = Abs(READDVM(0.001)) If DIFFIN! > 10 Then 'Meter overrange, I2 is not working IEXC! = 99 I2STAT$ = "FAIL" SOUND 1000, 0.5 LOCATE 10, 10 Print "Current source I2 (+IN terminal) is not working." Call CONTINUE ElseIf DIFFIN! > IEXC! * RIN! * 1.1 Then 'Current source sense resistors IEXC! = 99 'are out of matching tolerance I2STAT$ = "FAIL" '10% tolerance SOUND 1000, 0.5 LOCATE 10, 10 Print "Current source sense resistors are out of matching tolerance." Print Tab(10); "Please notify engineering." Call CONTINUE End If Call LOADMUX(1, COFF%) If I2STAT$ <> "FAIL" Then Call LOADMUX(4, CON%) 'check for initial value of 'I2 within spec Call WRITEDVM(VODC$, IEXCSENSE! * IEXC! * 0.000001) IPLUSIN! = READDVM(0.001) / IEXCSENSE! * 1000000! 'Excitation current (uA) If Abs(IPLUSIN! - IEXC!) <= IEXC! * IEXCTOL! Then I2STAT$ = "PASS" Else I2STAT$ = "FAIL" SOUND 1000, 0.5 LOCATE 10, 10 Print "Current source I2 is out of tolerance." Print Tab(10); "Check tantalum capacitor for reverse leakage." Print Tab(10); "Check current source resistor, diode, transistor and amplifier." End If 'LOCATE 10, 10 'PRINT "Status: "; I2STAT$; 'CALL FAILSTATUS (I2STAT$, 10, 10, "Status: ") 'Print test status to screen LOCATE 11, 10 Print Tab(10); "Measured value of I2 (+IN terminal) is"; Print Tab(50); USING; "####.# uA"; IPLUSIN! Print Tab(10); "Required value of I2 is"; Print Tab(50); USING; "####.# uA +/- ##.# uA"; IEXC!; IEXC! * IEXCTOL! Call FAILSTATUS(I2STAT$, 10, 10, "Status: ", 30) 'Print test status to screen Call LOADMUX(4, COFF%) End If 'IF I2STAT$ = "FAIL" THEN CALL CONTINUE 'Pause to read note IEXC2$ = I2STAT$ + Str$(IPLUSIN!) + "1" Call PAUSE(0.2) End Function Function IMATCH$(I1$, I2$) 'Current sources must be matched to a specified tolerance to 'guarantee the lead resistance effect spec. 'This test is not applicable to 4-wire input modules ' IEXC! = SPECS.IEXC 'Excitation current (uA) IMATCHTOL! = SPECS.IMATCHTOL! / 100 'Convert to percent 'extract measured data (uA). IPLUSIN! = Val(Mid$(I1$, 5, Len(I1$) - 5)) IMINUSIN! = Val(Mid$(I2$, 5, Len(I2$) - 5)) Cls TESTTITLE$ = "Excitation Current Source Matching Test" Call HEADERB(TESTTITLE$) LOCATE 10, 10 DIFF! = IPLUSIN! - IMINUSIN! If Abs(DIFF!) <= IMATCHTOL! * IEXC! Then IMSTAT$ = "PASS" Else IMSTAT$ = "FAIL" SOUND 1000, 0.5 LOCATE 10, 10 Print "Current source matching is out of tolerance." Print Tab(10); "Check tantalum capacitors for reverse leakage." Print Tab(10); "Check current source resistors for matching." End If 'LOCATE 10, 10 'PRINT "Status: "; IMSTAT$; 'CALL FAILSTATUS (IMSTAT$, 10, 10, "Status: ") 'Print test status to screen LOCATE 11, 10 Print Tab(10); "Measured current source matching is"; Print Tab(50); USING; " +###.# uA"; DIFF! Print Tab(10); "Required matching is"; Print Tab(50); USING; "+/-###.# uA"; IMATCHTOL! * IEXC! Call FAILSTATUS(IMSTAT$, 10, 10, "Status: ", 30) 'Print test status to screen IMATCH$ = IMSTAT$ + Str$(DIFF!) + "1" Call PAUSE(0.2) End Function Sub INDIVID(SEL%, CAL%) 'Individual tests. ' Dim TSIM!(102), OUTCALC!(102), OUTMEAS!(102), ERROROUT!(102), ACCSTAT$(102) If SENSOROUT!(SPECS.MININ, 0) = 99! Then 'Check for valid sensor type Print Tab(10); "Exiting INDIVID for invalid sensor type!." SOUND 1000, 0.5 'Beep to alert to failure. Call CONTINUE Exit Sub End If Call ENABLE(CON%) 'Enable output switch SNM% = SENSORNUM% If SNM% = 11 Then HALFBRIDGE% = 1 'Enable shunt input cap. CB1VAL% = CB1VAL% And &HFB '1 1 1 1 1 0 1 1 Call SETTH(CB1VAL%, CB1%) Else HALFBRIDGE% = 0 End If If Left$(SPECS.MODNAME, 12) = "SCM5B38-1146" Then Call CASEINST 'Tell user to install a case over the unit End If Do Select Case SEL% Case 1 A$ = SUPPLYI$(0) 'power is off Case 2 A$ = SUPPLYI$(1) 'power is off Case 3 Cls TESTTITLE$ = "Current Source Operation and Matching" Call HEADERB(TESTTITLE$) If SNM% = 5 Or SNM% = 7 Then B$ = IEXC2$(IEXCSENSE!) A$ = IEXC1$(IEXCSENSE!) C$ = IMATCH$(A$, B$) Call POWERON(0!) 'Set Vsupply to 0V Call RESETTH 'Reset for standard operation ElseIf SNM% = 6 Then A$ = IEXC1$(IEXCSENSE!) Call POWERON(0!) 'Set Vsupply to 0V Call RESETTH 'Reset for standard operation Else LOCATE 10, 10 Print "This test is not performed on model "; SPECS.MODNAME Call CONTINUE Exit Do End If Case 4 Call POWERON(5!) 'Set Vsupply to 5.0V A$ = OUTSWITCH$ Case 5 Call POWERON(5!) 'Set Vsupply to 5.0V Cls LOCATE 10, 10 INPUT "Has the module been calibrated"; ASK$ If UCase$(ASK$) = "N" Then Call CALSEQ(CAL%) End If A$ = CJCGAIN$ Case 6 CALCOUNT% = 0 Do 'Stay in loop until exit If CALCOUNT% = 0 Then SEL2% = 1 'Go to offset/gain cal at start Else SEL2% = CALMENU% 'Ask user what to do next End If Select Case SEL2% 'select off/gain cal, acc/lin or exit Case 1 'offset/gain cal Call CALSEQ(CAL%) FIN$ = "N" Call CONTINUE Case 2 If SNM% >= 5 And SNM% <= 7 Then 'Check if resistance in Call POWERON(0!) 'Turn off power Call WRITEDVM("S0", 0) 'Slow reading rate for max accuracy CONTRES! = MEASRES!(1!, 4, "") 'Measure contact resistance End If A$ = LINTEST$(ACC$, CONTRES!, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$()) FIN$ = "N" Call CONTINUE Case 3 'Exit to individual menu FIN$ = "Y" End Select CALCOUNT% = CALCOUNT% + 1 Loop While FIN$ <> "Y" Case 7 Call POWERON(5!) 'Set Vsupply to 5.0V A$ = EXCCAL$(0) Case 8 Call POWERON(5!) 'Set Vsupply to 5.0V A$ = EXCREG$ B$ = VOREG$ Case 9 Call POWERON(5!) 'Set Vsupply to 5.0V A$ = EXCILIM$ Case 10 If SNM% >= 5 And SNM% <= 7 Then 'Check if resistance in Call WRITEDVM("S0", 0) 'Slow reading rate for max accuracy CONTRES! = MEASRES!(1!, 4, "") 'Measure contact resistance End If A$ = LINTEST$(ACC$, CONTRES!, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$()) Case 11 Call POWERON(5!) 'Set Vsupply to 5.0V A$ = LEADREFF$(TOTLRESPEC!) Case 12 Call POWERON(5!) 'Set Vsupply to 5.0V A$ = SUPPLYSEN$ Case 13 Call POWERON(5!) 'Set Vsupply to 5.0V A$ = INPUTR$ Case 14 Call POWERON(5!) 'Set Vsupply to 5.0V A$ = OPENIN$ Case 15 Call POWERON(5!) 'Set Vsupply to 5.0V Call GENSET(GENAMPL!) A$ = FREQRESP$(GENAMPL!) Case 16 Call POWERON(5!) 'Set Vsupply to 5.0V A$ = STEPRESP$ Case 17 Call POWERON(5!) 'Set Vsupply to 5.0V A$ = OUTNOISE$ End Select SELECTION% = SEL% If SELECTION% <> 6 Then 'If not doing offset/gain cal Call CONTINUE Call POWERON(0!) 'Turns off module power RESP$ = REPEAT$(SPECS.MODNAME) Else 'For offset/gain cal Call POWERON(0!) 'Turns off module power RESP$ = "N" End If Loop While RESP$ <> "N" If SNM% = 1 And (SPECS.MAXIN > 10 Or SPECS.MININ < -10 Or SPECS.OSCALIN < -10) Then Print Print Tab(5); "Insert the yellow connector into the meter +/-SENSE terminals." Call CONTINUE End If If HALFBRIDGE% = 1 Then 'Disable shunt input cap. CB1VAL% = CB1VAL% Or &H4 '0 0 0 0 0 1 0 0 Call SETTH(CB1VAL%, CB1%) End If If Mid$(SPECS.MODNAME, 10, 4) = "1442" Or Mid$(SPECS.MODNAME, 10, 4) = "1443" Then 'units with +EXC and -IN shorted Call REMEXCPIN(0) 'Reconnect +EXC from the test interface board End If End Sub Function INPUTR$() MAXIN! = SPECS.MAXIN '+f.s. input voltage (V) MININ! = SPECS.MININ '-f.s. input voltage (V) MAXOUT! = SPECS.MAXOUT MINOUT! = SPECS.MINOUT SPEC! = SPECS.INPUTRES 'Meg ohms INRANGE! = MAXIN! - MININ! ORANGE! = MAXOUT! - MINOUT! Cls TESTTITLE$ = "Input Resistance & Bias Current Test" Call HEADERB(TESTTITLE$) LOCATE 10, 10 If SENSORNUM% <> 1 Or MAXIN! > 10! Then 'Check for V in and |Vmax| <= 10V Print "This test is not performed on model "; SPECS.MODNAME Exit Function Else Print "Testing, please wait." End If Call SETDAC(MAXIN!, 1, MAXINVAR!, 0) 'Sets DAC ' CALL LOADMUX(2, CON%) 'Measure Vout ' CALL WRITEDVM(VODC$, MAXOUT!) ' VO1! = READDVM!(.001) CB0VAL% = CB0VAL% Or &H4 '0 0 0 0 0 1 0 0 Call SETTH(CB0VAL%, CB0%) 'Insert 5.1Mohm resistor 'in series with input. Call LOADMUX(2, CON%) 'Turns on mux, reset with resistor insert Call WRITEDVM(VODC$, MAXOUT!) VO2! = READDVM!(0.001) 'Output voltage (V) Call LOADMUX(2, COFF%) ' DELTAVO! = (VO2! - VO1!) * 1000! 'Output change (mV) ' MAXDELTA! = (MAXOUT! - VOUT!((SPEC! / (SPEC! + RSERIES!)) * MAXIN!)) * 1000!'max change (mV) PEDOS! = VOUT!(0!) GAIN! = ORANGE! / INRANGE! RINMEAS! = Abs((VO2! - PEDOS!) * RSERIES! / (MAXIN! * GAIN! - VO2!) / 1000000!) If RINMEAS! > 1000 Then RINMEAS! = 1000 If RINMEAS! >= SPEC! Then INR$ = "PASS" Else INR$ = "FAIL" SOUND 1000, 0.5 End If 'LOCATE 10, 10 'PRINT "Status: "; INR$; 'CALL FAILSTATUS (INR$, 10, 10, "Status: ") 'Print test status to screen LOCATE 10, 10 Print Spc(20); Print Tab(10); "Measured input resistance is"; Print Tab(50); USING; " #### Mohms"; RINMEAS! Print Tab(10); "Required input resistance is"; Print Tab(50); USING; ">= #### Mohms"; SPEC! Call FAILSTATUS(INR$, 10, 10, "Status: ", 30) 'Print test status to screen INPUTR$ = INR$ + Str$(RINMEAS!) + "0" Call RESETTH 'Reset the test head Call PAUSE(0.2) End Function Function LEADREFF$(TOTLRESPEC!) 'Test the effects of adding a 3.3 ohm series lead resistance in 'the +IN and -IN leads. Series resistance is not added in the +EXC 'line because this only produces a common mode shift. 'LRE is not tested for 4-wire input modules because 3.3 ohms would produce 'and insignificant effect and LRE rejection is inherent by design. SPEC! = SPECS.LEADRERR 'deg. C/ohm or ohm/ohm LOWOHM! = SENSOROUT!(SPECS.MININ, 0) 'Convert Tin to ohms in HIGHOHM! = SENSOROUT!(SPECS.MAXIN, 0) 'Convert Tin to ohms in MAXOUT! = SPECS.MAXOUT IMATCHTOL! = SPECS.IMATCHTOL! ORANGE! = SPECS.MAXOUT - SPECS.MINOUT INRANGE! = SPECS.MAXIN - SPECS.MININ Cls TESTTITLE$ = "Lead Resistance Effects Test" Call HEADERB(TESTTITLE$) LOCATE 10, 10 SNM% = SENSORNUM% If SNM% <> 5 Or SNM% <> 7 Then 'Check if 3-wire resistance in Print "This test is not performed on model "; SPECS.MODNAME Exit Function Else Print "Testing, please wait..." End If GAIN! = ORANGE! / INRANGE! 'V/C OR V/OHM RLEAD! = 3.3 '3.3 ohm series R IEXCERR! = IMATCHTOL! * RLEAD! / (HIGHOHM! - LOWOHM!) 'Error from current source mismatch, % span RLEADERR! = 0.05 * RLEAD! / (HIGHOHM! - LOWOHM!) 'Error from mismatch in 3.3 ohm resistors in test head 'Assumes +/-2.5% matching TOTLRESPEC! = SPEC! + (IEXCERR! + RLEADERR!) * INRANGE! / RLEAD! 'C/OHM + % * C / OHM Call OHMSET(HIGHOHM!) 'Set input R = plus f.s. Call SETTEST(5) 'Move +EXC to RTD (relay ' contact R in each lead) Call LOADMUX(2, CON%) 'Measure Vout Call WRITEDVM(VODC$, MAXOUT!) VOUTNOR! = READDVM(0.0001) 'Output voltage, no series R (V) Call SETTEST(4) 'Insert series R in each lead Call LOADMUX(2, CON%) 'Measure Vout VOUTR! = READDVM(0.0001) 'Output voltage, with series R (V) Call LOADMUX(2, COFF%) LRE! = (VOUTR! - VOUTNOR!) / GAIN! / RLEAD! If Abs(LRE!) <= TOTLRESPEC! Then LRE$ = "PASS" Else LRE$ = "FAIL" SOUND 1000, 0.5 Print Print Tab(10); "Check the current source matching." End If If SNM% = 7 Then 'Choose units for output IN$ = "ohm" 'Pot in Else IN$ = "C" 'RTD in End If LOCATE 10, 10 Print Spc(20); Print Tab(10); "Measured lead resistance effect is"; PRINT TAB(50); USING " +##.## &/ohm"; LRE!; IN$ Print Tab(10); "Required lead resistance effect is"; PRINT TAB(50); USING "+/-##.## &/ohm"; TOTLRESPEC!; IN$ Call FAILSTATUS(LRE$, 10, 10, "Status: ", 30) 'Print test status to screen LEADREFF$ = LRE$ + Str$(LRE!) + "2" Call RESETTH 'Reset the test head Call PAUSE(0.2) End Function Function LINTEST$(ACC$, CONTRES!, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$()) 'Accuracy/linearity test. ' SENSOR$ = SPECS.SENTYPE MININ! = SPECS.MININ MAXIN! = SPECS.MAXIN MINOUT! = SPECS.MINOUT MAXOUT! = SPECS.MAXOUT MAXLINERR! = SPECS.LINEAR '% MAXACCERR! = SPECS.ACCURACY '% BANDWIDTH! = SPECS.BANDWIDTH LIN% = SPECS.LINEARIZED CALOS! = SPECS.OSCALPT / 100 '% INRANGE! = SENSOROUT!(SPECS.MAXIN!, 0) - SENSOROUT!(SPECS.MININ!, 0) ORANGE! = MAXOUT! - MINOUT! 'Output range (V) Cls TESTTITLE$ = "Accuracy Test" Call HEADERB(TESTTITLE$) SNM% = SENSORNUM% Print Print Tab(21); "Calculated"; Tab(38); "Measured" If SNM% >= 3 And SNM% <= 6 Then 'Temperature input modules Print Tab(6); "Temp. (C)"; ElseIf SNM% = 2 Or SNM% = 9 Then 'Current input modules Print Tab(6); "Iin (mA)"; INSCALE! = 1 ElseIf SNM% = 7 Then 'Resistance input modules Print Tab(5); "Rin (ohms)"; Else If MAXIN! >= 1 Then Print Tab(7); "Vin (V)"; INSCALE! = 1 Else Print Tab(6); "Vin (mV)"; INSCALE! = 1000 End If End If Print Tab(22); "Vout (V)"; Tab(39); "Vout (V)"; Print Tab(53); "Error (%)"; Tab(69); "Status" Print Tab(5); "=========="; Tab(21); "=========="; Tab(37); "=========="; Print Tab(53); "========="; Tab(68); "========" 'Output format '1 10 20 30 40 50 60 70 80 ' | | | | | | | | 'Rin (ohms) ' Temp. (C) ' Iin (mA) Calculated Measured ' Vin (V) Vout (V) Vout (V) Error (%) Status '========== ========== ========== ========= ======== ' #####.## +##.### +##.### +###.### ' +####.## +##.### +##.### +###.### ' +###.### +##.### +##.### +###.### PASS If PON% = 1 Then LPRINT TAB(34); "ACCURACY TEST" LPRINT LPRINT TAB(21); "Calculated"; TAB(38); "Measured" If SNM% >= 3 And SNM% <= 6 Then 'Temperature input modules LPRINT TAB(6); "Temp. (C)"; ElseIf SNM% = 2 Or SNM% = 9 Then 'Current input modules LPRINT TAB(6); "Iin (mA)"; ElseIf SNM% = 7 Then 'Resistance input modules LPRINT TAB(5); "Rin (ohms)"; Else If MAXIN! >= 1 Then LPRINT TAB(7); "Vin (V)"; Else LPRINT TAB(6); "Vin (mV)"; End If End If LPRINT TAB(22); "Vout (V)"; TAB(38); "Vout (V)*"; LPRINT TAB(53); "Error (%)"; TAB(69); "Status" LPRINT TAB(5); "=========="; TAB(21); "=========="; TAB(37); "=========="; LPRINT TAB(53); "========="; TAB(68); "========" End If INC% = 0 'Array element NUMPTS% = 5 'Number of points in test 'Optional statements for file output If LOGDAT% > 0 Then INPUT "Enter the number of points to be tested "; NUMPTS% INPUT "Enter file name "; F$ F$ = "C:\QB45\JJM\" + F$ Open F$ For Output As #3 Write #3, (MAXIN! - MININ!) Write #3, MININ! Write #3, NUMPTS% End If FAILED% = 0 LINSTEP! = (MAXIN! - MININ!) / (NUMPTS% - 1) 'Step size For MODIN! = MININ! To MAXIN! + LINSTEP! / 2 Step LINSTEP! 'LINSTEP!/2 ensures NUMPTS% test point INC% = INC% + 1 LOOP1: L% = L% + 1 If SNM% >= 5 And SNM% <= 7 Then 'Check if resistance in RIN! = SENSOROUT!(MODIN!, 0) 'Calc. ohms Call OHMSET(RIN! - CONTRES!) 'Set input Call WRITEDVM("S0", 0) 'Slow reading rate for max accuracy MEASIN! = MEASRES!(RIN!, 3, "") + CONTRES! 'Measure simulated resistor Call POWERON(5!) 'Set Vsupply = 5V INPUTERR! = 100! * (MEASIN! - RIN!) / INRANGE! Else If INC% = 1 Then Call POWERON(5!) 'Set Vsupply = 5V If SNM% = 3 Then PTCV! = PARASITICTCV!(VCJC!) If VCJC! = 99! Then Print Tab(10); "Error in LINTEST$ test:" Print Tab(10); "Vcjc = 99 (error value)!" BF$ = "FAIL" 'Set FAIL status. SOUND 1000, 0.5 'Beep to alert to failure. LINTEST$ = BF$ 'Set function output to FAIL status. Call FAILSTATUS(BF$, 18, 10, "Linearity status: ", 30) 'Print test status to screen Exit Function End If Else PTCV! = 0 End If End If VIN! = SENSOROUT!(MODIN!, PTCV!) Call SETDAC(VIN!, 1, MAXINVAR!, 0) 'Sets input voltage Call WRITEDVM("S0", 0) 'Slow reading rate for max accuracy Call LOADMUX(1, CON%) Call LOADMUX(0, CON%) 'Mux erroneously set on Station 3. 'Sometimes CH4, sometimes CH8 Call LOADMUX(1, CON%) 'Measure Vout Call WRITEDVM(VODC$, VIN!) 'Sets meter to read MEASIN! = READDVM!(INRANGE! * 0.0001) '0.01% tolerance While Abs(VIN!) > 10 And (Abs(VIN!) - Abs(MEASIN!)) > 1 'Power supply current limit tripped SL$ = SETPOWER(VINADDR%, Abs(VIN!), FUNC$) 'Set Vin MEASIN! = READDVM!(INRANGE! * 0.0002) '0.02% tolerance Wend Call LOADMUX(1, COFF%) 'Set input set/meas. error as % of input range. (measured minus set over the input range). INPUTERR! = 100! * (MEASIN! - VIN!) / INRANGE! End If 'Force into error value (for debug). If FORCEACCLINFAIL% = 1 Then INPUTERR! = 20! 'Error value. End If Call WRITEDVM("S1", 0) TSIM!(INC%) = SENSORIN!(MEASIN!, PTCV!) If (SNM% >= 3 And SNM% <= 6) And LIN% = 0 Then OUTCALC!(INC%) = VOUT!(MEASIN! + PTCV!) 'Output not linear with input Else 'temperature. OUTCALC!(INC%) = VOUT!(TSIM!(INC%)) End If Call LOADMUX(2, CON%) Call LOADMUX(0, CON%) 'Mux erroneously set on Station 3. 'Sometimes CH4, sometimes CH8 Call LOADMUX(2, CON%) 'Measure Vout If INC% = 1 And CALOS! > 0.03 Then 'Prevents meter from overranging for module that have a offset calibration point higher than 3% Call WRITEDVM(VODC$, OUTCALC!(INC%) + CALOS! * ORANGE!) Else Call WRITEDVM(VODC$, OUTCALC!(INC%)) 'Sets meter to read output End If If BANDWIDTH! < 1 Then P! = 5 '10 ElseIf MAXACCERR! <= 0.035 Then P! = 2 '3 ElseIf SNM% >= 5 And SNM% <= 7 Then 'Check if resistance in P! = 2 'Module settling after power on. Else P! = 0 End If Call PAUSE(P!) 'Pause for filter settling OUTMEAS!(INC%) = READDVM!(0.00005 * ORANGE!) ERROROUT!(INC%) = (OUTMEAS!(INC%) - OUTCALC!(INC%)) / ORANGE! * 100! 'Error (%) If Abs(VIN!) > 10 And Abs(ERROROUT!(INC%)) > 100 Then 'Power supply current limit tripped SL$ = SETPOWER(VINADDR%, Abs(VIN!), FUNC$) 'Set Vin OUTMEAS!(INC%) = READDVM!(0.00005 * ORANGE!) ERROROUT!(INC%) = (OUTMEAS!(INC%) - OUTCALC!(INC%)) / ORANGE! * 100! 'Error (%) End If If LOGDAT% > 0 Then Write #3, ERROROUT!(INC%) / 100! * ORANGE! * 1000! ' Convert to mV. Call LOADMUX(2, COFF%) If Abs(VIN!) > 10 Then SL$ = SETPOWER(VINADDR%, Abs(VIN!), LOOPOFF$) 'Disable power supply End If If L% = 1 And (Left$(SPECS.MODNAME, 12) = "SCM5B38-1298" Or Left$(SPECS.MODNAME, 10) = "SCM5B38-01") Then GoTo LOOP1 'Check for input error more than 10% of the expected input, in 'addition to the accuracy-step error (PWR 2014-11-04). If (Abs(INPUTERR!) > 10!) Then 'Input error more than 10% of set value = FAIL ACCSTAT$(INC%) = "FAIL" FAILED% = FAILED% + 1 SOUND 2000, 0.5 ElseIf Abs(ERROROUT!(INC%)) <= MAXACCERR! Then ACCSTAT$(INC%) = "PASS" Else ACCSTAT$(INC%) = "FAIL" FAILED% = FAILED% + 1 SOUND 800, 0.5 End If 'Original code commented out below (PWR 2014-11-04) 'IF ABS(ERROROUT!(INC%)) <= MAXACCERR! THEN ' ACCSTAT$(INC%) = "PASS" 'ELSE ' ACCSTAT$(INC%) = "FAIL" ' FAILED% = FAILED% + 1 ' SOUND 800, .5 'END IF If SNM% >= 3 And SNM% <= 6 Then 'Temperature input modules Print Tab(6); USING; "+####.## +##.### +##.### +###.###"; TSIM!(INC%); OUTCALC!(INC%); OUTMEAS!(INC%); ERROROUT!(INC%); ElseIf SNM% = 7 Then 'Resistance input modules Print Tab(6); USING; "#####.## +##.### +##.### +###.###"; TSIM!(INC%); OUTCALC!(INC%); OUTMEAS!(INC%); ERROROUT!(INC%); Else 'Voltage or current input modules Print Tab(6); USING; "+###.### +##.### +##.### +###.###"; TSIM!(INC%) * INSCALE!; OUTCALC!(INC%); OUTMEAS!(INC%); ERROROUT!(INC%); End If If (Left$(ACCSTAT$(INC%), 4) = "FAIL") Then Color 12, 0 'Test value text color to light red Else Color 10, 0 'Test value text color to light green End If Print Tab(70); ACCSTAT$(INC%) Color 11, 0 'Back to light cyan (blue) on black background. If PON% = 1 Then If SNM% >= 3 And SNM% <= 6 Then 'Temperature input modules LPRINT TAB(6); USING "+####.## +##.### +##.### +###.###"; TSIM!(INC%); OUTCALC!(INC%); OUTMEAS!(INC%); ERROROUT!(INC%); ElseIf SNM% = 7 Then 'Resistance input modules LPRINT TAB(6); USING "#####.## +##.### +##.### +###.###"; TSIM!(INC%); OUTCALC!(INC%); OUTMEAS!(INC%); ERROROUT!(INC%); Else 'Voltage or current input modules LPRINT TAB(6); USING "+###.### +##.### +##.### +###.###"; TSIM!(INC%) * INSCALE!; OUTCALC!(INC%); OUTMEAS!(INC%); ERROROUT!(INC%); End If LPRINT TAB(70); ACCSTAT$(INC%) End If If Abs(ERROROUT!(INC%)) > Abs(ACCERR!) Then ACCERR! = ERROROUT!(INC%) End If 'Variables used to calculate the best fit line using linear regression. SMODIN! = SMODIN! + TSIM!(INC%) SSMODIN! = SSMODIN! + TSIM!(INC%) ^ 2 SERR! = SERR! + ERROROUT!(INC%) SPROD! = SPROD! + TSIM!(INC%) * ERROROUT!(INC%) If SNM% >= 5 And SNM% <= 7 Then Call POWERON(0) Next If LOGDAT% > 0 Then Close #3 If FAILED% = 0 Then ACC$ = "PASS" Else Color 12, 0 'Test value text color to light red Print Print Tab(10); "Failure due to measured module input too far from set input."; Color 11, 0 'Text color back to light cyan (blue) ACC$ = "FAIL" SOUND 800, 0.5 End If SLOPE! = ((NUMPTS% * SPROD!) - (SMODIN! * SERR!)) / ((NUMPTS% * SSMODIN!) - (SMODIN! ^ 2)) OFFSET1! = ((SERR! * SSMODIN!) - (SMODIN! * SPROD!)) / ((NUMPTS% * SSMODIN!) - (SMODIN! ^ 2)) BFERR! = Abs(BESTFIT!(SLOPE!, OFFSET1!, TSIM!(), NUMPTS%, ERROROUT!())) If Abs(BFERR!) <= MAXLINERR! Then BF$ = "PASS" Else SOUND 600, 0.5 BF$ = "FAIL" End If Print 'PRINT TAB(10); "Accuracy status: "; ACC$ 'CALL FAILSTATUS (ACC$, 10, -1, "Accuracy status: ") 'Print test status to screen LOCATE 15, 10 Print Tab(10); "Measured accuracy error is"; Print Tab(50); USING; " +###.### %"; ACCERR! Print Tab(10); "Maximum accuracy error is"; Print Tab(50); USING; "+/-##.### %"; MAXACCERR! Print Call FAILSTATUS(ACC$, 14, 10, "Accuracy status: ", 30) 'Print test status to screen 'PRINT TAB(10); "Linearity status: "; BF$ 'CALL FAILSTATUS (BF$, 15, -1, "Linearity status: ") 'Print test status to screen 'CALL FAILSTATUS (BF$, 10, -1, "Linearity status: ") 'Print test status to screen LOCATE 19, 10 Print Tab(10); "Measured best-fit linearity error is"; Print Tab(50); USING; "+/-###.### %"; BFERR! Print Tab(10); "Maximum best-fit linearity error is"; Print Tab(50); USING; "+/- ##.### %"; MAXLINERR! Call FAILSTATUS(BF$, 18, 10, "Linearity status: ", 30) 'Print test status to screen ACC$ = ACC$ + Str$(Abs(ACCERR!)) + "3" 'Convert to % span LINTEST$ = BF$ + Str$(Abs(BFERR!)) + "3" 'append # decimal places Call RESETTH 'Reset the test head If SNM% >= 5 And SNM% <= 7 Then Call POWERON(5) Call PAUSE(0.2) End Function Sub LOGIT(STATUS$(), SN$, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$(), TOTLRESPEC!) N% = 15 Do LASTCHAR$ = Mid$(SPECS.MODNAME, N%, 1) N% = N% - 1 Loop While LASTCHAR$ = " " If UCase$(LASTCHAR$) = "T" Or SPECS.MODNAME = "SCM5B31-1172 " Then B% = 1 Else A% = FAILS%(STATUS$()) B% = 0 End If If A% = 0 Or B% = 1 Then Open "C:\ATE\5BLOG\" + RTrim$(Mid$(SPECS.MODNAME, 6, 8)) + ".DAT" For Append As #4 Open "C:\ATE\LOGPATH.ADR" For Input As #7 Input #7, LogPath$ Close #7 Open LogPath$ + "\5BLOG\" + RTrim$(Mid$(SPECS.MODNAME, 6, 8)) + ".DAT" For Append As #8 NUMPTS% = 5 'builds a sequential file. 20 records required for 1 module Write #4, SPECS.MODNAME Write #8, SPECS.MODNAME For INC% = 1 To NUMPTS% Write #4, TSIM!(INC%), OUTCALC!(INC%), OUTMEAS!(INC%), ERROROUT!(INC%), ACCSTAT$(INC%) Write #8, TSIM!(INC%), OUTCALC!(INC%), OUTMEAS!(INC%), ERROROUT!(INC%), ACCSTAT$(INC%) Next '"0" place holders are old LOWV! and HIGHV! step response specs. Write #4, "0", "0", TOTLRESPEC! Write #8, "0", "0", TOTLRESPEC! For INC% = 0 To 19 Step 5 Write #4, STATUS$(INC% + 1), STATUS$(INC% + 2), STATUS$(INC% + 3), STATUS$(INC% + 4), STATUS$(INC% + 5) Write #8, STATUS$(INC% + 1), STATUS$(INC% + 2), STATUS$(INC% + 3), STATUS$(INC% + 4), STATUS$(INC% + 5) Next Write #4, SN$, Date$ Write #8, SN$, Date$ Close #4 Close #8 End If End Sub '******************************* Sub LOGMODFILES(STATUS$(), SN$, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$(), TSPEC$(), TOTLRESPEC!, TX%) 'Sub to write the data log, datasheet, and work order status files (and inform the 'operator of these operations) ' Call WAITFORFINISH 'Pause until "F" key is pressed (so that final test results can be viewed) KEY(10) OFF 'Deactivates F10 key Cls Print Tab(10); "Logging test results." Call LOGIT(STATUS$(), SN$, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$(), TOTLRESPEC!) 'Logs test data to disk Call DATASHEETWRITE(SN$, STATUS$(), TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$(), TSPEC$(), TX%) Print Tab(10); "Writing status to work order status file." Call WORKORDERLINE(FAILS%(STATUS$()), SN$) KEY(10) ON 'Reactivates F10 key Color 11, 0, 0 'Cyan on black background Call INTERLUDE Call DATASHEETPRINT(SN$, STATUS$()) End Sub Sub MODULEOUTLINE() 'print a bottom view of the module showing potentiometer location 'SCM5Bxx-xx 'print module pins and potentiometers LOCATE 4, 25 Print " x x x x x x x" Print Tab(25); "x x x x x x x" LOCATE 3, 23 Print Chr$(201) For A = 4 To 5 'print left vertical line LOCATE A, 23 Print Chr$(186) Next A LOCATE 6, 23 Print Chr$(200) For A = 24 To 55 'print top horizontal line LOCATE 3, A Print Chr$(205) Next A LOCATE 3, 56 Print Chr$(187) For A = 4 To 5 'print right vertical line LOCATE A, 56 Print Chr$(186) Next A LOCATE 6, 56 Print Chr$(188) For A = 24 To 55 'print bottom horizontal line LOCATE 6, A Print Chr$(205) Next A End Sub Sub PASSTHRUTEST(STATUS$(), TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$()) 'Runs tests for pass-through modules. ' If SENSOROUT!(SPECS.MININ, 0) = 99! Then 'Check for valid sensor type Print Tab(10); "Exiting PASSTHRUTEST for invalid sensor type!." SOUND 1000, 0.5 'Beep to alert to failure. Call CONTINUE Exit Sub End If 'FOR X = 1 TO 21 'Clear test result array For X = 1 To MAXSTATUSINDEX 'Clear test result array STATUS$(X) = "" Next X SNM% = SENSORNUM% Call ENABLE(CON%) 'Enable output switch MN$ = Left$(SPECS.MODNAME, 12) If MN$ = "SCM5BPT-1367" Then STATUS$(1) = SUPPLYI$(0) 'Supply current test 'Sets Vs to +5.0V 'No excitation load If Left$(STATUS$(1), 4) = "FAIL" Then Exit Sub 'Exit on over current 'Power shut off STATUS$(6) = OUTSWITCH$ 'Output switch test STATUS$(15) = "PASS" 'Power Supply Sensitivity STATUS$(20) = OUTNOISE$ 'Test Output Noise ElseIf MN$ = "SCM5B-1369 " Then STATUS$(1) = SUPPLYI$(0) 'Supply current test 'Sets Vs to +5.0V 'No excitation load If Left$(STATUS$(1), 4) = "FAIL" Then Exit Sub 'Exit on over current 'Power shut off STATUS$(6) = OUTSWITCH$ 'Output switch test STATUS$(15) = SUPPLYSEN$ 'Power supply sensitivity STATUS$(20) = OUTNOISE$ 'Test Output Noise Else STATUS$(1) = "PASS" STATUS$(6) = "PASS" STATUS$(15) = "PASS" 'Power Supply Sensitivity STATUS$(20) = "PASS" 'Output Noise End If STATUS$(12) = LINTEST$(ACC$, CONTRES!, TSIM!(), OUTCALC!(), OUTMEAS!(), ERROROUT!(), ACCSTAT$()) 'Performs linearity and 'accuracy tests STATUS$(13) = ACC$ 'Assigns results of accuracy test If MN$ = "SCM5BPT-1367" Then 'OHM! = 300 '250 OHM is internal to the module and 1 Ohm for lead R. It's 0 Ohm on the testhead in series with CH2. MR 10/17/06 STATUS$(17) = PASS$ 'Can't test for diode clamp unless HV p.s. is used. ElseIf MN$ = "SCM5BPT-1516" Then OHM! = 250 + 1 '250 OHM is internal to the module and 1 Ohm for lead R. It's 0 Ohm on the testhead in series with CH2. MR 10/17/06 STATUS$(17) = OPENIN$ 'Tests for diode clamp Else STATUS$(17) = "PASS" OHM! = 1 'It's 0 Ohm on the test-head. End If If MN$ <> "SCM5B-1369 " And MN$ <> "SCM5BPT-1367" Then CB0VAL% = CB0VAL% Or &H10 '1 1 1 1 0 0 1 0 Call SETTH(CB0VAL%, CB0%) 'Short module inputs and open analog ground Call PAUSE(0.2) TE$ = "TE1005" OUTRES! = MEASRES!(OHM!, 7, TE$) If Abs(OUTRES! - OHM!) > 0.1 * OHM! And OHM! > 25 Then '10/17/06 MR STATUS$(13) = "FAIL" + "999" + "2" ElseIf Abs(OUTRES! - OHM!) > 25 And OHM! < 25 Then '10/17/06 MR STATUS$(13) = "FAIL" + "999" + "2" End If End If STATUS$(2) = "PASS" STATUS$(3) = "PASS" STATUS$(4) = "PASS" STATUS$(5) = "PASS" STATUS$(7) = "PASS" STATUS$(8) = "PASS" STATUS$(9) = "PASS" STATUS$(10) = "PASS" STATUS$(11) = "PASS" 'STATUS$(12) = "PASS" 'linearity test STATUS$(14) = "PASS" 'lead resistance effects STATUS$(16) = "PASS" STATUS$(18) = "PASS" 'Frequency Response STATUS$(19) = "PASS" 'Tests Step Response Call RESETTH Call POWERON(0!) 'Turns off module power End Sub Function PROGNAMEVAL$() 'Function to return the library source file version PROGNAMEVAL$ = PROGNAME$ End Function Function PROGVERVAL$() 'Function to return the library source file version PROGVERVAL$ = VERSION$ End Function