MPLAB Assembly error

Discussion in 'Programmer's Corner' started by MaxHeadRoom, Jan 27, 2015.

  1. MaxHeadRoom

    Thread Starter Expert

    Jul 18, 2013
    10,571
    2,382
    Anyone have an idea on trouble shooting this error after single stepping through routine?
    Pic18f23k22
    Or any usual cause?
    CORE-E0002: Stack under flow error occurred from instruction at 0x0000be
    Max.
     
  2. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,693
    2,765
    That would be a return without a call, or entry into an ISR without an interrupt.

    Can you show your code?
     
    MaxHeadRoom likes this.
  3. MaxHeadRoom

    Thread Starter Expert

    Jul 18, 2013
    10,571
    2,382
    You could have been a bit faster!;)

    Thanks:cool:
    Max.
     
  4. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,693
    2,765
    I just had the same error 3 days ago, also on a 23k22...

    Nice chip, btw.
     
    MaxHeadRoom likes this.
  5. MaxHeadRoom

    Thread Starter Expert

    Jul 18, 2013
    10,571
    2,382
    Correctamungo. a section of code segued into a call routine!!
    Thks again.
    Max.
     
  6. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,693
    2,765
    No probs.
     
  7. MaxHeadRoom

    Thread Starter Expert

    Jul 18, 2013
    10,571
    2,382
    Is there any way in MPLAB to record or indicate the amount of cycles for a particular piece of code, without stepping through and counting?.
    If it is there, I don't seem to find it.
    Max.
     
  8. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,699
    907
    Stopwatch? It is in the debugger dropdown.

    upload_2015-1-27_17-40-36.png


    John
     
    Last edited: Jan 27, 2015
    MaxHeadRoom likes this.
  9. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,693
    2,765
    What jpanhalt said.

    I have found that good code rarely requires counting clock cycles except in cases where timing is of critical importance, and then I usually let the peripheral hardware take care of the timing for me.

    If you find yourself counting cycles often, you may be doing something wrong.

    OTOH, I often use the stopwatch to verify proper settings for timers and other hardware.
     
  10. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,699
    907
    Three places I found it helped were:
    1) Working on some issue with software UART;
    2) Figuring out how much data I could send between interrupts (kind of a redundant calculation); and
    3) Comparing various versions of code for the same function.

    I got in the habit of checking cycles, because I noticed so may posts on PicList show that metric, and it is incredibly easy to do when debugging. It takes no more time.

    John
     
    MaxHeadRoom likes this.
  11. MaxHeadRoom

    Thread Starter Expert

    Jul 18, 2013
    10,571
    2,382
    Thanks, basically what i was looking to do.
    Max.
     
Loading...