ADC Library
ADC (Analog to Digital Converter) module is available with a number of PIC32 MCU modules. ADC is an electronic circuit that converts continuous signals to discrete digital numbers. ADC Library provides you a comfortable work with the module.
Library Routines
ADCx_Init
Prototype |
void ADCx_Init(); |
---|---|
Description |
This routines configures ADC module to work with default settings. The internal ADC module is set to:
|
Parameters |
None. |
Returns |
Nothing. |
Requires |
|
Example |
ADC1_Init(); // Initialize ADC module with default settings |
Notes |
None. |
ADCx_Init_Advanced
Prototype |
void ADC1_Init_Advanced(unsigned Reference); |
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description |
This routine configures the internal ADC module to work with user defined settings. |
||||||||||||
Parameters |
|
||||||||||||
Returns |
Nothing. |
||||||||||||
Requires |
|
||||||||||||
Example |
ADC1_Init_Advanced(_ADC_INTERNAL_REF); // set internal reference used |
||||||||||||
Notes |
|
ADCx_Get_Sample
Prototype |
unsigned ADCx_Get_Sample(unsigned channel); |
---|---|
Description |
The function enables ADC module and reads the specified analog channel input. |
Parameters |
|
Returns |
10-bit unsigned value from the specified |
Requires |
|
Example |
unsigned adc_value; ... adc_value = ADC1_Get_Sample(10); // read analog value from ADC module channel 10 |
Notes |
|
ADCx_Read
Prototype |
unsigned ADCx_Read(unsigned channel); |
---|---|
Description |
The function initializes, enables ADC module and reads the specified analog channel input. |
Parameters |
|
Returns |
10-bit unsigned value from the specified |
Requires |
|
Example |
unsigned adc_value; ... adc_value = ADC1_Read(10); // read analog value from ADC1 module channel 10 |
Notes |
|
What do you think about this topic ? Send us feedback!