RTEMS Logo

RTEMS 4.6.99.3 On-Line Library


Analog Driver Read from a Particular Analog

PREV UP NEXT Bookshelf BSP and Device Driver Development Guide

17.6: Read from a Particular Analog

This corresponds to the driver read call. After validating the minor number and arguments, this call reads the indicated device. Most analog devices store the last value written to a DAC. Since DACs are output only devices, saving the last written value gives the appearance that DACs can be read from also. If the device is an ADC, then it is sampled.

NOTE: Many boards have multiple analog inputs but only one ADC. On these boards, it will be necessary to provide some type of mutual exclusion during reads. On these boards, there is a MUX which must be switched before sampling the ADC. After the MUX is switched, the driver must delay some short period of time (usually microseconds) before the signal is stable and can be sampled. To make matters worse, some ADCs cannot respond to wide voltage swings in a single sample. On these ADCs, one must do two samples when the voltage swing is too large. On a practical basis, this means that the driver usually ends up double sampling the ADC on these systems.

The value returned is a single precision floating point number representing the voltage read. This value is stored in the argument_block passed in to the call. By returning the voltage, the caller is freed from having to know the number of bits in the analog and board dependent conversion algorithm.


PREV UP NEXT Bookshelf BSP and Device Driver Development Guide

Copyright © 1988-2004 OAR Corporation