Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor
    For the 12F683...
    Did you comment out the wsave2 and wsave3 variables in DT_INTS-14?
    Not until seeing your question. That seems to do it. It compiles and only uses 593 words so I think it will be OK, now.

    Will the pin change functions work with the 12F683?
    Last edited by dhouston; - 1st August 2006 at 16:16.

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


    Did you find this post helpful? Yes | No

    Default

    Awesom,

    Will the pin change functions work with the 12F683?
    Sure will.

    Add these two lines in the ASM section right before the INT_LIST

    RBIF = GPIF
    RBIE = GPIE
    (no space at the beginning of the line)

    Then use RBC_INT.
    <br>
    DT

  3. #3
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor
    Add these two lines in the ASM section right before the INT_LIST

    RBIF = GPIF
    RBIE = GPIE
    (no space at the beginning of the line)

    Then use RBC_INT.
    Thanks. Spending $0.25-0.30 more for the 12F683 vs. the 12F629 is worth it to be able to use Instant Interrupts.

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


    Did you find this post helpful? Yes | No

    Default

    I like the 683 too. If for nothing more than the CCP module. Of course the extra RAM and program space is also handy.

    With the 629 only having 64 bytes of RAM,
    PBP uses 24-26 bytes
    and DT_INTS-14 and ReEnterPBP want 31 bytes of it (without T? vars)

    Which only leaves about 6-7 bytes for the program. Not much you can do with that.

    But, when using ASM interrupt handlers, DT_INTS-14 only needs 7 bytes of RAM, leaving around 38 bytes for the users program. Now that, is workable. It also uses less program space that way.

    You mentioned earlier that you only needed to toggle a pin in the interrupt, so you might take a look at this page...

    DT_INTS-14 (Assembly Language Interrupts)
    http://www.darreltaylor.com/DT_INTS-14/asm_ints.html

    The ToggleLED1: handler does just that. And if the other handlers aren't too tuff, you might still fit it in a 629.

    HTH,
    &nbsp; DT

  5. #5
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    Darrel

    I'm going to be moving a project from a 16F88 to an 18F1320. The reason for the move is the 18F1320 has 3 external interrupts, 2 of which I will be using. Currently I'm using instant interrupts and INT_INT on the 16F88. The question is will instant interrupts work with multiple external interrupts? I see in the datasheet that the external interrupts have numbered flags.

  6. #6
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by DynamoBen
    Darrel

    I'm going to be moving a project from a 16F88 to an 18F1320. The reason for the move is the 18F1320 has 3 external interrupts, 2 of which I will be using. Currently I'm using instant interrupts and INT_INT on the 16F88. The question is will instant interrupts work with multiple external interrupts? I see in the datasheet that the external interrupts have numbered flags.
    See http://darreltaylor.com/DT_INTS-18/home.html. Darrel has done a good job documenting the Instant Interrupts, and it shows on the right side of the page that multiple external interrupts are implemented.

    Steve

  7. #7
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    Thanks Steve, I forgot that he was using a separate version for the 18Fs.

  8. #8
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by DynamoBen
    Darrel

    I'm going to be moving a project from a 16F88 to an 18F1320. The reason for the move is the 18F1320 has 3 external interrupts, 2 of which I will be using. Currently I'm using instant interrupts and INT_INT on the 16F88. The question is will instant interrupts work with multiple external interrupts? I see in the datasheet that the external interrupts have numbered flags.

    Maybe assigning high & low priorities might help you:
    http://darreltaylor.com/DT_INTS-18/LowPriority.html

    One problem I am having now is that an internal interrupt (USB Service) seems to lose connection after I use an external interrupt (incoming USART data). Assigning a priority to each is just what I'm about to test and see how things go.

    Robert
    Last edited by Demon; - 15th August 2006 at 04:22.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

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


    Did you find this post helpful? Yes | No

    Default

    Sounds like a good idea.

    Since an HSERIN can take up to several hundred milliseconds (depending on baud rate and data size), it's best to have HSERIN in a Low Priority handler.

    And things that "must" go without fail, in the High Priorities.

    DT

  10. #10
    Join Date
    Nov 2008
    Posts
    96


    Did you find this post helpful? Yes | No

    Default 12F683 code to 12F629

    Quote Originally Posted by Darrel Taylor View Post
    I like the 683 too. If for nothing more than the CCP module. Of course the extra RAM and program space is also handy.

    With the 629 only having 64 bytes of RAM,
    PBP uses 24-26 bytes
    and DT_INTS-14 and ReEnterPBP want 31 bytes of it (without T? vars)

    Which only leaves about 6-7 bytes for the program. Not much you can do with that.

    But, when using ASM interrupt handlers, DT_INTS-14 only needs 7 bytes of RAM, leaving around 38 bytes for the users program. Now that, is workable. It also uses less program space that way.

    You mentioned earlier that you only needed to toggle a pin in the interrupt, so you might take a look at this page...

    DT_INTS-14 (Assembly Language Interrupts)
    http://www.darreltaylor.com/DT_INTS-14/asm_ints.html

    The ToggleLED1: handler does just that. And if the other handlers aren't too tuff, you might still fit it in a 629.

    HTH,
    &nbsp; DT
    Hi Darrel,
    I tried this above tip to get back some RAM space to try put my old 12F683 code into a 12F629, but I get a persistent PBP error when I try to compile it.

    error[101] d:temp\8chppm~3.asm 450: Error: (ReEnterPBP must be INCLUDEd to use PBP type interrupts)

    I also fiddled the wsave value to get past other errors, but this one escapes me, due to not being very familiar with assembly I'd expect.

    Heres my ASM code at the start of the program, what did I mess up ?
    Thanks Martin
    'Interrupt driven 20mS timer for PPM frame timing. See also "my_handler". Uses Timer 1 interrupts.
    INCLUDE "DT_INTS-14.bas" ' Base Interrupt System
    'INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts

    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler TMR1_INT, _my_handler, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts

    ENDASM

    T1CON = $1 ; TMR1ON
    '@ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts

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


    Did you find this post helpful? Yes | No

    Default The Error says it all

    error[101] d:temp\8chppm~3.asm 450: Error: (ReEnterPBP must be INCLUDEd to use PBP type interrupts)

    'INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts
    \<-- commented

    INT_Handler TMR1_INT, _my_handler, PBP, yes

    Ahhh chuew ...
    DT

  12. #12
    Join Date
    Nov 2008
    Posts
    96


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    error[101] d:temp\8chppm~3.asm 450: Error: (ReEnterPBP must be INCLUDEd to use PBP type interrupts)

    'INCLUDE "ReEnterPBP.bas" ' Include if using PBP interrupts
    \<-- commented

    INT_Handler TMR1_INT, _my_handler, PBP, yes

    Ahhh chuew ...
    Hi,
    Sorry Darrel I'm even more confused from the reply. I interpreted your old post and the website info to mean that if I wasn't using PBP interrupts e.g. 'On Interrupt' that I could rem out the ReEnterPBP.bas include. I see I'm interpreting that post wrong.
    Can I take that reply to mean that in this case I can't do that, or does this mean I need to write the handler in ASM ?

    That's MR Ahhh Cheuw :-)

  13. #13
    Join Date
    Jan 2010
    Location
    PHILADELPHIA, PA - USA
    Posts
    34


    Did you find this post helpful? Yes | No

    Default Understanding RBC_INT... or not

    Hi,

    I've been trying vary to fully understand the RBC_INT interrupt handler in DT_INTS-18.pbp.

    So I wrote this little program, Created a simulator circuit model and also a similar hardware circuit.

    Here is the Code:
    Code:
    ' RBC TEST.BAS
    ' PIC 18F6480
    ' MPLAB IDE V8.40
    ' PBP V2.60
    ' Build Options: [-ampasmwin]
    ' RB4  Momentary Contact Button Goes High on Press,  10K Resistor to Ground
    ' RB5  Momentary Contact Button Goes High on Press,  10K Resistor to Ground
    ' RB6  Momentary Contact Button Goes High on Press,  10K Resistor to Ground
    ' RB7  Momentary Contact Button Goes High on Press,  10K Resistor to Ground
    ' RC6  22K ohm to RX on 57600-N-8-1 Serial Terminal
    
    INCLUDE "DT_INTS-18.bas"		; Include Darrel Taylor's Base Interrupt System for PIC18F [Version:3.4 (NOV 04, 2009)]
    
    DEFINE OSC 20
    DEFINE DEBUG_REG PORTC	
    DEFINE DEBUG_BIT 6 			
    DEFINE DEBUG_BAUD 57600
    DEFINE DEBUG_MODE 1 
    DEFINE  SHOWDIGITAL 1
    
    TRISB=%11111111
    ADCON0=%00000000
    ADCON1=%00001111
    
    BTN	  VAR	BYTE
    
    ASM
    INT_LIST  macro ; IntSource,  Label,      Type,  ResetFlag?
            INT_Handler RBC_INT, _DO_RBC_INT,   ASM,  yes	
        endm
        INT_CREATE
    ENDASM
    
    @  INT_ENABLE   RBC_INT
    
    DEBUG "INTERRUPT CREATED",10,13
    DEBUG "INTERRUPT ENABLED",10,13
    
    HOLD_HERE:
    DEBUG "WAITING FOR INTERRUPT",10,13
    PAUSE 2500
    GOTO HOLD_HERE
    
    DO_RBC_INT
    DEBUG "############### RBC INTERRUPT ACTIVATED #################",10,13
    
    MENU:
    PAUSE 200
    DEBUG "MENU - READ BUTTONS",10,13
    If PORTB.4 = 1 Then PAUSE 250: Goto DO_ENABLE
    If PORTB.5 = 1 Then PAUSE 250: Goto DO_DISABLE
    If PORTB.6 = 1 Then PAUSE 250: Goto DO_RETURN
    If PORTB.7 = 1 Then PAUSE 250: Goto DO_CLEAR
    GOTO MENU
    
    DO_ENABLE:
    DEBUG "RUNNING DO_ENABLE",10,13
    @ INT_ENABLE RBC_INT
    Pause 250
    GOTO HOLD_HERE
    
    DO_DISABLE:
    DEBUG "RUNNING DO_DISABLE",10,13
    @ INT_DISABLE RBC_INT
    PAUSE 250
    GOTO HOLD_HERE
    
    DO_RETURN:
    DEBUG "RUNNING DO_RETURN",10,13
    @ INT_RETURN
    PAUSE 250
    GOTO HOLD_HERE
    
    DO_CLEAR:
    DEBUG "RUNNING DO_CLEAR",10,13
    @ INT_CLEAR RBC_INT
    PAUSE 250
    GOTO HOLD_HERE
    
    END
    Here is the Circuit:


    There are 4 buttons connected to PORT B <4.7>
    Here are my observations:

    The first press of any button activates the RBC Interrupt and sends program to DO_RBC_INT subroutine, then on to MENU where it checks for button presses. This behaves exactly as I would expect it to.

    Now...After that....

    Pressing Button RB.4 [ENABLE] Runs the DO_ENABLE subroutine then the HOLD_HERE subroutine. At this point, the Interrupt handler seems to shut down as no Port B inputs activate the interrupt handler. I would expect the Interrupt to remain active.

    Pressing Button RB.5 [DISABLE] Runs the DO_DISABLE subroutine then the HOLD_HERE subroutine. The Interrupt handler is now disabled as expected.

    Pressing Button RB.6 [RETURN] Runs the DO_RETURN subroutine then the HOLD_HERE subroutine. It then sends program to DO_RBC_INT subroutine, then on to MENU. I would expect it to return to HOLD_HERE which is wherr the interrupt was originally activated

    Pressing Button RB.7 [CLEAR] Runs the DO_CLEAR subroutine. At this point, the Interrupt handler seems to shut down as no Port B inputs activate the interrupt handler. I would expect this to just clear the interrupt then await another RBC trigger.

    So it seems I can only activate the interrupt one time.

    It doesn't seem to matter whether I use ASM or PBP types or set Resetflag to yes, or no

    Can anyone shed light on what I'm doing wrong, or am I simply misinterpreting the function of the INT_* utilities.

    I'm just not sure if I've got a mistake, am staying up too late working on this stuff, or just really don't get it.

    Thanks,
    Bob
    Attached Images Attached Images  
    Attached Files Attached Files
    Wozzy-2010

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


    Did you find this post helpful? Yes | No

    Default

    The idea of an Interrupt, is that it Stops the normal flow of the program ... executes an Interrupt Service Routine (ISR) ... then RETURNs back to the same point it was at when it was Interrupted.

    You can't go back to the Main Loop without INT_RETURN'ing.
    In other words ... no GOTO HOLD_HERE.
    <br>
    DT

Similar Threads

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

Members who have read this thread : 8

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