-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadcconv.c
65 lines (50 loc) · 2.17 KB
/
adcconv.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <p18cxxx.h>
#include "adc.h"
#if defined (ADC_V1) || defined (ADC_V2) || defined (ADC_V3) ||\
defined (ADC_V5) || defined (ADC_V8) ||defined (ADC_V4) || \
defined (ADC_V6) || defined (ADC_V7) ||defined (ADC_V7_1)||\
defined (ADC_V10) || defined (ADC_V11) || defined (ADC_V12) ||\
defined (ADC_V13) || defined (ADC_V13_1) || defined (ADC_V11_1)\
|| defined (ADC_V13_2) || defined (ADC_V13_3)|| defined (ADC_V14) || defined (ADC_V14_1) || defined (ADC_V14_2) || defined (ADC_V14_3)
/************************************************************************************
Function : void ConvertADC(void)
Overview : This function starts the A/D conversion.
Parameters : None
Returns : None
Remarks : This function sets the ADCON0<GO> bit and thus
starts conversion.
**************************************************************************************/
void ConvertADC(void)
{
ADCON0bits.GO = 1;
}
#elif defined (ADC_V9) || defined (ADC_V9_1)
/************************************************************************************
Function : void ConvertADC(void)
Overview : This function starts the A/D conversion.
Parameters : None
Returns : None
Remarks : This function sets the ADCON0<GO> bit and thus
starts conversion.
**************************************************************************************/
void ConvertADC(void)
{
WDTCONbits.DEVCFG = 0;
ADCON0bits.GO = 1;
}
#elif defined (ADC_V15) || defined (ADC_V15_1)
/************************************************************************************
Function : void ConvertADC(void)
Overview : This function starts the A/D conversion.
Parameters : None
Returns : None
Remarks : This function clears the ADCON1L<SAMP> bit and thus stops
sampling and starts conversion.This happens only when
trigger source for the A/D conversion is selected as Manual,
by clearing the ADCON1L <SSRC> bits.
**************************************************************************************/
void ConvertADC(void)
{
ADCON1Lbits.SAMP = 0; /* clear SAMP to start conversion*/
}
#endif