PIC18FxxQ43 Version of DT_INTS


Closed Thread
Results 1 to 26 of 26

Hybrid View

  1. #1
    Join Date
    Aug 2011
    Posts
    458


    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

  2. #2
    Join Date
    Aug 2011
    Posts
    458


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

Members who have read this thread : 1

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