Exemplo n.º 1
0
		for i in threadlist:
			try:
				i.stop_thread()
			except:
				i.log_exception("Couldn't stop!")
		running=1
		while(running):
			time.sleep(1.0)
			running=0
			for i in threadlist:
				running = running or i.running
						
		if lock_fail_test:	extra_adc.unlock_completely()

mux=vxi_11_connection_mux.connection_mux()
data=tagged_data.tagged_data_system()
	
try:
	from vxi_crate_module import * #this module is safe for this
	from device_addresses import crate_host as vxi_host_address
		
	data.define_field("cameras",dio, (35,8),1)
	data.define_field("valves", dio, (8,8),1)
	data.define_field("system_status", dio, (16,8),0)
	data.define_field("dio96", dio, (0,96),1)
	data.define_field("analog_sample", scan_adc, [0,1,2,3])
	data.define_field("glue",glue_board, (0,8),1)
	data.define_field("dq_voltage", dac1, 0,1)
	data.define_field("hv_setpoint", dac2, 1, 1)
	
	mux.add_host(vxi_host_address, max_connections=15)
Exemplo n.º 2
0
    def get_data(self):
        vxi.scanning_voltmeter.get_data(self)
        data.volts = [v.loop_count, v.scan]

    def monitor(self):
        self.lock()  #stay locked!
        vxi.scanning_voltmeter.monitor(self)
        #self.unlock() #not needed... monitor does unlock_completely


s = DSTPServer()
UseNumericArray(0)
v = voltmeter(3)
try:
    data = tagged_data.tagged_data_system()
    data.define_field("volts",
                      s, ("DVMVolts", [1, array.array('f', [0])]),
                      writable=1)
    data.define_field("quit", s, ("quit", 0), writable=0)
    sth = threading.Thread(target=s.serve, name='server')
    sth.start()
    v.run_thread()
    loops = 0
    while (not data.quit) and sth.isAlive():
        time.sleep(0.25)
        loops = loops + 1
        if loops > 100: break
finally:
    print v.loop_count
    s.close()
Exemplo n.º 3
0
import traceback
import Numeric
import math

import nati_dstp_basics
import tagged_data
import dstp_async


nati_dstp_basics.UseNumericArray(1) #use Numeric.array instead of array.array as standard format

print "go!"

s=dstp_async.DSTPServer()

data=tagged_data.tagged_data_system() #create a data cache with neatly nameable elements 

#define data types in the cache, and what device is responsible for them, and what format they have:
#data.define_field(<visible_name>, <device>, <internal name on device>, <sample object for this field>, <writable>
#note that for DSTP devices, the <internal name on device> much match the DSTP URL given in labVIEW (not case sensitive)
data.define_field("XY", s, ("xyvals", [array.array('d',[]), array.array('d',[])]), writable=0)
data.define_field("fitparms", s, ("parms", [0,array.array('d'),0.0,array.array('d')]), writable=1)
data.define_field("quit_server", s, ("quit_server", 0), writable=0)

#create a routine to listen for shutdown commands
def quit_server(string):
	if data.quit_server:
		s.close()
#tell the server to pass shutdown commands to this routine
s.listen("quit_server", quit_server)