Пример #1
0
    def set_bias_value(self, val, channel=0):
        """
        Sets bias value of channel <channel> to value <val>.

        Parameters
        ----------
        val: float
            Bias value.
        channel: int
            Number of channel of interest. Default is 0 (ao0).

        Returns
        -------
        None
        """
        self._bias_values[channel] = val
        nidaq.write(devchan='{:s}/ao{:d}'.format(self._dev, channel), data=val)
Пример #2
0
    def write(self,
              data,
              channel,
              freq=1e4,
              minv=-10.0,
              maxv=10.0,
              timeout=10.0):
        """
        Writes analog output values <data> to output channel <channel> with sample frequency <freq>.

        Parameters
        ----------
        data: int/float/numpy.array
            Voltage data to write in Volts.
        channel: int
            Number of output channel of interest.
        freq: float
            Sample frequency in Hertz.
        minv: float
            Minimum voltage in Volts.
        maxv: float
            Maximum voltage in Volts.
        timeout: float
            Time to wait for completion in seconds.

        Returns
        -------
        written: int
            Number of values written
        """
        # Corresponding command: http://zone.ni.com/reference/en-XX/help/370471AM-01/daqmxcfunc/daqmxcreatetask/
        # Corresponding command: http://zone.ni.com/reference/en-XX/help/370471AM-01/daqmxcfunc/daqmxcreateaovoltagechan/
        # Corresponding command: http://zone.ni.com/reference/en-XX/help/370471AM-01/daqmxcfunc/daqmxwriteanalogscalarf64/
        # Corresponding command: http://zone.ni.com/reference/en-XX/help/370471AM-01/daqmxcfunc/daqmxcfgsampclktiming/
        # Corresponding command: http://zone.ni.com/reference/en-XX/help/370471AM-01/daqmxcfunc/daqmxwriteanalogf64/
        # Corresponding command: http://zone.ni.com/reference/en-XX/help/370471AM-01/daqmxcfunc/daqmxstarttask/
        # Corresponding command: http://zone.ni.com/reference/en-XX/help/370471AM-01/daqmxcfunc/daqmxstoptask/
        # Corresponding command: http://zone.ni.com/reference/en-XX/help/370471AM-01/daqmxcfunc/daqmxcleartask/
        return nidaq.write(devchan='{:s}/ao{:d}'.format(self._dev, channel),
                           data=data,
                           freq=freq,
                           minv=minv,
                           maxv=maxv,
                           timeout=timeout)
Пример #3
0
 def write(self,devchan, data, freq=10000.0, minv=-10.0, maxv=10.0,timeout=10.0):
     return nidaq.write(devchan, data, freq=freq, minv=minv, maxv=maxv,timeout=timeout)
Пример #4
0
 def do_set_output(self, val, channel):
     devchan = '%s/%s' % (self._id, channel)
     return nidaq.write(devchan, val)