Specifications

Comedi
39 / 148
Description
Similar to comedi_data_read() except it will wait for the specified number of nanoseconds between setting the input channel
and taking a sample. For analog inputs, most boards have a single analog to digital converter which is multiplexed to be able to
read multiple channels. If the input is not allowed to settle after the multiplexer switches channels, the reading will be inaccurate.
This function is useful for allowing a multiplexed analog input to settle when switching channels.
Although the settling time is specified in nanoseconds, the actual settling time will be rounded up to the nearest microsecond.
5.4.1.5 comedi_data_read_hint
comedi_data_read_hint — tell driver which channel/range/aref you are going to read from next
Synopsis
#include <comedilib.h>
int comedi_data_read_hint(comedi_t * device, unsigned int subdevice, unsigned int channel, unsigned int range, unsigned int
aref);
Description
Used to prepare an analog input for a subsequent call to comedi_data_read(). It is not necessary to use this function, but it
can be useful for eliminating inaccuracies caused by insufficient settling times when switching the channel or gain on an analog
input. This function sets an analog input to the channel, range, and aref specified but does not perform an actual analog to digital
conversion.
Alternatively, one can simply use comedi_data_read_delayed(), which sets up the input, pauses to allow settling, then
performs a conversion.
5.4.1.6 comedi_data_write
comedi_data_write — write single sample to channel
Synopsis
#include <comedilib.h>
int comedi_data_write(comedi_t * device, unsigned int subdevice, unsigned int channel, unsigned int range, unsigned int aref,
lsampl_t data);
Description
Writes a single sample on the channel that is specified by the Comedi device device, the subdevice subdevice, and the channel
channel. If appropriate, the device is configured to use range specification range and analog reference type aref. Analog
reference types that are not supported by the device are silently ignored.
The function comedi_data_write() writes the data value specified by the parameter data to the specified channel.
Return value
On success, comedi_data_write() returns 1 (the number of samples written). If there is an error, -1 is returned.