aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Harrington <kb0iic@berzerkula.org>2019-07-31 21:53:14 -0500
committerWilliam Harrington <kb0iic@berzerkula.org>2019-07-31 21:53:14 -0500
commitb98783ee1fc5d730eaed4e4637796a975262e2fa (patch)
treeac3fb7fd4aa3127363cd94c55f7442eb0886c5a4
parent477a0be9f2cb250f813b9ec8098d126049866ee3 (diff)
Move Adc_Read() function to adc source and headers. Include adc header in main source.
-rwxr-xr-xmain.c14
-rwxr-xr-xmain.h3
2 files changed, 1 insertions, 16 deletions
diff --git a/main.c b/main.c
index d2d6354..b63803d 100755
--- a/main.c
+++ b/main.c
@@ -5,6 +5,7 @@
#include "lcd.h" //Declaratons for LCD
#include "i2c.h"
#include "ds3231.h" //Declarations for RTC
+#include "adc.h" //Declarations for ADC
#include "beep.h" //Declarations for BEEP
#ifdef DEBUG
@@ -12,19 +13,6 @@
#include "term.h" //Declarations for Escape codes
#endif
-unsigned int Adc_Read(unsigned int channel) {
- ADFM = 1; // results right justified
- ADCS0 = 1; //conversion speed = 64*Tosc
- ADCS1 = 1;
- ADCS2 = 1; //For 16F877
- ADCON0bits.CHS = channel;
- ADON = 1; // Turn on ADC
- __delay_ms(1);
- GO_DONE = 1;
- while (ADCON0bits.GO_DONE == 1);
- return ((ADRESH << 8) + ADRESL); // ex 1024
-}
-
int main() {
TRISA0 = 0x01; // RA is input (ADC)
TRISC = 0x00; // Set PORTC as outputs
diff --git a/main.h b/main.h
index f26b600..39ffa7d 100755
--- a/main.h
+++ b/main.h
@@ -44,9 +44,6 @@ unsigned char alarm2_min_0, alarm2_min_1, alarm2_hour_0, alarm2_hour_1;
char buf[40];
#endif
-// Get ADC value
-unsigned int Adc_Read(unsigned int);
-
// Format unsigned int to unsigned chars
void format_DateTimeChars(void);