#!/usr/bin/python from pycamac import Server, Af from time import clock, sleep from classes import Counter, UrrMover i = Server().getInterface(0) crate = i.getCrate(2) counter = Counter(i.getCrate(3).getModule(8)) #mover = UrrMover(crate.getModule(20), 4, 0) channel = 0 count = 0 while True: # if count > 10: # mover.move(1) counter.clear(0) sleep(1) print counter.read(channel) count += 1
#!/usr/bin/python from pycamac import Server, Af, Error from classes import Counter, UrrMover, KvchMover from time import sleep import getopt from sys import argv, exit interface = Server().getInterface(0) crate = interface.getCrate(2) exposition = 10 steps = 38 stepSize = 1 switchChan = 1 opts, args = getopt.getopt(argv[1:], "ht:c:l:n:") for o, a in opts: if o == "-t": exposition = float(a) elif o == "-c": steps = int(a) elif o == "-l": stepSize = float(a) elif o == "-n": switchChan = int(a) else: print """ -h - show help -t number - exposition in seconds -l number - time of step in seconds -c number - a number of steps
b = ch * 2 #channel base self.module.af(Af(b+1, 9)) self.module.af(Af(b, 9)) def read(self, ch): b = ch * 2 #channel base high = self.module.afr24(Af(b+1, 0)) low = self.module.afr24(Af(b, 0)) rv = ((high & 0xffff) << 16) + low print "high: 0x%06x, low: 0x%06x, result: 0x%x" % (high, low, rv) return rv def increment(self, ch): b = ch * 2 #channel base self.module.af(Af(b, 25)) i = Server().getInterface(0) counter = Counter(i.getCrate(2).getModule(8)) channel = 0 #lock = i.getCrate(3) cycles = -1 start = clock()-0.00001 count = counter.read(channel)-1 #counter.clear(channel) #for i in range(0, 65000): # counter.increment(channel) while True: cycles+=1 newcount1 = counter.read(channel) # print "First read:", cycles, newcount1