-- JasmineCalibrate.mesa edit by McGregor December 1, 1980 4:56 PM DIRECTORY JasmineDefs: FROM "JasmineDefs"; JasmineCalibrate: PROGRAM IMPORTS JasmineDefs EXPORTS JasmineDefs = BEGIN OPEN JasmineDefs; RamRec: TYPE = MACHINE DEPENDENT RECORD [pad: [0..15],offset:[0..63],gain:[0..63]]; sh: POINTER TO ScanHead; rv: ARRAY [0..1024) OF RamRec; sp: POINTER TO PACKED ARRAY OF [0..377B]; JZeroRam: PROCEDURE = BEGIN c: CARDINAL; FOR c IN [0..1024) DO rv[c] _ RamRec[0,63,0]; ENDLOOP; JasmineLoadRam[LOOPHOLE[@rv]]; END; JKRam: PROCEDURE [k: CARDINAL] = BEGIN c: CARDINAL; FOR c IN [0..1024 ) DO rv[c]_RamRec[,63,k]; ENDLOOP; JasmineLoadRam[LOOPHOLE[@rv]]; END; JasmineCalibrate: PUBLIC PROCEDURE = BEGIN p420: POINTER TO UNSPECIFIED = LOOPHOLE[420B]; saved420: POINTER TO POINTER _ p420^; under: BOOLEAN; i: CARDINAL; max,maxi,tmax,maxval,maxupper,maxlower,tmp,temp,temp1: INTEGER; line: ARRAY [0..1024) OF INTEGER _ ALL[0]; linea: ARRAY [0..1024) OF INTEGER _ ALL[0]; c: CARDINAL = 100; -- number of lines g: CARDINAL = 63; -- gain -- turn off display p420^ _ saved420^; JasmineSetWindow[0, 1024, 100, 300]; sh_JasmineScanInit[]; JZeroRam[]; --read lines with zero gain and collect sum for c lines THROUGH [0..c) DO sp_JasmineReadLine[sh]; FOR i IN [0..1024) DO line[i]_sp[i]+line[i]; ENDLOOP; ENDLOOP; --divide by c to get average FOR i IN [0..1024) DO line[i]_line[i]/c; ENDLOOP; --read lines with given gain g in order to get max percentage increase. JKRam[g]; --load given gain JasmineStep[c,FALSE]; --back up paper --collect sum for c lines THROUGH [0..c) DO sp_JasmineReadLine[sh]; FOR i IN [0..1024) DO linea[i]_sp[i]+linea[i]; ENDLOOP; ENDLOOP; --divide by c to get average FOR i IN [0..1024) DO linea[i]_linea[i]/c; ENDLOOP; max_0; maxi_0; maxval_0; FOR i IN [0..1024) DO maxval_MAX[line[i],maxval]; IF (tmp _ linea[i] - line[i]) > max THEN BEGIN max _ tmp; maxi _ i; END; ENDLOOP; JZeroRam[]; under _TRUE; maxupper_max+(max/8); --set upcoming treshold to max + 16% maxlower_max+(max/4); --set downgoing treshold to max + 25% tmax_maxupper; temp1_g*line[maxi]; FOR i IN [0..1024) DO temp_maxval-line[i]; IF temp > tmax THEN BEGIN tmax_maxupper; LOOP; END; tmax_maxlower; rv[i].gain_ABS[MIN[((temp1/line[i])*temp)/max,g]]; --don't reorder expression!! ENDLOOP; JasmineLoadRam[LOOPHOLE[@rv]]; JasmineScanClose[sh]; p420^ _ saved420; -- restore display END; END. (635)\f1 3b16B328b1B42b9B132b6B144b17B322i15I24i4I6i16I97i57I118i30I55i73I13i15I26i13I1i27I119i30I277i35I25i36I209i24I92i15I