comedi_data_read

Langue: en

Version: 28 October 2007 (fedora - 04/07/09)

Section: 3 (Bibliothèques de fonctions)

NAME

comedi_data_read - read single sample from channel

SYNOPSIS

#include <comedilib.h>

int comedi_data_read (comedi_t * device, unsigned int subdevice, unsigned int channel, unsigned int range, unsigned int aref, lsampl_t * data);

DESCRIPTION

Reads a single sample on the channel specified by the Comedi device device, the subdevice subdevice, and the channel channel. For the A/D conversion (if appropriate), the device is configured to use range specification range and (if appropriate) analog reference type aref. Analog reference types that are not supported by the device are silently ignored.

The function comedi_data_read() reads one data value from the specified channel and places the data value in the location pointed to by data.

WARNING: comedi_data_read() does not do any pausing to allow multiplexed analog inputs to settle before performing an analog to digital conversion. If you are switching between different channels and need to allow your analog input to settle for an accurate reading, use comedi_data_read_delayed(), or set the input channel at an earlier time with comedi_data_read_hint().

On sucess, comedi_data_read() returns 1 (the number of samples read). If there is an error, -1 is returned.

Data values returned by this function are unsigned integers less than or equal to the maximum sample value of the channel, which can be determined using the function comedi_get_maxdata(). Conversion of data values to physical units can be performed by the function comedi_to_phys().