1ms Elapsed Timer Demo with DT's Instant Interrupts


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: 1ms Elapsed Timer Demo with DT's Instant Interrupts

    1.. Yes.
    There is a little more in the main program to handle the ext interrupt, but essentially yes (for question 2).

    The main program turns external int off and clears it’s trigger flag as well at initialise time.
    Then when the sync wants to happen for whatever reason (like the GPS has been locked for a minute),
    the main program turns ext int on. Then I figure the next time the ISR is called by ext interrupt,
    the timer should be loaded rather than added to... but added to every other time, because
    the ISR turns ext int off just a little after this.

    ps.. So far the time is still correct, but I can’t test lag or error of the sync to the pulse.
    Last edited by Art; - 20th May 2015 at 16:04.

  2. #2
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: 1ms Elapsed Timer Demo with DT's Instant Interrupts

    It just occurred to me I’d have to comment out anything instant interrupts does with other interrupts
    just in case activity on portb.0 changes the time that takes to execute (prior to the timer reload routine being called),
    and also add it's instruction time in the value loaded to the timer if portb.0 was the source of the interrupt.

  3. #3
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: 1ms Elapsed Timer Demo with DT's Instant Interrupts

    I think we may be beginning to cloud up this thread.
    Do you want to start another?
    Regards,
    TABSoft

  4. #4
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: 1ms Elapsed Timer Demo with DT's Instant Interrupts

    There might not be a need to if I fix the second channel on my scope, and do what you did,
    except look at the generated pulse on one ch, and the GPS pulse on the other.
    Then if I can’t sort it out I’ll start another one.
    Cheers, Brek.

  5. #5
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: 1ms Elapsed Timer Demo with DT's Instant Interrupts

    Art,

    Just curious if you got this to work.
    I would think that you would have to define a DT interrupt source for the EXT int and set the handler label.
    Regards,
    TABSoft

  6. #6
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: 1ms Elapsed Timer Demo with DT's Instant Interrupts

    Hi Tabsoft
    No, but I had a moment of inspiration. Wouldn’t even need the interrupt, but it will help.
    The idea is to sync it roughly, with port.0 interrupt, then turn off ext int and the clock will be somewhere close.

    Then although port.0 int is disabled, the IO pin still works... so next, increment or decrement the so called “constant value”
    until the timer cycle you check port.0 straight after the interrupt and find the GPS PPS pin is high.
    Then subtract as many instructions from the constant value as it took to check port.0 after the timer reload.

    For 10MHz pic, that might have it down to the 400ns instruction time, but I’m not sure of that.

  7. #7
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: 1ms Elapsed Timer Demo with DT's Instant Interrupts

    What is the interval and duration of your input pulse on PORTB.0 from the GPS?
    Regards,
    TABSoft

Similar Threads

  1. DT's Instant Interrupts
    By andywpg in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 1st June 2014, 18:01
  2. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  3. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  4. Elapsed Timer Demo in a PIC12F675
    By Leonardo in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 21st November 2008, 00:01

Members who have read this thread : 2

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