#%TITLE%
# PICO.MAC
#%NAME%
# Support for the keithley pico ampermeter as a pseudo counter
#%DESCRIPTION%
# The keithley pico ampermeter can be used as a counter. The new
# macros will read the pico ampermeter during counting multiple times
# and calculate the average. Therefore a timer has to be configured.
# If you do not have a timer use the UNIX software timer.
def pico_getcounts '{
local picoanswer
if ((picoanswer = gpib_get($2)) != ""){
PICO_AVER[$3] +=substr(picoanswer,5)*1E12*PICO_POLARITY
PICO_NOREADS[$3]++;
S[$1] = counter_par($1,"scale") * PICO_AVER[$3] / \
((PICO_NOREADS[$3] == 0)?1:PICO_NOREADS[$3])
}
}'
def pico_precount '
S[$1] = 0; PICO_AVER[$3] = 0 ; PICO_NOREADS[$3]=0
'
#%UU%
#%MDESC%
# changes the polarity of the picoampermeter
def picopol '
global PICO_POLARITY
if (PICO_POLARITY == -1) {
PICO_POLARITY = 1
printf ("Polarity of picoampermeter now positive\n")
}
else {
PICO_POLARITY = -1
printf ("Polarity of picoampermeter now negative\n")
}
'
def pico_init ' '
#%UU% [first gpib channel] [number of picoammeters]
#%MDESC%
# defines pico1, pico2, ... as pseudo counters
# these pseudo counters have to be defined in config to be used
def picosetup '
#Setup the channel of the Keithley Picoampermeter as counter
global PICO_CHANNEL PICO_NO PICO_POLARITY PICO_NOREADS PICO_AVER
if (PICO_POLARITY == 0) PICO_POLARITY = 1
if ($# > 2) {
print "Usage: picosetup [first gpib channel] [number of picoammeters]"
exit
}
if ($# < 1) {
PICO_CHANNEL = getval("The picoammeters start from which gpib channel ",PICO_CHANNEL)
}
else {
PICO_CHANNEL=$1
}
if ($# < 2) {
PICO_NO = getval("How many picoammeters do you use ",PICO_NO)
}
else {
PICO_NO =$2
}
for (i=0; i<PICO_NO; i++) {
local ppstring
ppstring = sprintf("pico%d pico_precount none pico_getcounts none none %d %d",i+1,PICO_CHANNEL+i,i)
cpseudosdef ppstring
cdef("user_pollcounts",sprintf("pico_getcounts pico%d %d %d ;"\
,i+1,PICO_CHANNEL+i,i),sprintf("pico%d",i+1),0x02)
}
pico_init
'
#%MACROS%
#%IMACROS%
#%AUTHOR%
# PICO.MAC JK 5.93
#%TOC%
|