Author: sebastien.lelong
Date: Sun Aug 31 11:50:26 2008
New Revision: 247
Added:
wiki/jalapi/
wiki/jalapi/JalapiAdcHardware.wiki
Log:
test adding a dir in wiki + first test of generated doc
Added: wiki/jalapi/JalapiAdcHardware.wiki
==============================================================================
--- (empty file)
+++ wiki/jalapi/JalapiAdcHardware.wiki Sun Aug 31 11:50:26 2008
@@ -0,0 +1,197 @@
+
+
+#summary ADC hardware, built-in PIC ADC module
+#labels Phase-Implementation, Type-Jalapi
+
+= adc_hardware =
+
+
+|| *Author* || Stef Mientki, Copyright (c) 2002..2008, all rights
reserved. ||
+|| *Adapted-by* || Sebastien Lelong. ||
+|| *Compiler* || >=2.4g ||
+
+
+*Description*
+
+ library to use the PIC's AD converter
+ See 16F87x datasheet (DS30292C, p112)
+ Nnumber of channels, behind "--" yields only for 16F874 and 16F877
+ Nno external Vref: Nchan = 1,3,5 6,8
+ Oonly external +Vref: Nchan = 2,4 5,7
+ Bboth external +Vref and - Vref: Nchan = 1,2,3 4,6
+ --
+ Analog channels can still be used as digital outputs, by setting
+ pin = output
+ --
+ relevant IO pins
+ RA0 = AN0
+ RA1 = AN1
+ RA2 = AN2 or -Vref
+ RA3 = AN3 or +Vref
+ RA4 = no analog IO
+ RA5 = AN4
+ next pins only for 16F874 and 16F877
+ RE0 = AN5
+ RE1 = AN6
+ RE2 = AN7
+
+
+
+*Sources*
+
+ I (Stef) mixed the following libraries with my own ideas
+ f877_modules.jal from Javier Martinez
+ janalog.jal from Vasile Surducan
+
+
+
+
+
+*Dependencies*
+
+ * [JalapiZebladubla zebladubla]
+
+
+
+
+= API =
+
+
+== Global variables/contants ==
+
+ * *`var volatile byte _adc_conversion_time`*
+
+
+ * *`var volatile byte _adcon0_shadow = 0`*
+
+
-----------------------------------------------------------------------------
+ local variables
+
-----------------------------------------------------------------------------
+
+
+
+
+
+== Procedures ==
+
+ * *`procedure adc_on() is`*
+
+
-----------------------------------------------------------------------------
+ turns all ADC channels back on
+
-----------------------------------------------------------------------------
+
+
+ * *`procedure adc_off() is`*
+
+
-----------------------------------------------------------------------------
+ turns all ADC channels off (all channels becomes digital inputs)
+
-----------------------------------------------------------------------------
+
+
+ * *`procedure adc_read_bytes(byte in adc_chan, byte out adc_hbyte, byte
out adc_lbyte) is`*
+
+
-----------------------------------------------------------------------------
+ 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
+
-----------------------------------------------------------------------------
+
+
+ * *`procedure _ad_init_general() is`*
+
+
-----------------------------------------------------------------------------
+ internal routine, that
+ calculates aquisition time
+ and determines if right or left justification is optimal
+
-----------------------------------------------------------------------------
+
+
+ * *`procedure _adc_read_low_res(byte in adc_chan, byte out adc_byte) is`*
+
+
-----------------------------------------------------------------------------
+ Does an AD conversion with low resolution (8 bit) on the selected
channel
+
-----------------------------------------------------------------------------
+
+
+ * *`procedure adc_init() is`*
+
+
-----------------------------------------------------------------------------
+ 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
+
-----------------------------------------------------------------------------
+
+
+ * *`procedure _adc_init_1_vref() is`*
+
+
-----------------------------------------------------------------------------
+ initializes the PIC AD-converter, when only +Vref is present
+ 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
+
-----------------------------------------------------------------------------
+
+
+ * *`procedure _adc_init_2_vref() is`*
+
+
-----------------------------------------------------------------------------
+ initializes the PIC AD-converter, when both +Vref and -Vref are present
+ 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
+
-----------------------------------------------------------------------------
+
+
+ * *`procedure _adc_init_no_vref() is`*
+
+
-----------------------------------------------------------------------------
+ initializes the PIC AD-converter, when no external Vref is present
+ 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
+
-----------------------------------------------------------------------------
+
+
+
+
+
+== Functions ==
+
+ * *`function adc_read_low_res(byte in adc_chan) return byte is`*
+
+
-----------------------------------------------------------------------------
+ Returns Low Resolution ADC-value as the RESULT
+ It doesn't matter if ADC is set to low or high resolution
+
-----------------------------------------------------------------------------
+
+
+ * *`function adc_read(byte in adc_chan) return word is`*
+
+
-----------------------------------------------------------------------------
+ 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
+
-----------------------------------------------------------------------------
+
+
+
+
+
+
+
+
+= Related samples =
+
+Here are the list of samples which use this library:
+
+ *
[http://code.google.com/p/jallib/source/browse/trunk/unvalidated/sample/peripheral/adc/adc_lowres.jal
adc_lowres.jal]
+
+
+
+
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---