The ADC creates a quantization error that results from the conversion of the infinitely variable analogue input signal to a discrete level output signal. As such, there will be a quantization of the analogue input signal. The digital output is a discrete level signal with a value that represents a range of analogue input signal levels. It is common for the ADC output to be an unsigned binary value, although (particularly for bipolar operation) the digital output might also be provided in signed binary (2s complement) representation. Any analogue input that exceeds these limits (both positive and negative inputs) can damage the ADC as well as saturate the output at a minimum or maximum digital output value. The ADC analogue input (voltage or current) can vary from a set minimum value to a set maximum value to provide a valid digital output representation of the analogue input. Ian Grout, in Digital Systems Design with FPGAs and CPLDs, 2008 8.3.2 ADC Characteristics In the following example, the ADC module 1 is initialized and data are read from channel 10: There is no need to call function ADCx_Init to initialize the ADC module. The ADCx_Read function initializes the ADC module and reads data from the specified channel input. In the following example, data are read from channel 5 of ADC module 1 and the converted data are stored in variable Temp: In addition, the appropriate TRISx port bit must be configured as input. The ADC module must be initialized before using this function.
The 10-bit unsigned value is returned by the function. The ADCx_Get_Sample function reads data from the specified channel. In the following example, ADC module 1 is configured to operate with external reference voltage: _ADC_EXTERNAL_REF (external voltage reference) _ADC_INTERNAL_REF (internal voltage reference) This function is called with one parameter, the reference voltage, which can take two possible values: The ADCx_Init_Advanced function is used to configure an ADC to work with user defined settings. A/D converters usually generate interrupts when a conversion is complete so that the user program can read the converted data quickly.Ī/D converters are very useful in control and monitoring applications because most sensors (e.g., temperature sensor, pressure sensor, and force sensor) produce analog output voltages that cannot be read by a microcontroller without an A/D converter. The A/D conversion process must be started by the user program and it may take several hundreds of microseconds for a conversion to complete. For example, the PIC18F452 microcontroller has 10-bit, 8-channel A/D converters. Most PIC microcontrollers with A/D features have multiplexed A/D converters where more than one analog input channel is provided. A/D converters are usually 8–10 bits having 256–1024 quantization levels. It is also possible to connect an external A/D converter to any type of microcontroller. Some microcontrollers have built-in A/D converters. ADC converters usually generate interrupts when a conversion is complete so that the user program can read the converted data quickly and efficiently.ĪDC converters are very useful in control and monitoring applications since most sensors (e.g., temperature sensor, pressure sensor, force sensor) produce analogue output voltages.ĭogan Ibrahim, in SD Card Projects Using the PIC Microcontroller, 2010 1.3.9 A/D ConverterĪn A/D converter is used to convert an analog signal like voltage to digital form so that it can be read and processed by a microcontroller. The ADC conversion process must be started by the user program, and it may take several tens of microseconds for a conversion to complete. For example, PIC32MX460F512L microcontroller has 16 channels of ADC converters, each 10-bit wide. Most PIC microcontrollers with ADC features have multiplexed ADC converters where more than one analogue input channel is provided. PIC32 microcontroller ADC converters are usually 10-bit wide, having 1024 quantisation levels.
It is also possible to connect an external ADC converter to any type of microcontroller. Some microcontrollers have built-in ADC converters. Dogan Ibrahim, in PIC32 Microcontrollers and the Digilent chipKIT, 2015 1.3.8 Analogue-to-Digital ConverterĪn ADC is used to convert an analogue signal such as voltage to a digital form so that it can be read and processed by a microcontroller.