16F1827 interrupt hosed


Closed Thread
Results 1 to 19 of 19

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: 16F1827 interrupt hosed

    CALL or GOSUB doesn't make any difference.
    But you cannot run Basic Language statements in an Assembly Language interrupt.
    Re-use of PBP's system variables will corrupt the main programs flow.

    If you want to use Basic statements in ASM interrupts, you need to either use ON INTERRUPT or DT_INTS.
    DT

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: 16F1827 interrupt hosed

    Darrel,

    How would I structure my code using your interrupt include file? I want to accomplish the following:

    1). update 4 servo's with a refresh rate of 16ms. Pulse width on the servos range between 1 ~ 2 ms based on reading 5 ADC channels.

    Best Regards,
    Nick

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: 16F1827 interrupt hosed

    I found this in the new PBP3 Reference Manual on page 264

    "Whenever a block of inline Assembly Language is entered, PBP sets the bank-select register to BANK0".

    So, why does Nick have to manually select BANK0 using BANKSEL T1CON? It's true that all of the registers in his ISR are in BANK0. And yes, all his A to D registers are in BANK1, but why isn't PBP doing the switch to BANK0?

  4. #4
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: 16F1827 interrupt hosed

    Good catch! Looks like I updated pbp but not my brain. Yet another good reason to upgrade

    Darrel are you referring to the pauseus? If so are the rest non system variable things?
    Last edited by cncmachineguy; - 20th October 2011 at 04:26.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

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


    Did you find this post helpful? Yes | No

    Default Re: 16F1827 interrupt hosed

    Quote Originally Posted by cncmachineguy View Post
    Darrel are you referring to the pauseus? If so are the rest non system variable things?
    if adcval < 4 and adcval2 < 4 and adcval3 <4 and adcval4 < 4 and adcval5 < 4 then

    That is a compound if statement, meaning there is more than one condition to be tested.
    That requires it to store intermediate results in T? temp variables, which are part of PBP's system vaiables.
    The compares themselves will call a library function that uses R? system vars.

    PAUSEUS will overwrite the R0 system variable.
    PAUSE would use R0 and R1.

    It's very difficult to know which statements will interfere with which system variables.
    So it's best not to tempt fate.
    Last edited by Darrel Taylor; - 20th October 2011 at 04:55.
    DT

  6. #6
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: 16F1827 interrupt hosed

    Thanks Darrel
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

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


    Did you find this post helpful? Yes | No

    Default Re: 16F1827 interrupt hosed

    Quote Originally Posted by Macgman2000 View Post
    ... How would I structure my code using your interrupt include file? ...
    I guess the structure would look a lot like the examples found here ... http://www.darreltaylor.com/DT_INTS-14/hello.html
    Look at the Hello World, Blinky Light, Elapsed Timer and then how they are combined 1-3.
    DT

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