hi-techcompiler
Salaam Hafiz,
I tried your code but my compiler still doesn't read ADCON1, here is my code:
I am using MPLAB 7.0 PICC_lite_9 and pic12f675
Thanks,
#include <htc.h>
#define XTAL 4000000
#define INPUT 1 //port directions
#define OUTPUT 0
#define HIGH 1
#define LOW 0
int counter = 0;
int pulsVec[1000];
int cleanPulsVec[1000];
int HEART = 0;
int LEVEL = 0;
//Functions
void AddFind(int val);
void CopyCleanVec(void);
void interrupt time_isr(void);
void Init_Hw(void);
//
int main()
{
Init_Hw();
interrupt time_isr();
LEVEL=flash_read(0x01); //read the Vref from AN0
//here I want to read from AN0 and save in LEVEL
while(1)
{
//Wrong code SET_ADC_CHANNEL(0);
HEART=read_adc(0x01); // read channel 0
AddFind(HEART);
}//End of while()
return 0;
} // End of Main()
void Init_Hw(void)
{
TRISIO=0x1b; //00011011 An0,An1,An3 as inputs and An2 output
ADCON0=0x48; //An3 Analog to digital
ADCON1=0x1b; //set AN0(Comparator),AN1(Vref),An3(signal from sensor) Analog input rest digital I/O
}
Added after 17 minutes:
I think I know, instead of ADCON1 I should may be use ANSEL, :idea:
Added after 44 seconds: