def connect(): global fd, offline if offline == False: # Already Online msgwin.msg('Already Connected. ' + fd.last_msg(), 'black') return fd = phm.phm() # Create Phm Object, find Hardware if fd == None: import offline fd = offline.phm() offline = True root.title('No Hardware Connection, running offline') msgwin.msg('No Hardware Connection, running offline', 'red') return msgwin.msg('Found Phoenix Hardware ' + fd.last_msg(), 'black') root.title(fd.last_msg()) offline = False if active_expt != None: switch_expt(active_expt)
""" Connect Capacitor between CH0 and GND. Resistor from D3out to CH0. For linear charging: Connect capcitor between D3out and CH0. Resistor from CCS to CH0 """ import phm, time p=phm.phm() p.select_adc(0) p.set_adc_size(2) p.write_outputs(8) time.sleep(1) p.enable_set_low(3) v=p.read_block(200,25,0) p.plot_data(v) p.save_data(v, 'cap.dat') print 'Press any Key to Exit' raw_input()
running = False def setduration(self): global maxtime maxtime = Scale.get() for ch in range(NUMCHANS): dispobjects[ch].delete_lines() dispobjects[ch].setWorld(0, 0, maxtime, maxvolts) dispobjects[ch].mark_axes('Seconds','mV') if len(data[ch]) > 1: #dispobjects[ch].delete_lines() dispobjects[ch].line(data[ch], 'black') def quit(): sys.exit() ph = phm.phm() ph.set_adc_size(2) ph.select_adc(0) # Use this is NUMCHANS = 1 root = Tk() Canvas(root, width = WIDTH, height = 5).pack(side=TOP) # Some space at the top for k in range(NUMCHANS): w = draw.disp(root, width=WIDTH, height=HEIGHT) # make plot objects using draw.disp w.setWorld(0, 0, maxtime, maxvolts) w.mark_axes('Seconds','mV') dispobjects.append(w) dispobjects[0].mark_axes('milli Seconds','mV') cf = Frame(root, width = WIDTH, height = 10) cf.pack(side=TOP, fill = BOTH, expand = 1)
pass #ignore errors ch = ch + 1 def update(self): self.update_digins() if self.looping == True: self.draw() if self.waiting_capture: for val in self.data: if abs(val[1]) > self.limit: self.looping = False self.waiting_capture = False self.msg.config(text='Captured') break self.parent.after(10, self.update) return root = Tk() fd = phm.phm() if fd == None: root.title('Error') Label(root, bg = 'red',text='Phoenix-M Hardware not found').pack() root.mainloop() sys.exit() font = tkFont.Font ( family="times", size=12, weight="normal" ) root.option_add ( "*font", font) root.title('CROplus') CRO(root) root.mainloop()
import phm, time p = phm.phm() p.set_ddr(0, 255) pos = 0 seq = [12, 6, 3, 9] i = 0 while (1): p.set_port(0, seg[i % 3]) i += 1