PIC18FxxQ43 Version of DT_INTS


Closed Thread
Results 1 to 26 of 26

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: PIC18FxxQ43 Version of DT_INTS

    i am finding some other issues with bank access with other asm code i have , that is not happy on q43

    thinking that what you did with
    -----------
    movf BSR, 0
    banksel INT_Priority_Reg
    bsf INT_Priority_Reg, INT_Priority_Bit
    movwf BSR
    -----------

    historic code i use for elasped timer to get the cycles constant and limited may now work against q43 chip ??

    i may be wrong as my asm really sucks but each command that has BCF will need a banksel , bsf ????

    having trouble with load of timer1 using asm on the q43

    but doing that change would add cycles i am sure

    i hope i am wrong


    Code:
     ASM
                                     ; 16.368mhz tcxo = 61.0948ns clock       16.00Mhz = 62.5 ( internal osc used currenlty 20/2/20)
    TimerConst = 40912               ; 40912 + 8 cycle instrution load = 40920 x 61.0948ns = 2.499999216mS  timer 1 clock tick   (  16mhz int = 39992 + 8cycle = 40000 x 62.5ns = 2.5ms) 
    TimerConst = 65536 - TimerConst  ; set value for timer1 preload
                                                               
    ;-----------------  ADD TimerConst to TMR1H:TMR1L -------------------------
    ADD2_TIMER   macro
         BCF     T1CON,TMR1ON, 0       ;  1 Turn off timer
         MOVLW   LOW(TimerConst)       ;  1
         ADDWF   TMR1L,F, 0            ;  1    
         BTFSC   STATUS,C              ;  1/2
         INCF    TMR1H,F, 0            ;  1
         MOVLW   HIGH(TimerConst)      ;  1
         ADDWF   TMR1H,F, 0            ;  1
         endm
    
    ; -----------------  ADD TimerConst to TMR1H:TMR1L and restart TIMER1 ------
    RELOAD_TIMER  macro
         ADD2_TIMER
         BSF     T1CON,TMR1ON, 0       ;  1   Turn TIMER1 back on  (8 cycles)
         endm
    
    ; -----------------  Load TimerConst into TMR1H:TMR1L ----------------------
    LOAD_TIMER  macro
         MOVE?CT  0, T1CON,TMR1ON
         MOVE?CB  0, TMR1L
         MOVE?CB  0, TMR1H
         ADD2_TIMER
         endm
     ENDASM

  2. #2
    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

    On the Q43 (and most recent PIC18's with the VIC), the SFR registers have been moved down in memory starting at BANK 0,
    so general purpose RAM no longer starts there. The access bank used to be part of that, but no more.

    For the Q43, the access RAM is now at 0x500-0x55F, and the SFR access bank is 0x460-0x4FF.
    Anything located outside those addresses require the bank select register (BSR) to be set appropriately.

    Many asm instructions have a ", a" field at the end, where 'a' specifies the RAM access bit:
    a = 0: RAM location in Access RAM (BSR register is ignored)
    a = 1: RAM bank is specified by BSR register

    The TMR1 registers are located in bank 3, so you can't use asm instructions that end in ", 0" to access them.
    You'd have to set the BSR with a 'movlb' (or use mpasm 'BANKSEL reg') and change the ", 0" to ", 1" (or drop it off).
    If you don't specify the ", a" part MPASM is usually pretty good at figuring out when it needs a = ", 0", or ", 1", but it's up to you to set the BSR if needed.

    Datasheet sections 44 (Instruction Set Summary) and section 46 (Register Summary) have all the info you need, once you get your head wrapped around how it works.


    So, looking at your timer macros LOAD_TIMER is probably ok since the 'MOVE?xx' macros set the BSR, but if the other two are used on their own they'll need to change (adding instructions which will change the timing).

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


    Did you find this post helpful? Yes | No

    Default Re: PIC18FxxQ43 Version of DT_INTS

    ok tubleweed ,

    will try some add in commands for timer 1

    hope you shine a light on the low priority ints problem

    cheers

    sheldon

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


    Did you find this post helpful? Yes | No

    Default Re: PIC18FxxQ43 Version of DT_INTS

    Hi guys

    is there any further tests i can do to help solve the low priory ints problem on the q43 chip

    cheers

    sheldon

  5. #5
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: PIC18FxxQ43 Version of DT_INTS

    Not really that I can think of.

    I thought I'd try and load it into MPLABX so I could debug it, but it's been so long since I've used it w/PBP I can't seem to get the two so I can build and debug in MPLABX.
    Using MPLABX 5.35 w/ PBP 3.1.4, a simple blinky program builds ok with the commandline, but even though it builds in MPLABX it fails the MPLABX make process so it won't load it.

    I don't remember what makes the two happy...

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: PIC18FxxQ43 Version of DT_INTS

    I don't remember what makes the two happy...
    You need to travel back in time ten years , last known semi workable setup was with mplabx 2.35
    Warning I'm not a teacher

  7. #7
    Join Date
    Aug 2011
    Posts
    453


    Did you find this post helpful? Yes | No

    Default Re: PIC18FxxQ43 Version of DT_INTS

    I don't need the editor to work or anything... just be able to compile and load it so I can debug, even at the asm level.
    I thought that part still worked, but maybe I'll try treating it as an asm project and do it that way.

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