Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    Join Date
    Mar 2006
    Posts
    41


    Did you find this post helpful? Yes | No

    Wink fixed it

    ahhh thanks guys

    fixed it toggling both
    ' CREN = 0
    ' SPEN = 0

    I didn't bother with the interrupts just disabled the Port input thanks I appreciate it!!!

  2. #2
    Join Date
    Dec 2007
    Location
    Cd. Juarez, Mexico
    Posts
    8


    Did you find this post helpful? Yes | No

    Default

    Hi Darrell, I tried to use your great rutines without any luck. I'm using a 18F248 sending CAN messages and I want to use a timer interrupt to send it.
    Just to test the rutines I tried to compile the example you post for timer interrupt and DT_INTS-18.bas rutines. But I got some errors on the compilation. Attached you will find a screen shot of what i'm talking about. If anybody can tell me what I'm doing wrong, it will be a great help for me.

    Thanks in advance for all yor help

    Alfredo
    Attached Images Attached Images  

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


    Did you find this post helpful? Yes | No

    Default

    Hi Alfredo,

    Well apparently, not all CAN modules are the same.
    There are 2 types, CAN and ECAN.

    I didn't consider the plain CAN module when I wrote it.

    I'll have to make a way for it to detect which module is available and only use the interrupts for it. Then I'll post an update.

    But for now, you can just comment out the interrupt Sources that aren't available.
    In the DT_INTS-18.bas file, comment out the following lines in the CAN Module section ...
    Code:
    asm  ; -- CAN Module --
      ifdef WAKIF  
                   ;----{ CAN bus Error }------------------------[PIR3, ERRIF]---
          INT_Source  CAN_ERR_INT, PIE3,ERRIE, IPR3,ERRIP
      
                   ;----{ Invalid Received Message }-------------[PIR3, IRXIF]---
          INT_Source  CAN_IRX_INT, PIE3,IRXIE, IPR3,IRXIP
      
                   ;----{ Receive Buffer 0 }------Mode 0--------[PIR3, RXB0IF]---
          INT_Source  CAN_RXB0_INT, PIE3,RXB0IE, IPR3,RXB0IP
                   ;----{ FIFO Watermark }--------Mode 1, 2---[PIR3, FIFOWMIF]---
    ;      INT_Source  CAN_FIFOWM_INT, PIE3,FIFOWMIE, IPR3,FIFOWMIP
      
                   ;----{ Receive Buffer 1 }------Mode 0--------[PIR3, RXB1IF]---
          INT_Source  CAN_RXB1_INT, PIE3,RXB1IE, IPR3,RXB1IP
                   ;----{ Any Receive Buffer }----Mode 1, 2-----[PIR3, RXBnIF]---
    ;      INT_Source  CAN_RXBn_INT, PIE3,RXBnIE, IPR3,RXBnIP
      
                   ;----{ Transmit Buffer 0 }-------------------[PIR3, TXB0IF]---
          INT_Source  CAN_TXB0_INT, PIE3,TXB0IE, IPR3,TXB0IP
      
                   ;----{ Transmit Buffer 1 }-------------------[PIR3, TXB1IF]---
          INT_Source  CAN_TXB1_INT, PIE3,TXB1IE, IPR3,TXB1IP
      
                   ;----{ Transmit Buffer 2 }-----Mode 0=-------[PIR3, TXB2IF]---
          INT_Source  CAN_TXB2_INT, PIE3,TXB2IE, IPR3,TXB2IP
                   ;----{ Any Transmit Buffer }---Mode 1, 2-----[PIR3, TXBnIF]---
    ;      INT_Source  CAN_TXBn_INT, PIE3,TXBnIE, IPR3,TXBnIP
      
                   ;----{ CAN bus Activity Wake-up }-------------[PIR3, WAKIF]---
          INT_Source  CAN_WAKE_INT, PIE3,WAKIE, IPR3,WAKIP
      endif
      
      list
        endm
      list  
    ENDASM
    Thanks for the info!
    DT

  4. #4
    Join Date
    Dec 2007
    Location
    Cd. Juarez, Mexico
    Posts
    8


    Did you find this post helpful? Yes | No

    Thumbs up

    WOOOOW!
    Thank you very much for the info, now I can use your rutines!!! Your info fix my problem

    Thanks again!!!

    Alfredo

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    .Damn.. way to slow this time

    my solution was..
    Code:
    asm
    RXBnIF=RXB1IF
    TXBnIF=TXB2IF
    FIFOWMIF=RXB0IF
    INT_LIST    MACRO
        INT_Handler TMR1_INT, _ToggleLED1, PBP, yes
        endm
        INT_CREATE
       endasm
    From p18f8680.inc file...
    Code:
    ;----- PIR3 Bits -----------------------------------------------------
    RXB0IF           EQU  H'0000'
    RXB1IF           EQU  H'0001'
    TXB0IF           EQU  H'0002'
    TXB1IF           EQU  H'0003'
    TXB2IF           EQU  H'0004'
    ERRIF            EQU  H'0005'
    WAKIF            EQU  H'0006'
    IRXIF            EQU  H'0007'
    
    FIFOWMIF         EQU  H'0000'
    RXBnIF           EQU  H'0001'
    TXBnIF           EQU  H'0004'
    On another hand... seems odd...
    Last edited by mister_e; - 30th May 2008 at 23:33.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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


    Did you find this post helpful? Yes | No

    Default

    Good one Steve. That would have worked too.

    Since they're actually the same bit's, but with different Names depending on the mode, that might be an easy way for me to fix it. Maybe.
    <br>
    DT

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    But yeah... we know how Microchip work... hard to tell if it will always work... on all PIC

    Worth a try!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #8
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    257


    Did you find this post helpful? Yes | No

    Question

    Steve,

    Do you know if the there is any difference in accuracy between using a xtal osc and the internal RC osc esp. in relation to timer interrupts?

    Squib

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


    Did you find this post helpful? Yes | No

    Default

    Must be Steve's day off.

    Hi Squib,

    Well it depends on the internal oscillator type, and how you're using the interrupts.

    The typical general purpose crystal will have a tolerance of +/- 50 PPM (Parts per million) Although there are other crystals with tighter tolerances, some down to less than 1 PPM. But they come at a higher cost.

    If you're using one of the older 4mhz internal oscillators, depending on temperature and proper calibration numbers, they can vary up to +/-10% (100,000 PPM). A HUGE difference.

    The newer 8mhz oscillators will vary a modest +/- 2.5% over the temperature range, but that's still 25,000 PPM.

    If the interrupts are being used for "Long Term" timing like a clock, a difference of 1 PPM translates to an error of +/- 31.5 seconds per year. At 50 PPM it's 26.3 minutes/yr

    But with the 8mhz INT_OSC, you're looking at a whopping 9.1 Days/Yr.. And with the old 4mhz osc you're off by +/-36.5 days. Yikes!

    Of course these are "Worst case" numbers with maximum temperature extremes, actual results may vary.

    hth,
    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 : 10

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