Exemple #1
0
 def open(self):  # Connects to the hardware
     print "Connecting to %s\n\n" % self.devName
     handle = daq.Open(self.devName)  # Open device
     if handle == -1:
         print "Cannot connect to device\n"
         print "Exit"
         sys.exit(handle)
     return handle
#																			
# This example demonstrates using the timer output on P3 DaqBoard3000
# to generate signals. Timer 0 will be a 1kHz Pulse Train, timer 
# 1 will be 50kHz	

# from IO import *

import time
import msvcrt
import daqx as daq
import daqxh as daqh

FREQ_DIV0	= 999   # for 1KHz		
FREQ_DIV1	= 19    # for 50 KHz

handle = daq.Open('DaqBoard3K0')
#settings for timer 0
daq.SetOption(handle, 0, daqh.DcofChannel, daqh.DcotTimerDivisor, FREQ_DIV0)
#settings for timer 1
daq.SetOption(handle, 1, daqh.DcofChannel, daqh.DcotTimerDivisor, FREQ_DIV1)

#turn on both timers simultaneously
daq.SetOption(handle, 0, daqh.DcofModule, daqh.DmotTimerControl, daqh.DcovTimerOn)

print "Signals currently being output...\nPress <Enter> to quit"

#while not msvcrt.kbhit():
#    time.sleep(10)

time.sleep(10)
Exemple #3
0
RATE = 100  #Hz

#used to configure scan
buffer = np.zeros((SCANS * CHANCOUNT, ),
                  dtype=np.uint16)  #WORD        buffer[SCANS*CHANCOUNT];
gains = [DgainDbd3kX1]  #gains[0]    = DgainDbd3kX1;     #gain of X1
channels = [0]  #channels[0] = 0;           #select channel 0
flags = [DafBipolar]  #flags[0]    = DafBipolar;  #select Bipolar mode

# This is the default name for a DaqBoard3000 when configured through the
# Control Panel Applet. If you have named your device differently than the default,
# it must be changed here for this example to function.
devName = daq.GetDeviceList()[0]  #find 1st IOtech device

print "Connected to %s\n\n" % devName
handle = daq.Open(devName)
if handle == -1:
    print "Cannot conncet to device\n"
    print "Exit"
    sys.exit(handle)

print "Setting up scan...\n"

daq.AdcSetAcq(handle, DaamNShot, 0, SCANS)
#Scan settings
daq.AdcSetScan(handle, channels, gains, flags)
#set scan rate
daq.AdcSetFreq(handle, RATE)
#Set buffer location, size and flag settings
daq.AdcTransferSetBuffer(handle, buffer, SCANS, CHANCOUNT,
                         DatmUpdateSingle + DatmCycleOff)