Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    Join Date
    Nov 2008
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel,
    i use your instant interrupts on a 18F6722.
    A question to the interrupts:
    I want to use a timer which shall make 1sec ticks and i have both uarts receving commands from other devices. I also have two subs writing and reading via I2C-Bus to some internal devices. Problem: If having more and more activity on the i2c bus and also interrups are coming via the uarts, the timer is getting slower (2 - 3 sec) depending on the activity.
    All interrups are defined as high priority interrups.
    Any idea?

    Regards,
    Ralf

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by ralfmayr View Post
    I want to use a timer which shall make 1sec ticks and i have both uarts receving commands from other devices. I also have two subs writing and reading via I2C-Bus to some internal devices. Problem: If having more and more activity on the i2c bus and also interrups are coming via the uarts, the timer is getting slower (2 - 3 sec) depending on the activity.
    All interrups are defined as high priority interrupts.
    Any idea?
    Hi Ralf,

    Do you have PAUSEs in your handlers?
    Interrupt handlers should be as fast as possible, get in - do only what needs to be done - and get out.

    If for instance it were writing to I2C EEPROM then sitting around waiting 10mS for each write to complete, then no other interrupts can occur during that time that it's doing nothing.

    If you have pauses, or long strings of data being sent or received, then those handlers should be LOW PRIORITY. Then with the Timer still in High Priority, it won't miss a beat.

    hth,
    DT

  3. #3
    Join Date
    Nov 2008
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel,
    thanks for the answer.
    I don't have any pauses, the i2c bus writes and reads ad-converters and io-expanders, no eeproms.

    I think the main problem is the handler for the uarts. The interrups for the uarts are handled as fast as possible, i read back the RCSTA registers and then i put the data in an array, by triggering on "{" and "}" for start of text and end of text. When "}" was received the serial command is valid and then i parse the string.
    After that i handle my i2c bus and so on....
    Maybe it is more effective to make a ring buffer, and when ever there is time then i check this buffer and parse the data in it. But i never made such a ring buffer.....

    Regards,
    Ralf

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Receiving data 1-byte at a time is always the best way to do it with USARTs and interrupts.

    No Timeouts, no WAIT(), and no long strings.

    For a simple Ring buffer, check out Joe S.'s Serial Backpack program, modified for DT_INTS.

    http://www.picbasic.co.uk/forum/show...8336#post28336
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Default Pbpl?

    I hope this hasn't been answered already but,

    What about using Instant Interrupts with PBPL? Should they work? I'm really hoping I'm just doing something wrong cause I'm gonna need them!! (I'm using Ver 2.50 and 2.60 is in the mail)
    :-|
    Last edited by circuitpro; - 10th December 2009 at 02:41.

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by circuitpro View Post
    What about using Instant Interrupts with PBPL? Should they work?
    Yes they should.
    <br>
    DT

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


    Did you find this post helpful? Yes | No

    Unhappy

    With the PBPL box checked in the compiler options, when I put in your
    3 INCLUDE statements:

    INCLUDE "DT_INTS-18.bas"
    INCLUDE "ReEnterPBP-18.bas"
    INCLUDE "Elapsed_INT.bas"

    I get a compile error saying:

    Error [113] c:\blue1\pbp\pbppi18l.lib 1465: Symbol not previously defined (INT_ENTRY_H)

    Does that mean anything to you? No errors without those INCLUDES. No errors if I change to PBP instead of PBPL. (except my LONG variable errors, of course!)
    Last edited by circuitpro; - 10th December 2009 at 03:51.

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 : 4

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