c simple program calculate threshold current c given the status word, the scid, and the clock c calculate the threshold current, the capacitor setting, the gain setting c the instrument mode, and lmode as determined from the status word c subroutine thresh(fact,icap,igain,ipls, * ityp,kmod,kstat,idsc,jclk) c integer l1x integer*2 kstat,jclk,idsc,ipls,ityp,kmod real cap(2),gain(2),clock(3),V0(2) data cap /0.15,1.15/ data gain /2.,20/ data clock /0.03,0.21,0.93/ data V0 /453.,372./ c c decode status word to get icap and igan c icg = l1x(kstat) ityp = mod(icg,16) ipls = icg/16 icap = mod(ipls,2) igain = mod(ipls/2,2) imode = ipls/4 c determine kmod from kstat if(mode .eq. 0) kmod =1 if(imode .eq. 3) kmod = 2 if(imode .eq. 2) kmod = 4 if(imode .eq. 1) kmod = 3 c write(6,17) kstat,icg,ityp,ipls,imode,igain,icap 17 format(8z9) fact = V0(idsc)*CAP(ICAP+1)/(GAIN(IGAiN+1)*CLOCK(JCLK)) c write(6,1000) kstat,fact,ipls,ityp,igain,icap,jclk, c *idsc,cap(icap+1),gain(igain+1),v0(idsc),clock(jclk) 1000 format(" ",z5,f10.2,6I5,4f8.2) return end