From b98783ee1fc5d730eaed4e4637796a975262e2fa Mon Sep 17 00:00:00 2001 From: William Harrington Date: Wed, 31 Jul 2019 21:53:14 -0500 Subject: Move Adc_Read() function to adc source and headers. Include adc header in main source. --- main.c | 14 +------------- main.h | 3 --- 2 files changed, 1 insertion(+), 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); -- cgit v1.2.3-54-g00ecf