DT_INTS for K42


Closed Thread
Results 1 to 30 of 30

Thread: DT_INTS for K42

Hybrid View

  1. #1
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557

    Default DT_INTS for K42

    I know it is a bit premature, but here is the custom tailored DT_INTS for the new PIC18FXXK42.
    DT_INTS-18_K42.bas

  2. #2
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS for K42

    I just realized I didn't finish the job. Kindly disregard the above attachment. There was no way of testing it (of course). Will have corrected version posted soon.

  3. #3
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS for K42

    Would love to delete the previous version. Here is the finished one.

    Attachment 8507

  4. #4
    Join Date
    Aug 2011
    Posts
    408


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS for K42

    I don't think that's going to work for the K42 (or the K83).

    The memory layout of the SFRs is significantly different in those. The MOVFF instructions can't access the SFR banks... you need to use the new MOVFFL instruction available on those cores.

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,388


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS for K42

    the latest attachment is not working.

    my 2 cents

    looks like the auto context saving for low p interrupts needs addressing too.

    if its going to fly the vectored isr capability should not be ignored .

    not quite sure about the MOVFFL issue
    sfrs in access bank should be ok.
    the others should respond to the appropriate banksel , I think .
    the few pieces of asm code example in the datasheets look fairly conventional in that reguard
    Warning I'm not a teacher

  6. #6
    Join Date
    Aug 2011
    Posts
    408


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS for K42

    The SaveFSR and RestFSR macros along with INT_CREATE_H, INT_CREATE_L, and INT_RETURN all use MOVFF to save the context.
    MOVFF can only address the first 4K of ram and the K42 is part of the new 18XV core devices that can address up to 16K of ram.

    In these new devices the SFR registers have been moved into the upper banks past where the MOVFF instruction can address.
    The new MOVFFL instruction has to be used in its place to address the full 14-bit ram space.

    I haven't used one of these yet but the whole context saving mechanism of dt-ints may not be needed with these.
    The new core includes a two-level deep context stack which saves the STATUS, WREG, BSR, FSR0/1/2, PRODL/PRODH and
    PCLATH/U registers automatically for you into the shadow register memory located in bank 56.

  7. #7
    Join Date
    Mar 2020
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Re: Compile Errors with DT_INTS for K42

    I am trying to use DT_INTS FOR K42 with a PIC18F27K42. I am familiar with using DT_INTS-18. Works perfectly with other PICs. However, I am receiving several errors when compiling with DT_INTS FOR K42. My PBP version is PBPX3.1.34. MPLABX is V5.30. The PBP test code simply configures comparator 1 and lights indicator LEDs to indicate if the voltage is above or below the reference voltage, and when the Comparator interrupt flag has been set or cleared. The test code works without the inclusion of DT_INTS-18K42b.

    However, I receive several compile errors when I add the following code to generate an interrupt on comparator 1:

    ;------------------ DT Instant Interrupts ------------------------
    wsave1 var byte $A0 system ;location for W if in bank0
    wsave2 var byte $120 system ;location for W if in bank0
    wsave3 var byte $1A0 system ;location for W if in bank0

    INCLUDE "DT_INTS-18_K42b.bas" ; Base Interrupt System
    INCLUDE "ReEnterPBP-18.bas" ; Include if using PBP interrupts


    ASM
    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler C1_INT, _CMP_1, PBP, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    INT_ENABLE C1_INT ; Comparator 1 interrupt
    ENDASM

    The interrupt handler is a simple counter. It serves no purpose other than testing.

    ;------------------[CMP1 - interrupt handler]------------------------
    CMP_1: ;Comparator triggered
    Ticks1 = Ticks1 + 1 ;Increment counter
    @ INT_RETURN




    When compiled, I receive three error messages "Found label after Column 1. (Save FSR)". Also the error messages: Illegal Nesting (ENDM); Expected (END); Expected (ENDM).

    Based on my read of the #Defines in DT_INTS-18_K42b.bas, and the PIC18F27K42 datasheet Summary of Registers for Interrupts, I think DT_INTS-18_K42b.bas should work with this PIC.


    Any suggestions for solving the problem will be appreciated.

    Dan

  8. #8
    Join Date
    Aug 2011
    Posts
    408


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS for K42

    The DT_INTS-18_K42b.bas file from post #9 won't work.

  9. #9
    Join Date
    Mar 2020
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS for K42

    Quote Originally Posted by tumbleweed View Post
    The DT_INTS-18_K42b.bas file from post #9 won't work.
    Thanks for the response. Do you know if the problem is with the DT_INTS-18_K2b file not being mapped properly to the PIC18F27K42 interrupt register, or is it that the PIC18F27K42 will not work with DT's Instant Interrupts? If it is a matter of correcting errors, I found the "How to make custom DT's Instant Interrupts" and can try an make the necessary edits.

  10. #10
    Join Date
    Aug 2011
    Posts
    408


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS for K42

    It's more than just a simple interrupt register issue. The asm instructions are wrong for the K42.

    See posts #4 and #6.

  11. #11
    Join Date
    Mar 2020
    Posts
    9


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS for K42

    Looks like crafting a working DT's Instant Interrupts for the PIC18F27K42 is well beyond my skill set. It may be time for me to learn to write ISRs using assembly language. In addition to the PBP3 reference manual discussion of Assembly Interrupts for PIC 18 Devices, can anyone suggest a good reference for someone who is not familiar with assembly language coding?

  12. #12
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS for K42

    I have also been using c for long time so far; I have been able to convert some Arduino libraries, too.
    The thing is, as mentioned earlier, moving from one compiler to another in c is much easier using the same code.

    However, dealing with the registers manually is not as easy as PBP;

    PBP is in my heart;
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  13. #13
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS for K42

    Microchip has online training that covers ANSI C, MPLABX, MCC, a long list of useful projects, and more:

    http://microchipdeveloper.com/training-self:start

    I have learned much from their training. I highly recommend it for those wishing to dabble in the mystical realm of MPLABX.

  14. #14
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,803


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS for K42

    Are there any updates regarding the K42 devices and DT-INTS ?

    Ioannis

  15. #15
    Join Date
    Aug 2011
    Posts
    408


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

    Default Re: DT_INTS for K42

    If you're feeling adventurous you could try the attached.

    It's a modified version of the DT_INTS-18_K42b.bas code from post #9 with the context save stuff removed (now done in hdw) and the MOVFF instructions replaced with MOVFFL, which is required in the K42 and K83 since the SFR's are outside the 2K boundary for the MOVFF instruction.

    It's completely untested...
    Attached Files Attached Files

  16. #16
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,803


    Did you find this post helpful? Yes | No

    Default Re: DT_INTS for K42

    Thank you tumbleweed.

    Will give it a try,
    Ioannis

Similar Threads

  1. Microchip Inconsistency (K42 related)
    By mpgmike in forum General
    Replies: 0
    Last Post: - 23rd November 2017, 18:44
  2. Dt_ints-14
    By iw2fvo in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th November 2013, 07:57
  3. Re: DT_Ints-18
    By Steve_88 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 4th March 2012, 18:39
  4. DT_INTs with 16F690
    By Dick Ivers in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 29th January 2010, 22:20
  5. Problem with DT_Ints-14
    By BobSpencerr in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 1st March 2007, 05:27

Members who have read this thread : 2

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