Analog to Digital Converter - PalouseRobosub/SUBLIBinal GitHub Wiki

ADC (Analog to Digital Converter)

SUBLIBinal offers an ADC peripheral library to simplify implementation of ADC functionality within programs in an easy to use manner. It also develops the ADC in an interrupt driven manner, where nodes are placed onto a queue for conversion. A node is simply a piece of data containing information about what to read and where the data should be stored when it is completed. The ADC is currently one of two peripherals that utilizes a background process. This background process must be placed in the embedded system loop or it will not function properly. The ADC library documentation has been divided into three sections: enumeration definitions, structure declarations, and available functions. Please refer to the following list to be redirected to the appropriate documentation.

ADC Implementation:

To view a more conceptual understanding of the ADC peripheral library implementation within SUBLIBinal, please refer to the design documentation.

ADC Design

To view examples of the ADC implemented with the SUBLIBinal library, please refer to the ADC Example code.


What is an ADC

An ADC is an analog to digital converter. It is used to read the voltage on a pin of a microcontroller and then convert that value into some digital representation. For example, say we provide 2.5V on a 5V microcontroller. After ADC conversion, we will be given the value of roughly 124 (as the ADC gives us a value between 0-255, with 255=5V). ADCs are useful for measuring the voltage of an analog response system as digital systems cannot comprehend ranges of voltages. It is important to know that an ADC cannot convert a value from an analog value to a digital value immediately, which is why it is implemented as an interrupt driven design. The ADC can continue processing while other code is run on the main program of the microcontroller.

top