Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    Use the code in post#27, (new approch to rotary encoder) is more efficient and you can achieve even higher frequency.

    Cheers

    Al.
    Last edited by aratti; - 14th January 2012 at 16:45.
    All progress began with an idea

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


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    Hi Al. I am using the #27 ISR.

    The thing that I added was the check for the 4 counts before Q_Count variable is incremented or decremented.

    Thats because the encoder I use produces 4 pulses on every step I turn the knob. Thanks Henrik for noting this.

    Ioannis

  3. #3
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    The code was written to read quadrature count. Any rotary encoder with two channels will generate quadrature count.

    Al.
    All progress began with an idea

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


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    Yes that is correct. So the Q_count variable is incrementing by 4.

    Ioannis

  5. #5
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    If this topic was previously mentioned, I apologize for not finding it.

    I'm using a 16F877A with a 4 MHz crystal and two 22pf caps with a LED hooked up to portb.1 and the code from example 2 of DT_ints-14.bas on DTs site. I'm using a oscope to look at the timing of the LED flashes and they are occuring around 950msec apart.

    My question is, is there a way to tune the oscillator or modify DT interrupts to get it closer to a true 1 second pulse time? I know it's not far off but I was trying to learn something and maybe make it more accurate at the same time. Your help would be appreciated.

    Yes I did read the datasheet but I couldn't find anything like OSC tune that I've seen for the 12F683.

  6. #6
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    Hi,

    When using multiple interrupt sources you can prioritize which Interrupt flags to check when vectored to ISR, still the results may not be deterministic every time. Say you are already servicing a lower priority interrupt (not Hardware but DT's scheme) a higher priority interrupt like your time tick occurs. Generally adding the rolling timer with the offset value does the trick however if you would like more precision then use the compare module on the PIC which resets the associated timer automatically and gives a rock solid time base.
    Regards

    Sougata

  7. #7
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    You need to fine tune the timer, not the OSC.
    Here is an example
    http://www.picbasic.co.uk/forum/show...3259#post23259
    And here is another
    http://www.picbasic.co.uk/forum/show...5912#post75912
    And this will help with the calcs.
    http://www.picbasic.co.uk/forum/cont....-PICMultiCalc
    Dave
    Always wear safety glasses while programming.

Similar Threads

  1. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 22:43
  2. DT instant interrupts with mister_e keypad
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th November 2008, 21:02
  3. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 21:48
  4. Keypad and DT's Instant Interrupts
    By Homerclese in forum General
    Replies: 11
    Last Post: - 27th April 2007, 07:32
  5. Replies: 1
    Last Post: - 1st November 2006, 04:11

Members who have read this thread : 5

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