+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2019
    Posts
    1

    Default Unequal Timer0 count in interrupt mode.

    Hi all! Please help me to fix the issue with unequal Timer0 count in interrupt mode. Please check the picture to see the gaps between pulses.

    https://ibb.co/fnJkSks

    The source code:

    DEFINE LOADER_USED 1 'Define loader
    DEFINE OSC 4 'Define oscillator

    DEFINE HSER_RCSTA 90h 'Enable the receive register
    DEFINE HSER_TXSTA 20h 'Enable the transmit register
    DEFINE SER_BAUD 9600 'Set the baud rate
    DEFINE HSER_BAUD 9600 'Set the baud rate

    TRISB.3 = 0

    INTCON = 100000 'Enable TMR0 interrupts
    OPTION_REG = 000110 'Set prescaler 1:128
    TMR0 = 175 'Load TMR0 register

    ON INTERRUPT GOTO ISR

    loop: 'Short code
    PORTB.3 = 1 'Short code
    GOTO loop 'Short code

    DISABLE 'Disable interrupts
    ISR: 'Entry point of the ISR
    TMR0 = 175 'Load TMR0 register
    HSEROUT [$F8] 'Send a byte
    INTCON.2 = 0 'Reset INT0IF flag
    RESUME 'Resume main program
    ENABLE 'Enable interrupts

  • #2
    Join Date
    Aug 2003
    Location
    Australia
    Posts
    1,060

    Default Re: Unequal Timer0 count in interrupt mode.

    Without your image I’d have gone for watchdog timer reset, but obviously not with that timing.

    Than I looked harder, and Oh no! PBP interrupt!
    PBP Interrupts: Like an interrupt, only it isn’t.

    You’re a real user though, they should ditch your under review status.

  • Similar Threads

    1. Replies: 10
      Last Post: - 26th July 2018, 04:14
    2. PIC18f2620 Timer0 in 16-bit mode
      By Bruce in forum General
      Replies: 0
      Last Post: - 18th August 2010, 03:08
    3. i2cread and timer0 interrupt
      By robertpoll in forum mel PIC BASIC Pro
      Replies: 4
      Last Post: - 26th May 2010, 20:28
    4. help: countdown with timer0 interrupt
      By xnihilo in forum mel PIC BASIC Pro
      Replies: 12
      Last Post: - 19th August 2008, 14:12
    5. PIC16F877A - Timer0 won't interrupt
      By WishMaster^ in forum mel PIC BASIC Pro
      Replies: 19
      Last Post: - 25th April 2007, 08:25

    Members who have read this thread : 18

    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