where do the numbers for Define ADC_Clock come from. I have seen a 1, 3, 8. How do I know what to set it to and where do I get this list of numbers? I am using PBP with a 16f876a and a 20 mhz crystal. Thanks in advance.
where do the numbers for Define ADC_Clock come from. I have seen a 1, 3, 8. How do I know what to set it to and where do I get this list of numbers? I am using PBP with a 16f876a and a 20 mhz crystal. Thanks in advance.
Travin77, You need to look in the data sheets for the PIC micro you are using. For instance in the data sheet for the 16F88 bits 7 & 6 of ADCON0 register need to be set to binary equiv. of 3 for the internal RC clock source for the A/D. This is the same as the DEFINE ADC_CLOCK 3 statement.
Dave Purola,
N8NTA
Thanks. I just gave up on it. My sensor was bad anyway. Thanks again.
As stated in Data Sheet:
bit 7-6 ADCS1:ADCS0: A/D Conversion Clock Select bits
00 = FOSC/2
01 = FOSC/8
10 = FOSC/32
11 = FRC (clock derived from the internal A/D module RC oscillator)
If these are complex things to play with then use the following DEFINEs instead:
For FOSC/2:
DEFINE ADC_CLOCK 0
For FOSC/8:
DEFINE ADC_CLOCK 1
FOSC/32:
DEFINE ADC_CLOCK 2
For A/D RC oscillator:
DEFINE ADC_CLOCK 3
-----------------------------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks