示例#1
0
文件: co.py 项目: creilly/sitzlabrad
 def __init__(self,name):
     Task.__init__(self,name)
     daqmx(
         dll.DAQmxCfgImplicitTiming,
         (
             self.handle,
             constants['DAQmx_Val_FiniteSamps'],
             c_uint64(200)
         )
     )
     self.stopped = False
示例#2
0
文件: do.py 项目: creilly/sitzlabrad
 def __init__(self,name):
     Task.__init__(self,name)
     channel = self.get_channels()[0]
     physical_channel = create_string_buffer(BUF_SIZE)
     daqmx(
         dll.DAQmxGetPhysicalChanName,
         (
             self.handle, 
             channel, 
             physical_channel, 
             BUF_SIZE
             )
         )
     self.exponent = int(
         physical_channel.value.split('/')[-1].split('line')[-1]
         )
示例#3
0
文件: ai.py 项目: creilly/sitzlabrad
 def __init__(self,*channels):
     Task.__init__(self,*channels)
     daqmx(
         dll.DAQmxSetSampQuantSampMode,
         (
             self.handle,
             constants['DAQmx_Val_FiniteSamps']
         )
     )
     daqmx(
         dll.DAQmxSetSampTimingType,
         (
             self.handle,
             constants['DAQmx_Val_SampClk']
         )
     )
示例#4
0
    def __init__(self, channelDicts=None):
        """
        create an analog input task
        
        @param channelDicts: tuple of dictionaries
            that can be unpacked into the        
            L{createChannel} method (e.g.
            C{({AITask.PHYSICAL_CHANNEL:'dev0/ai1',...},...)})
        """
        Task.__init__(self)

        if channelDicts is None:
            channelDicts = tuple([])

        self.callback = None
        self.acquiring = False

        def callback(handle, eType, samples, callbackData):
            samples = self.readSamples()
            self.stopSampling()
            if self.callback is not None: self.callback(samples)
            return 0

        DAQmxDoneEventCallbackPtr = CFUNCTYPE(c_int, c_void_p, c_int, c_uint32,
                                              c_void_p)
        c_callback = DAQmxDoneEventCallbackPtr(callback)
        self.c_callback = c_callback

        daqmx(dll.DAQmxRegisterDoneEvent,
              (self.handle, 0, self.c_callback, None))

        for channelDict in channelDicts:
            self.createChannel(channelDict)

        daqmx(dll.DAQmxSetSampTimingType,
              (self.handle, constants['DAQmx_Val_SampClk']))
        daqmx(dll.DAQmxSetSampQuantSampMode,
              (self.handle, constants['DAQmx_Val_FiniteSamps']))
        sampClkMaxRate = c_double()
        daqmx(dll.DAQmxGetSampClkMaxRate, (self.handle, byref(sampClkMaxRate)))
        daqmx(dll.DAQmxSetSampClkRate, (self.handle, sampClkMaxRate))
示例#5
0
    def __init__(self,channelDicts=None):
        """
        create an analog input task
        
        @param channelDicts: tuple of dictionaries
            that can be unpacked into the        
            L{createChannel} method (e.g.
            C{({AITask.PHYSICAL_CHANNEL:'dev0/ai1',...},...)})
        """
        Task.__init__(self)

        if channelDicts is None:
            channelDicts = tuple([])

        self.callback = None
        self.acquiring = False

        def callback(handle,eType,samples,callbackData):
            samples = self.readSamples()
            self.stopSampling()
            if self.callback is not None: self.callback(samples)
            return 0

        DAQmxDoneEventCallbackPtr = CFUNCTYPE(c_int, c_void_p, c_int, c_uint32, c_void_p)
        c_callback = DAQmxDoneEventCallbackPtr(callback)
        self.c_callback = c_callback

        daqmx(
            dll.DAQmxRegisterDoneEvent,
            (
                self.handle,
                0,
                self.c_callback,
                None
            )
        )

        for channelDict in channelDicts:
            self.createChannel(channelDict)
            
        daqmx(
            dll.DAQmxSetSampTimingType,
            (
                self.handle,
                constants['DAQmx_Val_SampClk']
            )
        )
        daqmx(
            dll.DAQmxSetSampQuantSampMode,
            (
                self.handle,
                constants['DAQmx_Val_FiniteSamps']
            )
        )
        sampClkMaxRate = c_double()
        daqmx(
            dll.DAQmxGetSampClkMaxRate,
            (
                self.handle,
                byref(sampClkMaxRate)
            )
        )
        daqmx(
            dll.DAQmxSetSampClkRate,
            (
                self.handle,
                sampClkMaxRate
            )
        )
示例#6
0
文件: ci.py 项目: creilly/sitzlabrad
 def __init__(self,name):
     Task.__init__(self,name)
     self.count = 0
示例#7
0
文件: ao.py 项目: creilly/sitzlabrad
 def get_units(self):
     return Task.get_units(self).values()[0]