Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Alain,

    Well, you may have noticed I didn't get the "GLOBAL" for INT_ENABLE/DISABLE put in the last version of DT_INTS-18.
    It turns out that GLOBAL is a reserved word for MPASM. It's used with relocatable code.

    I could have used GLBL or GLBAL I suppose, but somehow

    @ INT_DISABLE GLBL

    Seems even more cryptic than

    GIE = 0

    I still think it should be in there, as should PERIPHERAL, HIPRIORITY and LOWPRIORITY.

    But I'm not sure what the best way is, AKA less confusing.

    Any thoughts?
    <br>
    DT

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Alain,

    Well, you may have noticed I didn't get the "GLOBAL" for INT_ENABLE/DISABLE put in the last version of DT_INTS-18.
    It turns out that GLOBAL is a reserved word for MPASM. It's used with relocatable code.

    I could have used GLBL or GLBAL I suppose, but somehow

    @ INT_DISABLE GLBL

    Seems even more cryptic than

    GIE = 0

    I still think it should be in there, as should PERIPHERAL, HIPRIORITY and LOWPRIORITY.

    But I'm not sure what the best way is, AKA less confusing.

    Any thoughts?
    <br>

    Hi, Darrel

    What about

    @ G_INT_DISABLE and @ G_INT_ENABLE ??? ... would be simple enough. ... and it's just "ordinary" macros !!!

    Remember the goal was only to use something simple to remind ( in other words: to use for datasheet non-lovers !!! )

    To me, GIE = 0 is also the simpler ... But, as you've seen, nowadays nobody dares to read the datasheets !!!




    The Tractor computer soft is just finished (!)... I had some precedence headaches ( particularly with // !!! ), and it was really difficult to see what was wrong ...

    despite result was good for setting a flag, operation was wrong !!! ... and was no way to cancel that flag ...

    Now, I must translate my comments to English ...

    Regards
    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Nov 2003
    Location
    Sao Paulo - Brazil
    Posts
    92


    Did you find this post helpful? Yes | No

    Default Button and Instant interrupts

    Hello Darrel !

    I´m using your Instat interrupts to work with TIMER1, TIMER2 and CCP1 with a 16F877 @ 4Mhz, like this :

    ASM
    ;T0IF = TMR0IF
    ;T0IE = TMR0IE
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler CCP1_INT, _Capture, PBP, yes
    INT_Handler TMR1_INT, _Timer1, PBP, yes
    INT_Handler TMR2_INT, _tick, PBP, yes
    endm
    INT_CREATE ; Cria a interrupção
    ENDASM

    Everything is working very, very well.

    I´m doing a On-board computer for my small Opel Corsa, and this interrupts are just great !
    Me and Sirvo (remember him ?) are doing almost the same on-board computer.

    But now, I would like to implement 4 Buttons to my application (Start, Stop, Pause, Funcition Keys).

    I´m trying to do that with the button statement without success / good results.

    I read your sample (hello word for instant interrupts) but the INT_INT read just the RB0/INT right ?

    Is that possible to use the Instant Interrupts to create/read, let´s say, 4 different buttons on PORTC ?

    Tahank You very much !

    bye


    Sérgio Pinheiro

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


    Did you find this post helpful? Yes | No

    Default

    Is that possible to use the Instant Interrupts to create/read, let´s say, 4 different buttons on PORTC ?
    Yes, that's possible. But it would be a lot easier if you used RBC_INT "Port B change interrupts". It uses PORTB.4 thru PORTB.7

    But if those pins aren't available, you could do something like this, which uses only 1 interrupt (INT_INT on Falling Edge), then the interrupt handler can read PORTC to figure out which one was pressed.


    <br>
    DT

  5. #5
    Join Date
    Nov 2003
    Location
    Sao Paulo - Brazil
    Posts
    92


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel

    Thank you very Much !

    I think this could help me a Lot !

    I´m already using some portb pins and this solution will help a lot !

    Thank you again !

    Sérgio

  6. #6
    Join Date
    Oct 2004
    Location
    North Norfolk UK
    Posts
    146


    Did you find this post helpful? Yes | No

    Default Instant Interrupts and Internal Comparators

    Hi Darrel,

    I have been using your wonderful instant interrupts routine, i have experienced a hiccup and cannot work out what I am doing wrong.

    I wonder anybody may be able to help direct me to a solution.

    I am using a 18F4520 with 2.5 and masm401. I have checked that I have your latest version which I beleive to be 3.2 (dated 28/8/07).

    when I compile the following code:

    define OSC 16
    INCLUDE "DT_INTS-18.bas"
    INCLUDE "ReEnterPBP-18.bas" ; Include if using PBP interrupts
    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler CMP1_INT, _HopOut, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    ENDASM

    TRISA = %00111111'
    TRISD = %00000000
    Z var bit
    x var byte
    CMCON = %00000010
    @ INT_ENABLE CMP1_INT
    Start:
    PORTD.4 = 0
    z = 0
    Waiting:
    if z = 0 then waiting

    for x = 1 to 20
    pause 50
    toggle PORTD.4
    next x
    goto start

    HopOut:
    z = 1
    @ INT_RETURN

    end


    I recieve the following complie errors



    Error[128]........: Missing argument(s)
    Error[113]........: Symbol not previously defined(IntFlagReg)
    Error[113]........: Symbol not previously defined(IntFlagBit)
    Error[113]........: Symbol not previously defined(IntFlagReg)
    Error[113]........: Symbol not previously defined(IntFlagBit)
    Error[101]........: ERRORInterrupt Source(IntFlagReg,IntFlagBit)not found)
    Error[128]........: Missing argument(s)
    Error[101]........: ERRORINT_ENABLE -Interupt Source not Found!)


    If I change the CMP1 to CMP2 I receive errors

    If I change the CMP1 to CMP then it compiles okay.

    Any thoughts... should I be looking to set the registers manually maybe? I was planning to use both comparators independantly.

    Thanks

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Post

    Hi,

    No surprise if you read the interrupt sources list

    #define INT_INT INTCON,INT0IF ;-- INT External Interrupt, 16F compatible
    #define INT0_INT INTCON,INT0IF ;-- INT0 External Interrupt
    #define INT1_INT INTCON3,INT1IF ;-- INT1 External Interrupt
    #define INT2_INT INTCON3,INT2IF ;-- INT2 External Interrupt
    #define INT3_INT INTCON3,INT3IF ;-- INT3 External Interrupt
    #define RBC_INT INTCON,RBIF ;-- RB Port Change Interrupt
    #define TMR0_INT INTCON,TMR0IF ;-- TMR0 Overflow Interrupt 18F
    #define TMR1_INT PIR1,TMR1IF ;-- TMR1 Overflow Interrupt
    #define TMR2_INT PIR1,TMR2IF ;-- TMR2 to PR2 Match Interrupt
    #define TMR3_INT PIR2,TMR3IF ;-- TMR3 Overflow Interrupt
    #define TMR4_INT PIR3,TMR4IF ;-- TMR4 Overflow Interrupt
    #define TX_INT PIR1,TXIF ;-- USART Transmit Interrupt
    #define TX1_INT PIR1,TX1IF ;-- USART1 Transmit Interrupt
    #define TX2_INT PIR3,TX2IF ;-- USART2 Transmit Interrupt
    #define RX_INT PIR1,RCIF ;-- USART Receive Interrupt
    #define RX1_INT PIR1,RC1IF ;-- USART1 Receive Interrupt
    #define RX2_INT PIR3,RC2IF ;-- USART2 Receive Interrupt
    #define CMP_INT PIR2,CMIF ;-- Comparator Interrupt
    #define EE_INT PIR2,EEIF ;-- EEPROM/FLASH Write Operation Interrupt
    #define BUS_INT PIR2,BCLIF ;-- Bus Collision Interrupt
    #define LVD_INT PIR2,LVDIF ;-- Low Voltage Detect Interrupt
    #define HLVD_INT PIR2,HLVDIF ;-- High/Low Voltage Detect Interrupt
    #define PSP_INT PIR1, PSPIF ;-- Parallel Slave Port Read/Write Interrupt
    #define AD_INT PIR1, ADIF ;-- A/D Converter Interrupt
    #define SSP_INT PIR1, SSPIF ;-- Master Synchronous Serial Port Interrupt
    #define CCP1_INT PIR1, CCP1IF ;-- CCP1 Interrupt
    #define CCP2_INT PIR2, CCP2IF ;-- CCP2 Interrupt
    #define CCP3_INT PIR3, CCP3IF ;-- CCP3 Interrupt
    #define CCP4_INT PIR3, CCP4IF ;-- CCP4 Interrupt
    #define CCP5_INT PIR3, CCP5IF ;-- CCP5 Interrupt
    #define USB_INT PIR2, USBIF ;-- USB Interrupt
    #define OSC_INT PIR2, OSCFIF ;-- Oscillator Fail Interrupt



    ... only this :

    #define CMP_INT PIR2,CMIF ;-- Comparator Interrupt

    I think you have Yourself to look from which comparator the interrupt comes ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

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