def __init__(self): self.amplitude = 0.01 self.frequency = 10000 self.size = 128 # Pixels*Pixels self.channel0 = 0 self.channel1 = 1 self.device = daqDevice(b'DaqBoard3K0') self.deviceType = DddtLocal
def __init__(self): self.amplitude = 0.01 self.frequency = 10000 self.size = 128 # Pixels*Pixels self.channel0 = 0 self.channel1 = 1 self.device = daqDevice(b'DaqBoard3K0') self.deviceType = DddtLocal self.gain = daqh.DgainX1 self.flags = daqh.DafAnalog | daqh.DafUnsigned | daqh.DafBipolar | daqh.DafDifferential self.max_voltage = 10.0 self.bit_depth = 16 self.img = np.zeros((self.size, self.size, 3), dtype=np.uint8)
def _openDevice(self): self.iotech = daq.daqDevice(self.config.deviceNameStr)
if outSwitch: dev.DacWt(outType, outChan, outData) outSwitch = False else: dev.DacWt(outType, outChan, 0.0) outSwitch = True return outSwitch def daqInput(dev): read = dev.AdcRd(inputChan, inputGain, inputFlags) # The data list is a global variable and can be accessed anywhere. data.append(read) try: # Setup the device. dev = daq.daqDevice(device_name) # Timers for i in range(int(runtime*outFreq)): outSwitch = daqOutput(dev, outSwitch) # Execute 10 times, or for 5 seconds then switch the output. for v in range(int(inputFreq/outFreq)): daqInput(dev) time.sleep(1.0/inputFreq) for i in data: # Convert sample from unsigned integer value to bipolar voltage. print(i*max_voltage*2/(2**bit_depth) - max_voltage) finally: dev.Close()