def write_one_sample_port_uint16(self, data, timeout=10):
"""
Writes a single 16-bit unsigned integer sample to a single
digital output channel in a task.
Use this method for devices with up to 16 lines per port.
Args:
data (int): Specifies the 16-bit unsigned integer sample to
write to the task.
timeout (Optional[float]): Specifies the amount of time in
seconds to wait for the method to write all samples.
NI-DAQmx performs a timeout check only if the method
must wait before it writes data. This method returns an
error if the time elapses. The default timeout is 10
seconds. If you set timeout to
nidaqmx.constants.WAIT_INFINITELY, the method waits
indefinitely. If you set timeout to 0, the method tries
once to write the submitted samples. If the method could
not write all the submitted samples, it returns an error
and the number of samples successfully written.
"""
auto_start = (self._auto_start if self._auto_start is not
AUTO_START_UNSET else True)
numpy_array = numpy.asarray([data], dtype=numpy.uint16)
return _write_digital_u_16(
self._handle, numpy_array, 1, auto_start, timeout)
评论列表
文章目录