1ms Elapsed Timer Demo with DT's Instant Interrupts


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    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

  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

    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.

  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

    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

  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

    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.

  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

    What is the interval and duration of your input pulse on PORTB.0 from the GPS?
    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, looks like I ignored you there..... We took it to email!

  7. #7
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

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

    Hi Tabsoft (and others who might have some insight)

    I have incorporated your 1ms timer (top of this thread) as a basis for my nixie clock. ( I had wanted to implement Darrells' instant interrupts so this was perfect)

    I needed a 5 ms interrupt to update my nixie display and was able to modify your "elaptimer_interrupt.pbp" include file to give me the 5 ms interrupt by changing the include as shown below...

    Code:
                                         ; Added 04/03/2015 "IntTime"
    IntTime = 200                  ;  200 = 5ms
                                         ; Change IntTime in calc for interrupt time
                                         ; 1000=1ms, 100=10ms, 10 = 100ms, etc.
                                         ; Needs to be a multiple of 10.
    But I am finding that my clock gains about 2 minutes (give or take) in about 18 hours.

    I wonder if the problem might be in this part of your include...
    Code:
    if Ticks = 200 then          ' Modified 04/03/2015 from 100 to 1000
                                      '  change Ticks = x to right interrupt time
                                      '  1000=1ms, 100=10ms, 10=100ms, etc.
    Ticks = 0
    when Ticks go from 0 to 200, wouldn't that be 201 steps.
    Shouldn't it be from 0-199 or 1-200 to get the 200 steps??

    But in my case where the clock is running fast I should probably start increasing this count to slow the clock down?

    somewhere in the thread or in the comments in the include there is alluded to that the code is somehow self calibrating?? or am I misreading that??

    What is the best way to arrive at a more accurate time base?

    I am just using the internal 8mhz osc in my 16F1828 so I know it won't be super accurate.
    My clock does read NTP time every morning so I don't need long term accuracy.
    I will probably change the code to read the NTP time twice a day if necessary but I would like to fine tune it a bit if possible.

    thanks (in advance) for any guidance from the forum
    Last edited by Heckler; - 9th March 2016 at 04:48.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

Similar Threads

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

Members who have read this thread : 1

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