K42 and Timer Interrupts


+ Reply to Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: K42 and Timer Interrupts

    Two things...

    Since you're using FOSC/4 as the source, set ASYNC bit in T0CON1.

    Also, when using 16 bit mode (MD16=1) you should always write TMR0H then TMR0L in that order so that the high byte is latched.

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,133


    Did you find this post helpful? Yes | No

    Default Re: K42 and Timer Interrupts

    Quote Originally Posted by amgen View Post
    looks like not reloading the tmr count every ms....... after first int, tmr counter looping from 0 .....???
    Sure it is. Inside the ISR, Timer 0 is stopped, reloaded and restarted.

    Quote Originally Posted by tumbleweed View Post
    Two things...

    Since you're using FOSC/4 as the source, set ASYNC bit in T0CON1.

    Also, when using 16 bit mode (MD16=1) you should always write TMR0H then TMR0L in that order so that the high byte is latched.
    I think is it obligatory to use Fosc/4. Unless I misunderstood the DS. Then why is it necessary to use ASYNC=1? Could not fine any notes on the DS.

    Same for TMR0H. Is it in the DS this?

    Thank you for the suggestions, will test them the soonest.

    Ioannis

  3. #3
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: K42 and Timer Interrupts

    The SYNC block uses FOSC/4 as its sync clock, so it's difficult to use it if it's using FOSC/4 as its input source for counting too.

    Name:  Clipboard02.jpg
Views: 7078
Size:  28.0 KB

    for 16-bit read/write see sec 20.1.1.1:

    Name:  16-bit tmr0.jpg
Views: 7384
Size:  37.2 KB

    In 16-bit mode the operations should be: write TMR0H, TMR0L and read TMR0L, TMR0H

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,133


    Did you find this post helpful? Yes | No

    Default Re: K42 and Timer Interrupts

    Thanks for the explanation.

    I misinterpreted these paragraphs. My understanding was to have ASYNC cleared and use Fosc/4.

    Ioannis

Similar Threads

  1. Timer Interrupts
    By gadelhas in forum General
    Replies: 11
    Last Post: - 19th August 2011, 16:00
  2. fast timer block other interrupts?
    By flipper_md in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th November 2010, 02:06
  3. Handling External/Timer Interrupts
    By Tacky3000 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 3rd December 2008, 11:09
  4. 3 Timer Interrupts Running simultaneously
    By emavil in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th February 2007, 03:49
  5. Timer overflows and interrupts
    By barkerben in forum General
    Replies: 10
    Last Post: - 18th December 2004, 01:42

Members who have read this thread : 16

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