PIC18FxxQ43 Version of DT_INTS


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: PIC18FxxQ43 Version of DT_INTS

    i am wondering if the fast register save is affecting the re-enter_lp.bas include
    Could be, but I don't have any PBP version even remotely up to date to test it with.

    Could you post the .lst and .hex files that go along with that?

    One thing I never see... the INTCON0.GIE bit needs to be set, and I only see that happening if there's a high-priority intr defined.
    you can't have just a low-priority interrupt. If GIE = 0 then all interrupts are shut off.

  2. #2
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: PIC18FxxQ43 Version of DT_INTS

    part of asm listing

    have included the hex and list files


    Code:
    
     C:\USERS\SMW OFFICE\DOCUMENTS\MY PIC PROJECTS\K9 GTS PROJECT\PIC BASIC CODE\WORKING FILES\K9 LED CONTROLLER\VER 1.0 PCB\VER 1.3 DEV\LED DISPLAY BASE\DT_INTS-18_Q43.BAS	00678	ASM
    
    	ASM?
    
    INT_CREATE_L  macro
      local OverCREATE
        goto OverCREATE
        ifdef USE_LOWPRIORITY
            if (USE_LOWPRIORITY != 1)
           error "'DEFINE USE_LOWPRIORITY 1' required for Low Priority Interrupts"
            endif
        else
           error "'DEFINE USE_LOWPRIORITY 1' required for Low Priority Interrupts"
        endif
    Priority = L
    INT_ENTRY_L  
      bcf      _InHPint, 0    
    List_Start_L
      clrf  BSR
    PREV_BANK = 5
     RETFIE  1
        bcf      _Serviced_L, 0
        ifdef INT_LIST_L
            INT_LIST_L                  ; Expand the users list of HP INT handlers
        else
            error "INT_CREATE_L - INT_LIST_L not defined, can not create"
        endif
        btfsc    _Serviced_L, 0         ; if anything was serviced
        goto     List_Start_L           ; go around, and check again
    
        ifdef ReEnterLPused             ; was ReEnterPBP-18LP.bas included
            GetAddress21  INT_EXIT_L, RetAddrL
            L?GOTO   _RestorePBP_L      ; Restore PBP system Vars
        endif
    
    INT_EXIT_L
    PREV_BANK = 5
        retfie   FAST                    ; Return from Interrupt
    OverCREATE
        bsf  INTCON0, IPEN_INTCON0, 0 ; Enable Interrupt Priorities
        bsf   INTCON0,GIEL, 0         ; Enable Low Priority Interrupts
      endm
    
    
    	ENDASM?
    Attached Files Attached Files

  3. #3
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: PIC18FxxQ43 Version of DT_INTS

    I don't see anything wrong with ReEnterPBP-18LP.bas, but there are a few other things I noticed.

    First off, as I said, you can't have just a low-priority interrupt.
    If you don't define a high-priority one then INTCON0.GIE never gets set, and if GIE is 0 then you get no interrupts period.
    If you only have one interrupt it must be high-priority.

    Next, there's an issue with the INT_ENABLE macro.
    The lines that setup the priority bits in the IRPx registers assume that the registers are in the access bank, and they're not.
    Code:
    if (Priority == H)
        bsf  INT_Priority_Reg, INT_Priority_Bit, 0
    else
        if (Priority == L)
            bcf  INT_Priority_Reg, INT_Priority_Bit, 0
    The ", 0" at the end of those lines tell the assembler to use the access bank instead of the BSR bank select register.
    In the Q43, the IRP registers are in bank 3, so they can't use the SFR access bank (bank 4).
    Those instructions need a BANKSEL before them, remove the ", 0", and don't forget to put the BSR register back afterwards.
    Something like this ought to work...
    Code:
    if (INT_Priority_Reg != -1)
        if (Priority == H)
            movf BSR, 0			; save current BSR in WREG
    	banksel INT_Priority_Reg 
            bsf  INT_Priority_Reg, INT_Priority_Bit
            movwf BSR           ; restore BSR
        else
            if (Priority == L)
    	    movf BSR, 0			; save current BSR in WREG
                banksel INT_Priority_Reg 
    	    bcf  INT_Priority_Reg, INT_Priority_Bit
                movwf BSR           ; restore BSR
    	else
                error "INT_ENABLE - Invalid Priority Specified"
            endif
        endif
    else

    Finally, in the INT_CREATE_H macro, the line following OverCREATE comments out PEIE... that should be uncommented.
    Otherwise, if you're not using priorities you'll never get a peripheral interrupt.
    Code:
    OverCREATE
        bsf   INTCON0,GIE, 0             ; Enable High Priority Interrupts
    ;    bsf   INTCON0,PEIE, 0            ; Enable Peripheral Interrupts
      endm
    should be:
    Code:
    OverCREATE
        bsf   INTCON0,GIE, 0             ; Enable High Priority Interrupts
        bsf   INTCON0,PEIE, 0            ; Enable Peripheral Interrupts
      endm

  4. #4
    Join Date
    Aug 2011
    Posts
    453


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: PIC18FxxQ43 Version of DT_INTS

    ... and one I forgot.

    In your Timer0_Count routine, stop messing around with the PIE bits. You can't get another TMR0 interrupt while you're already inside the ISR.
    Code:
     Timer0_Count:
      ' PIE0.5 = 0                   ' K40 Stop Timer 0 interupt
       ' PIE3.7 = 0                   ' Q43 Stop Timer 0 interupt 
       '======= DEBUG =========  
       if Internal_Cal = 1 then 
          LATA.2 = ~LATA.2              ' DEBUG OF TIMER0 INTERVLES  hub_c pin ( 1/4scan panels Hub_c not used) 
       endif 
       '------------------------
     
        TMR0H = $63               ' preset Timer 0 to a 10ms timer
        TMR0L = $C0                              
       
      '  PIE0.5 = 1                ' K40 Start Timer 0 interupt - TMR0IF
     '    PIR3.7 = 1 ' Q43 CLEAR THE INTERUPT 
      '   PIE3.7 = 1                ' Q43 Start Timer 0 interupt  
    @ INT_RETURN
        RETURN

Similar Threads

  1. Replies: 2
    Last Post: - 31st October 2017, 17:04
  2. New PBP version - Gold version - Is it really worth it?
    By financecatalyst in forum General
    Replies: 20
    Last Post: - 8th October 2011, 01:34
  3. help with version 2.04
    By mxjf in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 13th October 2006, 04:01
  4. New Version
    By mslaney in forum PBP Wish List
    Replies: 0
    Last Post: - 25th January 2005, 08:06
  5. Shall we see a new version soon?
    By Bulman in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 28th September 2004, 16:18

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts