DT-INTs Blinky Light question


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156

    Default DT-INTs Blinky Light question

    Just trying to understand where the TMR1H and TMR1L registers are getting loaded to determine the time constant of the blinky light? This interrupt is based on an overflow, right?

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


    Did you find this post helpful? Yes | No

    Default

    T1CON = $31 sets the prescaler to 8 and turns on timer1. The interrupt is on overflow.

    Timer1 overflows in 8 * 65536 * 1uS if you're using a 4MHx oscillator.
    Regards,

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

  3. #3
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    So TMR1L & TMR1H aren't even used? Is it possible to increase the time without changing the oscillator frequency? In this case I'm using a 18F67J60 at 20Mhz, and it's just timing out too fast.

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


    Did you find this post helpful? Yes | No

    Default

    This particular example doesn't reload TMR1L & TMR1H. It just lets timer1 count up to its max 16-bit value, then overflow.

    A simple way to extend the time would be to increment a variable counter in the interrupt, then toggled the LED after X number of counts, and reset the count back to 0.

    Or, on the 18F67J60, you could use timer0 in 16-bit mode with a prescaler of 1:256. That would give you >3 seconds until overflow.
    Regards,

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

  5. #5
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Talking

    OK. I'll start with incrementing a variable, and go from there. Theres a lot to learn with these timers.

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


    Did you find this post helpful? Yes | No

    Default

    Theres a lot to learn with these timers.
    They may seem a tad intimidating at first, but once you've played around with timers a bit, you might find them fairly easy.

    But, the time you spend on learning timers is like a BB in a 55-gallon drum compared to the time & effort DT put into his instant interrupts.

    Here's to Darrel...;o)
    Attached Images Attached Images  
    Regards,

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

  7. #7
    Join Date
    Dec 2008
    Location
    Los Angeles, CA
    Posts
    156


    Did you find this post helpful? Yes | No

    Smile

    You're telling me! I've got a program going that's implemented 3 interrupts. I would have never believed it. I used to avoid interrupts at all costs. Darrel's routines make them so easy. Thanks Darrel!

Similar Threads

  1. Quick thoughts: DT Ints with encoders
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 7th January 2010, 01:01
  2. DT Ints work around for IOCA Register?
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th January 2010, 01:20
  3. Replies: 4
    Last Post: - 17th December 2009, 00:29
  4. Question on DT Int14
    By aratti in forum General
    Replies: 2
    Last Post: - 16th May 2009, 22:54
  5. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02: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