I need some help. I am beginner with microcontrollers and had some problems..
I'm trying to make an simple code with PIC16F877A and mikroc to learn to use microcontrollers.
I want to set the AN5 as analog, but I can't do it, I tried to look for but couldn't find the answer. When all the ports were digital was fine, but now.. Could anyone help me please?
I just want to turn on the LEDs when input 2,5V on the RE0 for exemple
I don't specifically know MikroC but with the PIC micros you normally need to set the ANSEL register to define an input as analog before you can use the ADC.
I don't specifically know MikroC but with the PIC micros you normally need to set the ANSEL register to define an input as analog before you can use the ADC.
I don't use MikroC and I was use PIC16F877A long time ago. Now I'm use PIC16F887.
1. ANSEL is only use in 887 not 877A.
2. I'm not sure about MikroC ADC_Read() function, so maybe in the function is set the ADCON0.
3. You set ADCON1=0x08, then you need to connect voltage at pin VREF+(RA3) and VREF-(RA2). If you not connect that pin, then try change to ADCON1=0x00 to make all analog pin and VREF from VDD and VSS.