Improved interrupt handling


Closed Thread
Results 1 to 3 of 3
  1. #1
    Desterline's Avatar
    Desterline Guest

    Default Improved interrupt handling

    Seems they culd improve the way interrupts are handled.

    The latency of the ON INTERRUPT methodology is undesirable. The excelent code from Tim Box that stores all the complier internal variables, allowing for picBasic instructions in an assembler interrupt, improves this. However, a simple interrupt may not use all of those variables, so saving and restoring all of them is excessive. It seems the compiler could make an inteligent decision on which ones need saved and create the neccesary code.

    Or, the compiler could use duplicate macros when a function is called in an interrupt routine.

    Perhaps the best solution would be a configurable combination of these options. The reletive speeds and resource utilization of the potential solutions could be presented to the user, then the user could decide which one to go with.

    Anybody have any thoughs on that?
    -Denny
    Last edited by Desterline; - 9th November 2003 at 23:31.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    There are many PBP functions that would not take kindly to being interrupted... Take SOUND or FREQOUT, even a brief interruption affects the output quite considerably. DEBUGIN, SERIN & SERIN2 affects timing and data bits are dropped. Operation of COUNT, PAUSE, PAUSEUS, PULSEOUT, PWMOUT, RCTIME, SEROUT etc etc would all be affected. It's not just a simple case of saving the registers. Remember the PIC (or indeed any processor without parallel processing capability) can only do one thing at a time. If it's in the middle of a time critical task, any interruption - regardless how small, will affect that task. Remember too that most of the PBP functions and commands are given to you without using any of the PIC's hardware features like timers, and using the minimum of resources, leaving them along with most of the PIC's resources free for you to use in your application.

    It should be remembered that even Tim's routines affect the operation of all the time critical functions and commands to an extent where their reliability is compromised and should be used with care.

    Take for example a requirement to output a 1kHz tone for 1 second... FREQOUT pin,1000,1000 go interrupt that (with Tim's or anyone's routine) and report back what happened to your output. The current way PICBASIC handles the interrupt is by letting FREQOUT complete before jumping to your ISR, which is sensible because FREQOUT's operation is not compromised.

    What MeLabs should do, is, at the start of section 5 in their manual, where the commands are listed, indicate with a symbol against each command those whose operation would be compromised through being interrupted. At least then you would be forwarned which PBP functions should not be used in any such program that you create.

    Melanie

  3. #3
    Desterline's Avatar
    Desterline Guest


    Did you find this post helpful? Yes | No

    Default

    Granted, it's a little more complex than my first post would indicate, but I still think there's room for improvment in that area.

    -Denny

Similar Threads

  1. Won't go back to SLEEP after 1st Interrupt
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 29th June 2009, 10:00
  2. Can't ID interrupt source with this IntHandler??
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd June 2009, 03:35
  3. Help with Analog Interrupt
    By brid0030 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 13th February 2008, 19:14
  4. NEWBIE: Some basic questions using interrupts
    By JackPollack in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th March 2006, 03:59
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 02:07

Members who have read this thread : 1

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