Announcement

Collapse
No announcement yet.

DT_INTS-18xv for 18F K42, K83, and Q43 families

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DT_INTS-18xv for 18F K42, K83, and Q43 families

    I revamped DT-INTS for the 18xv series of devices (18FxxK42, 18FxxK83, and 18FxxQ43) to take advantage of the hardware context feature of these new devices, along with a few other enhancements.
    These routines should be faster, smaller, and use less RAM than the standard DT-INTS.

    The file names have changed, but other than that the usage is the same as other DT-INTS implementations...
    Code:
    ' ---------- Set up DT_INTS-18 Routine for Instant Interrupt handling -----------
    DEFINE USE_LOWPRIORITY 1 ' define if using Low Priority interrupts
    INCLUDE "DT_INTS-18xv.bas" ' Base Interrupt System for 18Fxv processors
    INCLUDE "ReEnterPBP-18xv.bas" ' Include if using PBP interrupts
    INCLUDE "ReEnterPBP-18xvLP.bas" ' Include if using Low Priority PBP INTS
    '------------------------------------------------------------------------------

    The default CONFIG setting for these devices enables multi-vector mode, so be sure to disable it by adding
    Code:
    #config
     CONFIG MVECEN = OFF ; Interrupt contoller does not use vector table (legacy mode)
     #endconfig
    to your main program

    EDIT: new version V4.30 available that fixes an issue with INT0 and K42/K83. See Post 5 below.
    Attached Files
    Last edited by tumbleweed; 11-20-2022, 04:55 AM.

  • #2
    Many thanks for the new files.


    Ioannis

    Comment


    • #3
      Thank you tumblweed for this!
      I'm using an 18F46K42 and I'm trying to get INT0 interrupt to work with the DT_Ints files from post 1 but I'm struggling,

      TMR1 Interrupt works so I have the basics down and if I do (without any interrupt code included):
      Code:
      TRISC.5 = 0
      ANSELB = 0
      ANSELC = 0​
      
      Main:
        HSEROUT["Tick..", 13]
        PAUSE 500
        HSEROUT["Tock..",13]
        PAUSE 500
      
        If PIR1.0 THEN    ' <--- INT0 interrupt flag
          LATC.5 = !LATC.5
          PIR1.0 = 0
        ENDIF
      Goto Main​
      The LED attached to RC5 changes state when the INT0 pin (RB0) is tickled telling me the flag is being set. However, when I try to use the interrupt it does not work:
      Code:
      INCLUDE "DT_INTS-18xv.bas"
      INCLUDE "ReEnterPBP-18xv.bas"
      
      ASM
      INT_LIST macro ; IntSource, Label, Type, ResetFlag?
                 INT_Handler INT0_INT, _Tick, PBP, yes
           endm
           INT_CREATE ; Creates the interrupt processor
      ENDASM
      
      TRISC.5 = 0
      ANSELB = 0
      ANSELC = 0
      
      
      @ INT_ENABLE INT0_INT
      
      HSEROUT["Program Start", 13]
      
      Main:
        HSEROUT["Tick..", 13]
        PAUSE 500
        HSEROUT["Tock..",13]
        PAUSE 500
      Goto Main
      
      Tick:
        LATC.5 = !LATC.5
      @ INT_RETURN​
      In post 1 tumbleweed mentions MVECEN but looking at the defauly config for the 46K42 that one is already off and since I can get TMR1 interrupt to work I don't think that's got anything to do with it.

      Any ideas? In the meantime I'll dig into the assembler include files to try and see if either the IE or IF bits for INT0 points to the wrong location.

      Thanks!
      /Henrik.

      Comment


      • #4
        I think I found it... In the DT_Ints-18xv.bas, line 1014-1016:
        Code:
        ifdef INT0IF ;----{ INT0 External Interrupt }----------[PIR1, INT0IF]---
            INT_Source PIR1,INT0IF, PIE0,INT0IE, IPR1, INT0IP
        endif​
        PIE0 should be PIE1.

        Same issue for the K83 at line 1361 but not for the Q43 (line 532).

        /Henrik.

        Comment


        • #5
          Thanks for catching that!

          I've corrected it and updated the files to v4.30
          Attached Files

          Comment

          Working...
          X