Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,821


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    I am trying to make an Interrupt on Rising Edge, PortB.0 on a 16F1827 chip.

    When first POR the device, it send the message "Program started" and waits for the Interrupt.

    When interrupt happens, Portb.0 is left open (it has pull-up enabled) the ISR is executed sending the message "Hey, I am sleeping!".

    And then keeps on sending the message even if the PortB.0 has been restored (grounded).

    Anyone sees what stupid thing I missed?

    Ioannis
    Attached Files Attached Files

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


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    Ioannis,

    You just need to clear the IOCBF register before exiting the ISR.

    IOCBF = 0
    DT

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,821


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    Oh, I see.

    I thought this was taken care by the DT-INTS.

    Thanks Darrel,
    Ioannis

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


    Did you find this post helpful? Yes | No

    Default

    That's what everyone else thinks too, so don't feel too bad.

    However, the "Interrupt On Change" on some chips have many interrupt flags that "funnel" into a single IOCIF flag.
    DT_INTS only knows about the one IOCIF flag. It has no control over the other 8 flags in the IOCBF register.

    It's alot like the USB modules which have 12 interrupt flags that funnel into a single USBIF flag.
    But for some reason, nobody expects DT_INTS to handle all of those automatically.
    Well actually, if you add DT_HID, they are handled automatically, but that's not the point.

    There are too many variations of the IOC interrupts.
    Some chips have them on PORTB, some on PORTA, and some have combinatons of PORTA, PORTB and PORTC.
    Its the one part of a PIC that you can pretty much assume won't work the same way as the last chip you used.

    And there are too many ways you can use IOC interrupts, there's no way I could make something that would work for everybody.
    It's much easier for the user to add one or two lines of code to clear the flags the way that best fits the application.
    DT

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,821


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    Thanks Darrel. Yes I understand that it is too much to ask for your software to cover every variation that Microchip offers.

    It was my part to find that, though I got a little confused by the Data sheet and could not see the obvious.

    By the way, this little monster (16F1827) has got a core temperature sensor too!

    Ioannis

  6. #6
    Join Date
    Aug 2004
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    Hi Darrel: I made a little test with this:
    DEFINE OSC 8
    ' **** CONFIGURACION 16F1826 *************************
    #CONFIG
    __config _CONFIG1, _FOSC_INTOSC & _MCLRE_OFF & _CP_ON & _WDTE_OFF
    __config _CONFIG2, _PLLEN_ON & _LVP_OFF
    #ENDCONFIG
    ANSELA= %00000001 'Set 'em all to digital
    ANSELB= 0 ' 'all digital
    ADCON0= 1
    adcon1=$80
    CM1CON0 = 0
    CM2CON0 = 0
    OSCCON = $72
    '*******************************
    LED1 VAR PORTB.3

    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, _ToggleLED1, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    ENDASM

    T1CON = $31 ; Prescaler = 8, TMR1ON
    @ INT_ENABLE TMR1_INT ; enable Timer 1 interrupts

    Main:
    PAUSE 1
    GOTO Main

    '---[TMR1 - interrupt handler]--------------------------------------------------
    ToggleLED1:
    TOGGLE LED1
    @ INT_RETURN

    When I compile, I got 2 errors:
    574 Illegal opcode (aftersave)
    581 Illegal code (AfterUserRoutine)

    and two warnings:
    574 found label after column 1 (GetAddress)
    581 found label after column 1 (GetAddress)
    Please help...
    Greetings...
    Ruben de la Pena V.

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


    Did you find this post helpful? Yes | No

    Default Re: Instant Interrupts - Revisited

    Ruben,

    1) Did you retype the errors, or copy&paste them? The errors are not even the correct format.

    2) Have you modified the DT_INTS-14.bas file? The stated errors do not occur when I compile your code.

    Try downloading the include files again.
    http://www.darreltaylor.com/DT_INTS-14/downloads.htm
    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 : 9

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