Get error trap address

General discussion on mikroBasic PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
arco
Posts: 312
Joined: 15 Apr 2008 13:54
Location: The Netherlands

Get error trap address

#1 Post by arco » 13 May 2022 13:40

For an application with a 24FJ128GB108 I get Address Trap errors on irregular basis.
I want to trap the address where it happens and tried this code I found somewhere, but it doesn't return correct address, always 0x00000010

Code: Select all

Dim TrapAddr As LongWord

Sub procedure address() iv IVT_ADDR_ADDRESSERROR ics ICS_AUTO
  asm
    sub w15, #4, w0
    mov [w0++], w1
    mov w1, _trapaddr
    mov [w0], w1
    and #0x7f, w1
    mov w1, _trapaddr+2
  end asm
  AddrErr_bit = 0
end sub

What am I doing wrong?
How many words are pushed on stack before a trap call?
Regards,

Peter.

arco
Posts: 312
Joined: 15 Apr 2008 13:54
Location: The Netherlands

Re: Get error trap address

#2 Post by arco » 13 May 2022 17:10

This works! :D (seems 18 parms are pushed on stack...)

Code: Select all

 
Sub procedure address() iv IVT_ADDR_ADDRESSERROR ics ICS_AUTO
  asm
    mov w15, w0
    sub #36,w0
    mov [w0++], w1
    mov w1, _trapaddr
    mov [w0], w1
    and #0x007f, w1
    mov w1, _trapaddr+2
  end asm
  AddrErr_bit = 0
end sub
Regards,

Peter.

Post Reply

Return to “mikroBasic PRO for dsPIC30/33 and PIC24 General”