adc

ADC hardware, built-in PIC ADC module

Author Stef Mientki, Copyright (c) 2002..2008, all rights reserved.
Adapted-by Sebastien Lelong.
Compiler >=2.4k

Description

library to handle ADC peripheral.
  - support both low and high resolution mode
  - support a large number of PICs, with
      - ADC pin configuration
      - channel selection
      - clock selection
  - support Vref



How to use it ? See http://jallib.blogspot.com for details...


Notes

this is a heavy refactoring/rewriting of original library from Stef Mientki.
The main changes are about ADC configuration, which are essentially handled in 
adc_channels.jal, adc_pindef.jal and adc_clock.jal



The original library can be found:
   - Stef's: http://mientki.ruhosting.nl/pic-tools/jal/libs2/adc_hardware.jal
   - jallib issue tracker: http://code.google.com/p/jallib/issues/detail?id=7


Dependencies


Summary

Global variables/contants

Procedures

Private

Functions


API details

Global variables/contants

Procedures

  • adc_init()

    Initializes the PIC AD-converter,
    by calling the correct routine according to the number of external references
    Settings are done according to the special ADC constants
    Sets all the analog pins to input
    Calculates aquisition time and determines if right or 
    left justification is optimal
    

  • adc_read_bytes(byte in adc_chan, byte out adc_hbyte, byte out adc_lbyte)

    Does an AD conversion on the selected channel
    returns the 10-bit result as 2 byte parameters
    It doesn't matter if ADC is set to low or high resolution
    

Private

Functions


Related samples

Here are the list of samples which use this library:

16f876a16f876a_adc.jal
16f87716f877_adc.jal
16f8816f88_adc_lowres.jal
16f8816f88_adc_highres.jal