Question for Mr. Darrel Taylor and Mister-e Timer1 Reload


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Question for Mr. Darrel Taylor and Mister-e Timer1 Reload

    10Hz interrupt is problem to derive from 32768Hz. 16Hz or 32Hz etc isn't problem. To get 1sec just count 16 interrupts, and that is all.
    I posted RTC code, with external crystal, 32 interrupts per second, and it consumes less than 10uA if you put pic in sleep mode.

  2. #2
    Join Date
    Aug 2006
    Location
    Italy
    Posts
    72


    Did you find this post helpful? Yes | No

    Default Re: Question for Mr. Darrel Taylor and Mister-e Timer1 Reload

    NICE!
    Where I can see that code?

    Thank you.

  3. #3
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Question for Mr. Darrel Taylor and Mister-e Timer1 Reload

    I can't find that topic...
    Here is cut/paste from my code for PIC18LF14K50
    Code:
            DEFINE  OSC 4         
            Define  INTHAND myint    ' Define interrupt handler
            DEFINE  NO_CLRWDT 1
    
            OSCCON=%01010110
            OSCCON2.2=0
            OSCTUNE.7=1
            OSCTUNE.6=1
            REFCON0=0
            REFCON1=0
            ADCON1=0
            ADCON2=0
            ANSEL =0           
            ANSELH=0
            CM1CON0=0
            CM2CON0=0
            SRCON0=0
            SRCON1=0
            WPUA=0
            WPUB=0
            WDTCON=0   
            SLRCON=0           
            RCON.7=0
            RCON.6=0   
            UCON=0  
            IOCA=0
            IOCB=0
            T0CON=0
            T1CON=%00001111  
            T2CON=0
            T3CON=%00000110
            INTCON=192  
            INTCON2=0  
            INTCON3=0 
            PIR1=0
            PIR2=0
            PIE1=1
            PIE2=0
            IPR1=0
            IPR2=0
            porta=0
            portb=0
            portc=0
            trisa=255
            trisb=255
            trisc=255
    
    
    
    
    'RTC_________________________
    Seconds        VAR BYTE bankA  
    Minutes        VAR Byte bankA       
    Hours          var byte bankA
       
    
    
    
     
     clear
    
    GoTo OverInt  ' jump over the interrupt handler and sub
    ASM                  
    myint 
     movlb .0
     ;If PIR1.0 =1 then
     BTFSS PIR1,0 
     GOTO End_RTC 
     MOVLW .252 ; TMR1H=252
     MOVWF TMR1H
     CLRF PIR1 ; Clear TMR1 int flag
     INCF _Ticks,F 
     ;if ticks>31 then
     MOVLW .31
     CPFSGT _Ticks  
     GOTO End_RTC   
        INCF _Seconds,F  
        CLRF _Ticks
        ; if seconds > 59 then
        MOVLW .59         
        CPFSGT _Seconds   
        GOTO End_RTC   
           CLRF _Seconds   
           INCF _Minutes,F
           ;if minutes > 59 then
           MOVLW .59         
           CPFSGT _Minutes   
           GOTO End_RTC      
              CLRF _Minutes
              INCF _Hours,F
              ;if hours > 23 then 
              MOVLW .23       
              CPFSGT _Hours   
              GOTO End_RTC    
                  CLRF _Hours
    End_RTC                                      
    ;Do your other stuff here
     retfie  FAST  
    ENDASM  
    OverInt:
    
    Main:
    @ Sleep
    'program starts here 32 times in sec
    goto Main
    This is example for PIC's that have fast return stack, and saves and restores WREG, STATUS and BSR registers...

  4. #4
    Join Date
    Aug 2006
    Location
    Italy
    Posts
    72


    Did you find this post helpful? Yes | No

    Default Re: Question for Mr. Darrel Taylor and Mister-e Timer1 Reload

    Thank you a lot.

  5. #5
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Question for Mr. Darrel Taylor and Mister-e Timer1 Reload

    Just one more thing that I had to deal with...
    Selection of crystal and capacitors from OSC pins to ground is critical to get accurate clock. I tried one by one from 10 to 47pF, and best results are with 47pF. But that will depend from board layout and used crystal.
    My suggestion is that you buy a lot of crystals, and select appropriate capacitor for it. And use that combination from now.

  6. #6
    Join Date
    Aug 2006
    Location
    Italy
    Posts
    72


    Did you find this post helpful? Yes | No

    Default Re: Question for Mr. Darrel Taylor and Mister-e Timer1 Reload

    Thank you pedja089,
    looks to be a challenge...

  7. #7
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Question for Mr. Darrel Taylor and Mister-e Timer1 Reload

    I'm glad that I could help.
    Good luck

Similar Threads

  1. Darrel Taylor Interrupts and MultiCalc
    By AvionicsMaster1 in forum General
    Replies: 6
    Last Post: - 14th February 2012, 06:18
  2. Timer1 and Timer2 interrupts, Darrel Taylor
    By ronbowalker in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th December 2009, 18:38
  3. To Mr. Darrel Taylor once again
    By atwoz in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 10th December 2009, 19:10
  4. Darrel Taylor Elapsed Timer
    By rwskinner in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 13th March 2008, 01:22
  5. @Darrel Taylor Interrupt ;-)
    By Robson in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 31st August 2007, 00:59

Members who have read this thread : 1

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

Tags for this Thread

Posting Permissions

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