Author | Stef Mientki, Copyright (c) 2002..2008, all rights reserved. |
Adapted-by | Sebastien Lelong. |
Compiler | >=2.4k |
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://justanotherlanguage.org/content/jallib/tutorials/tutorial_adc_intro
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 and adc_clock.jal. About Vref setup: - when ADC_NVREF = ADC_NO_VREF : there's no Vref pin used, vref is done internally, using power supply (Vdd, Vss) - when ADC_NVREF = ADC_VREF_POS ): there's only one Vref pin, this is Vref+ - when ADC_NVREF = ADC_VREF_POS_NEG : two Vref pins are used, Vref+ and Vref- - when ADC_NVREF = ADC_VREF_NEG : there's only one Vref pin, this is Vref- A major trigger is when using ADC libs is ADC_DYNAMIC. When declared, several parameters become dynamic and can be changed at runtime. This includes: - ADC_NCHANNEL, the number of ADC channels (when they are dependent channels, as independent channels are always selected at runtime with set_analog_pin() - ADC_TEMP (careful, computation related to temperature very approximative - ADC_RESOLUTION (8-bits or 10-bits) - ADC_RSOURCE 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
_adc_init_acquisition_delay()
_adc_setup()
_adc_read_low_res(byte in adc_chan, byte out adc_byte)
_adc_init_justify()
var byte adc_conversion_delay
No documentation found
var volatile byte _adcon0_shadow = 0
No documentation found
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
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_init_acquisition_delay()
No documentation found
_adc_setup()
Pin setup: analog as input, configure Vref, ...
_adc_read_low_res(byte in adc_chan, byte out adc_byte)
Does an AD conversion with low resolution (8 bit) on the selected channel
_adc_init_justify()
No documentation found
adc_read(byte in adc_chan) return word
Does an AD conversion on the selected channel returns the result as a 10-bits word It doesn't matter if ADC is set to low or high resolution
adc_read_low_res(byte in adc_chan) return byte
Returns Low Resolution ADC-value as the RESULT It doesn't matter if ADC is set to low or high resolution
12f683 | 12f683_pwm_adc.jal |
16f723 | 16f723_adc_independent.jal |
16f73 | 16f73_adc_dependent.jal |
16f767 | 16f767_pwm_adc.jal |
16f77 | 16f77_adc_lowres.jal |
16f876a | 16f876a_adc.jal |
16f877 | 16f877_adc_dependent.jal |
16f877 | 16f877_adc.jal |
16f877a | 16f877a_adc_dependent.jal |
16f88 | 16f88_adc_independent.jal |
16f88 | 16f88_adc_lowres.jal |
16f88 | 16f88_adc_highres.jal |
16f886 | 16f886_pwm_adc_res.jal |
16f886 | 16f886_pwm_adc_freq.jal |
18f14k50 | 18f14k50_adc_independent.jal |
18f2450 | 18f2450_adc_dependent.jal |
18f4550 | 18f4550_adc.jal |
18f4550 | 18f4550_adc_dependent.jal |
18f4550 | 18f4550_dynamic_adc.jal |