PIC18F4520 oscillator question

Discussion in 'Embedded Systems and Microcontrollers' started by riad_00, Jan 7, 2009.

  1. riad_00

    Thread Starter Member

    Feb 9, 2008
    19
    0
    Hi,

    I am making a digital clock using PIC18F4520. I am using a crystal oscillator of 32.768KHz with TMR0 timer. I am bit confused and stuck that where I am going to connect the oscillator. From the data sheet it says the oscillator has to be connected in between the pin RA6 and RA7. It also says pin RA4 is the source of TMR0. Can some one cast any light here please???

    Thanx in advance
     
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    You may be confusing the external crystal oscillator that provides the clock source for the PIC and the timing source for timer0. The first runs the PIC, the second is an input to the timer.
     
  3. nanovate

    Distinguished Member

    May 7, 2007
    665
    1
    use the OSC1 and OSC2 pins (RA7 and RA6)
     
  4. riad_00

    Thread Starter Member

    Feb 9, 2008
    19
    0
    So I have to get one oscillator to connect pin RA6 and RA7 and the 32.768KHz one for the timer0 input.

    Thanks
     
  5. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    You can connect only one oscillator on pins RA7 and RA8 to give timing to the whole chip and then define the frequency for timer0 by the software (your code). Note that you have to set the configuration bits appropriately as for the crystal to work otherwise RA& and RA8 will be acting as I/O.
     
Loading...