diff options
author | William Harrington <kb0iic@berzerkula.org> | 2019-07-31 21:53:14 -0500 |
---|---|---|
committer | William Harrington <kb0iic@berzerkula.org> | 2019-07-31 21:53:14 -0500 |
commit | b98783ee1fc5d730eaed4e4637796a975262e2fa (patch) | |
tree | ac3fb7fd4aa3127363cd94c55f7442eb0886c5a4 /main.c | |
parent | 477a0be9f2cb250f813b9ec8098d126049866ee3 (diff) |
Move Adc_Read() function to adc source and headers. Include adc header in main source.
Diffstat (limited to 'main.c')
-rwxr-xr-x | main.c | 14 |
1 files changed, 1 insertions, 13 deletions
@@ -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
|