mikroC
making it simple...
ADC Library
mikroC - C Compiler for Microchip PIC microcontrollers
ADC (Analog to Digital Converter) module is available with a number of PIC MCU models. Library function Adc_Read is included to provide you comfortable work with the module.
Adc_Read
Prototype | unsigned Adc_Read(char channel); |
|
|
Returns | |
|
|
Description | Initializes PIC’s internal ADC module to work with RC clock. Clock determines the |
| time period necessary for performing AD conversion (min 12TAD). |
| Parameter channel represents the channel from which the analog value is to be |
| acquired. For |
| PIC MCU. |
|
|
Requires | PIC MCU with |
| for specific device (most devices from PIC16/18 families have it). |
| Before using the function, be sure to configure the appropriate TRISA bits to designate |
| the pins as input. Also, configure the desired pin as analog input, and set Vref (voltage |
| reference value). |
| The function is currently unsupported by the following PICmicros: P18F2331, |
| P18F2431, P18F4331, and P18F4431. |
|
|
Example | unsigned tmp; |
| ... |
| tmp = Adc_Read(1); /* read analog value from channel 1 */ |
|
|
|
| page |
|
MikroElektronika: Development tools - Books - Compilers | 139 | ||
|
|