######################################################################### # DLISET macro set # # macro set to set the amplification ranges of a DLI 99539 current amplifier # using a MeasurementComputing PCI-DIO24 digital I/O # # author: dm smilgies 2/02 # revision: dm smilgies 3/02 # # hardware requirements: # PCI-DIO24 has to be configured in "config" and "gsetup" # custom cable from PCI-DIO24 D-37 connector to DLI99539 D-37 connector # DLI99539 in remote mode for all installed channels # # macro list # dliinit initialize settings # dliset set unit and gain # dlishow show units and gain values # dlitest run through all possible settings # diotest test of DIO24 board # # list of global variables # NAMP number of current amplifier units used (set by dliinit) # AMP[1] gain of unit 1 # ... # AMP[8] gain of unit 8 ######################################################################### ######################################################################### # DLISET # # macro set to set the amplification ranges of a DLI 99539 current amplifier # using a MeasurementComputing PCI-DIO24 digital I/O # # author: dm smilgies 3/02 ######################################################################### def dliset '{ ### checks ### # check arguments if($#!=2) { p "usage: dliset unit gain" exit} # check input local unit,gain # check unit unit=$1 if (unit<0||unit>8) { p "choose unit between 0=all, 1, 2, ...,",NAMP exit} if (unit>NAMP) {p "warning: only",NAMP,"units initialized -> type dliinit to update"} # check gain gain=$2 if (gain<4||gain>11) { p "choose gain exponent between 4 and 10, CAL=11" exit} ### keep record of the amplifier status ### global AMP[] local i,j for(i=1;i1, unit2->2, unit3->4, unit4->8, ..., unit8->128 #negative logic: unit active, if TTL=LO if(unit==0) { out1=0 } else { out1=255-pow(2,unit-1) } #encode gain #gain chosen by register bank C / RW_ADDR3 #gain exponent set by bits 1,2,4 out2=gain-4 # out3 foreseen as flag for local/remote toggle switch # flag at bit 8 out3=0 # out3=pow(2,3) # (note: does not seem to work smi 3/02) # value to write to register out2=out2+out3 ### write to registers ### # write range to register bank C port_put(RW_ADDR3,out2) # delay of 1/100 sec needed for synchronization sleep(0.01) # read back check2=port_get(RW_ADDR3) if(check2!=out2) { p "warning: output error -> out2=",out2,"check2=",check2 exit} sleep(0.01) # enable unit with register bank A port_put(RW_ADDR1,out1) sleep(0.01) # read back check1=port_get(RW_ADDR1) if(check1!=out1) { p "warning: output error -> out1=",out1,"check1=",check1 exit} sleep(0.01) # disable all units port_put(RW_ADDR1,255) sleep(0.01) # read back check1=port_get(RW_ADDR1) if(check1!=255) { p "warning: output error -> out1=255","check1=",check1 exit} }' ######################################################################### # DLISHOW # # macro to show the amplification ranges of a DLI 99539 current amplifier # using a MeasurementComputing PCI-DIO24 digital I/O # # author: dm smilgies 3/02 ######################################################################### global NAMP def dlishow '{ local i p "status of DLI 99539" p "currrent amplifier ranges" p "=========================" for(i=1;i