HI,
I've already done some simple projects using PICs, but this is the first time I am using the ADC module. I am using mikroC as the programming software. My problem with the ADC module is the configuration (or with the external circuit related to it).
The main configurations that I have done is listed below,
1- before configuring the ADC module, should I set its TRIS register. (at the moment I've set the TRISA register as an input (1)).
2- my configuration of the ADC related registers are as follows,
ADCON0=0b10000101
ADCON1=0b01000001
I am giving the ADC module a reference voltage and I use a 3 diodes and a resister to set that voltage (which should give the reference voltage of 5-.7x3=2.9V).
The problem that I have is after setting the register and providing the voltages, I checked the voltage at the reference pin in the PIC (in this case AN3 or pin number - 5). But I get a voltage of 5V. Shouldn't I get the reference voltage from it?. And the expected value is not achieved from the adc either.
So Is there a problem in the configuration or, have I got some problems in external physical circuit?
The link to the datasheet of PIC16F877A can be found here
I'd really appreciate if someone can look in to my problem.
Thanks.
I've already done some simple projects using PICs, but this is the first time I am using the ADC module. I am using mikroC as the programming software. My problem with the ADC module is the configuration (or with the external circuit related to it).
The main configurations that I have done is listed below,
1- before configuring the ADC module, should I set its TRIS register. (at the moment I've set the TRISA register as an input (1)).
2- my configuration of the ADC related registers are as follows,
ADCON0=0b10000101
ADCON1=0b01000001
I am giving the ADC module a reference voltage and I use a 3 diodes and a resister to set that voltage (which should give the reference voltage of 5-.7x3=2.9V).
The problem that I have is after setting the register and providing the voltages, I checked the voltage at the reference pin in the PIC (in this case AN3 or pin number - 5). But I get a voltage of 5V. Shouldn't I get the reference voltage from it?. And the expected value is not achieved from the adc either.
So Is there a problem in the configuration or, have I got some problems in external physical circuit?
The link to the datasheet of PIC16F877A can be found here
I'd really appreciate if someone can look in to my problem.
Thanks.