PDA

View Full Version : ADC_CLOCK Question



Travin77
- 31st March 2006, 23:22
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.

Dave
- 1st April 2006, 02:42
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

Travin77
- 1st April 2006, 03:34
Thanks. I just gave up on it. My sensor was bad anyway. Thanks again.

sayzer
- 6th May 2006, 10:59
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




-----------------------------------------