ADC_init

Description

This function initialises the ADC hardware and asynchronous ADC read subsystem. Hardware initialisation consists of configuring the pins which share analog and digital capabilities.

NOTE (1): This function only works for PIC's that have built-in ADC hardware. The function will accept all configurations in the table even though some configurations may not be supported by the target PIC.

NOTE (2): trying to read an analog value from a pin that is configured as a digital I/O pin will result in an aborted read and the value 0 will be returned

NOTE (3): trying to configure non-existant analog pins produces an undefined result (the 16F876 does not have AN7, AN6 or AN5). Trying to use a non-existant analog pin is as sensible as trying to use a non-existant digital I/O pin. This is a runtime error and is in the domain of the programmer not the compiler.

Definition

ADC_init(ubyte adc_port_config)

Library

LIB/adc_lib.bas

Usage

On entry:
adc_port_config defines the configuration of PORT A and PORT E pins
valid values are:
  adc_port_config   AN7  
  RE2
  AN6  
  RE1
  AN5  
  RE0
  AN4  
  RA5
  AN3  
  RA3
  AN2  
  RA2
  AN1  
  RA1
  AN0  
  RA0
0 A A A A A A A A
1 A A A A Vref+ A A A
2 D D D A A A A A
3 D D D A Vref+ A A A
4 D D D D A D A A
5 D D D D Vref+ D A A
6 D D D D D D D D
7 D D D D D D D D
8 A A A A Vref+ Vref- A A
9 D D A A A A A A
10 D D A A Vref+ A A A
11 D D A A Vref+ Vref- A A
12 D D D A Vref+ Vref- A A
13 D D D D Vref+ Vref+ A A
14 D D D D D D D A
15 D D D D Vref+ Vref+ D A

see ADC configuration for a more detailed description

On exit:
There is no return value