Rtcc


Closed Thread
Results 1 to 5 of 5

Thread: Rtcc

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default Re: Rtcc

    This was tested on a PIC18F25J11 running at 3V, but should work on your 46J11. Note it was tested with PBP3, but can easily be modified to work with earlier versions.
    Code:
      #CONFIG
       CONFIG OSC = INTOSC 
       CONFIG LPT1OSC = OFF 
       CONFIG CP0 = OFF 
       CONFIG WDTEN = OFF 
       CONFIG XINST = OFF
       CONFIG IOL1WAY = OFF
       CONFIG STVREN = OFF 
       CONFIG T1DIG = OFF 
       CONFIG FCMEN = OFF 
       CONFIG WDTPS = 512 
       CONFIG RTCOSC = T1OSCREF
      #ENDCONFIG 
    
      ' Connect a 32.768 kHz watch crystal between pins 11 & 12 T1CKI & T1OSI
      ' with caps to match your crystal capacitance.
      ' 11        12
      '  |---||---|
      '  |  xtal  |
      ' _|_      _|_
      ' ___      ___  2 x 12pF caps
      '  |        |
      ' gnd      gnd
       
      DEFINE OSC 4 
      OSCCON = %01100000  ' using 4MHz internal osc
      
      ' // disable A/D & setup Timer1 for RTCC //
      ANCON0 = $ff
      ANCON1 = $1f        ' disable A/D on all analog pins 
      T1CON = %10001101   ' ext 32.768 kHz xtal, 1:1 prescale, no synch, 8-bit, timer1 on 
      TRISB.1 = 0         ' clear TRISB.1 for RTCC 1Hz output  
      PADCFG1 = %00000010 ' RTCC seconds clock is selected for output on the RTCC pin
      RTCCFG.2 = 1        ' set RTCC output enable bit
       
      EECON2 = $55        ' unlock sequence to enable writes to RTCC registers
      EECON2 = $AA
      RTCCFG.5 = 1        ' set bit 5 for RTCC write enable   
      RTCCFG.7 = 1        ' set bit 7 for RTCC clock enable 
      
      EECON2 = $55        ' lock sequence to disable writes to RTCC registers
      EECON2 = $AA
      RTCCFG.5 = 0        ' clear bit 5 to lockup & disable RTCC writes
    
    Here:
      GOTO Here
     
      END
    It produces a very accurate 1Hz clock out on RB1.

    This is a working test version of a serial clock & 3 x 10KHz PWM outputs with the same PIC CLOCK_25J11.txt

    Hope this helps.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  2. #2
    Join Date
    Jun 2008
    Location
    Chicago suburb
    Posts
    5


    Did you find this post helpful? Yes | No

    Default Re: Rtcc

    Bruce

    Thank you very much for your help. I had internet problems on my home computer
    so could not receive your response over the weekend. I am using now my work computer.
    I am going to try it out and I believe the onboard rtcc is the same on all 18F chips.
    Thanks again and best regards

    Gerd

Similar Threads

  1. Mcp79410 rtcc
    By keymuu in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th July 2012, 04:36
  2. 18F devices RTCC Interrupt
    By readitaloud in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 26th July 2011, 09:39
  3. Support for RTCC
    By fowardbias in forum PBP Wish List
    Replies: 0
    Last Post: - 28th April 2011, 15:49
  4. 18F25J11 RTCC & remappable pin options
    By jonas2 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 27th February 2011, 09:20
  5. 18F25J11 RTCC & remappable pin options
    By Bruce in forum Code Examples
    Replies: 13
    Last Post: - 26th February 2011, 09:51

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts