Safe usage of PBP commands within ASM ISR


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Safe usage of PBP commands within ASM ISR

    Just found R0 in my ISR... And it's from remainder...
    So what is the fastest way to save and restore PBP system variables?

  2. #2
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Safe usage of PBP commands within ASM ISR

    Just found my answer in ReEnterPBP-18 file... Thanks Darrel
    I think that is too much things to save, and restore. So it would bi much better to do everything in ASM even if it requires to write basic functions like reminder in this case...

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


    Did you find this post helpful? Yes | No

    Default Re: Safe usage of PBP commands within ASM ISR

    Sorry, I meant to get back to this sooner but I knew it would take awhile, which is part of my point in this thread.

    Quote Originally Posted by pedja089 View Post
    Just found R0 in my ISR... And it's from remainder...
    It's more than that.

    Along with the R0 you see in the immediate code generated by the modulus (//) statement, there's also a call to DIV in the library code.
    DIV uses the R0, R1, R2 and R3 system variables.

    So unless you take the time to follow every CALL (library routines call other functions too) you can't be sure of what variables you need to save.

    Quote Originally Posted by pedja089 View Post
    Just found my answer in ReEnterPBP-18 file... Thanks Darrel
    I think that is too much things to save, and restore. So it would bi much better to do everything in ASM even if it requires to write basic functions like reminder in this case...
    Well, just think of DT_INTS as a stepping stone.
    Now that you understand what it takes to write interrupts that don't conflict with PBP ... Go for it!
    Or use DT_INTS and get some sleep tonight.

    Either way, keep in mind that DT_INTS runs ASM interrupts with very little overhead and greater control.
    It's only when ReEnterPBP.bas is used with PBP interrupts that the system variables are saved.
    ASM interrupts will always give the best performance.
    DT

  4. #4
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Safe usage of PBP commands within ASM ISR

    Now I wrote INT in ASM.
    The problem is that the device must be powered with battery for several years...
    So INT must be as fastest as possible...

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


    Did you find this post helpful? Yes | No

    Default Re: Safe usage of PBP commands within ASM ISR

    Quote Originally Posted by pedja089 View Post
    Now I wrote INT in ASM.
    The problem is that the device must be powered with battery for several years...
    So INT must be as fastest as possible...
    Depending on your application, a short wake period (Higher Fosc) may not translate into the lowest average power drain. Optimizing your code and the oscillator frequency (which may not be the shortest execution) are needed. Also while measuring current for the XLP devices try to keep the ambient temp similar. Changes in ambient temp results in current changes as I have experienced.
    Regards

    Sougata

  6. #6
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Safe usage of PBP commands within ASM ISR

    I didn't think on short wake period. I meant INT routines should have the smallest possible number of instructions.
    For now average current consumption is about 10uA at 3V (CR2302), Pic running on INTOSC 4MHz.

Members who have read this thread : 0

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