pic18f87k40 Timer1 setting


Results 1 to 3 of 3

Threaded View

  1. #1
    Join Date
    Dec 2021
    Posts
    3

    Default pic18f87k40 Timer1 setting

    Hello members

    PIC18F67K40

    i try to operate timer1 without gate control.
    seams it don't work.(timer0 work perfect).
    i use 48mhz internal osc

    i don't know what is wrong


    Code:
    PIE4.0=1 'TMR1 Overflow Interrupt Enable bit 
    INTCON.6=1 'Peripheral Interrupt Enable bit 
    
    
    TMR1CLK=%00000001   'Timer1 Clock Source Selection Register  Fosc/4
    'TMR1CLK=%00000011   'Timer1 Clock Source Selection Register   HFINTOSC
    
    ;TMR1GATE=
    T1GCON.7=0 'Timer Gate Enable bit
    T1CON=00110100  'Timer1 Prescale 8 , Do not synchronize external clock input & off 
    ;T1CON=00110000  'Timer1 Prescale 8 , Synchronize external clock input with system clock & off 
    
    PIR4.0=0 'CLEAR INT TIMER1
    
    
    '****** TEST TIMER1 *******
    T1CON.0=1 'TIMER 1 ON
    WAIT2:
    IF PIR4.0 THEN           'Timer1 INT
                 T1CON.0=0    'Timer1 Off
                 PIR4.0=0       'CLEAR INT  
                 PORTE.5=PORTE.5 ^ 1    'led on/off
                 TEMP=35536     '20MS /8  48MHZ
                 TMR1H=TEMP.BYTE1
                 TMR1L=TEMP.BYTE0      
                 T1CON.0=1 'TIMER 1 ON  
                 ENDIF
    
    
    GOTO WAIT2
    '************************
    Last edited by Ioannis; - 2nd June 2022 at 17:40.

Similar Threads

  1. How to read timer1 value?
    By Ferocactus in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th January 2011, 23:19
  2. timer1 help
    By robertpeach in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 10th September 2009, 09:05
  3. timer1 trouble
    By beginner10 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 19th August 2009, 17:30
  4. RPM With Timer1
    By mel4853 in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 29th June 2009, 21:50
  5. Reading Timer1 value
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th June 2006, 16:21

Members who have read this thread : 1

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