Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PicKit2 Debugger Problem?

Status
Not open for further replies.

ibwev

Member
I am using PicKit2 Debugger with Pic16F690. The debugger has worked great until a recent program change. I altered some code and troubleshot it using the MPLab Simulator. Once everything worked in the simulator, I uploaded the code to the Pic16F690 through the PicKit2 Debugger. After I compile the code and program the target device, the following problems occur:

1) The green arrow starts on address 21B rather than the RESET_VECTOR.
2) The instruction at 21B is suppose to go to 0x1C; instead, it goes to address 016 which is towards the end of the interrupt code. When the end of the interrupt code is reached, "retfie" sends the code to another subroutine.

What might cause this problem?
 
You can't debug a 16F690 with out a adapter ICD header. AND the rest of the story https://www.electro-tech-online.com/custompdfs/2011/12/51292S.pdf

And your thinking WHY DO I NEED A HEADER TO DEBUG read the PDF

And a little of the why
Some PIC® microcontrollers, particularly low pin count devices (with 20 pins or less),
generally must use a header for debugging. This is done to free up I/O lines for your
application and to make production parts more affordable
 
Thanks for the quick response. I am using HEADER INTRFC MPLAB ICD2 20PIN(AC162061) with ADAPTER RJ-11 TO ICSP (AC164110-ND). I bought the debugger a few months ago and it has worked with no problems until my most recent code update. Should I assume my adapter ICD header (AC164110-ND) is bad if all my connections appear good?
 
Without seeing your code it is impossible to suggest what the problem may be.

Write a simple flash LED program and see if that works.

Mike.
 
Mike right there no way to see then what's happening with out your code.

Make sure you have Configuration bits set right. Like so the chip can't reset it's self.And above all make sure you build for debugging

The last one is sometimes over looked
 
Mike right there no way to see then what's happening with out your code.

And above all make sure you build for debugging

I do the following steps before programming the pic
1) I make sure the Release/Debug window on MPLab is set to Debug
2) Debugger:Select Tool:pickit2
3) I either "make" or "build all" the project. (I am only compiling one .asm file)
4) Then I program the target device

Is this the correct procedure to "build for debugging"
 
12/23 morning
I attached a small sample of the code I am having a problem with. The code compiles but when debugging with PicKit2 the code seems to randomly jump following the first instruction. Sometimes it will goto the proper address and other times it will go to a seemingly random location.

Any suggestions of what might cause this problem?

.........
12/23 evening
I had a banksel mistake in the Init part of the program. I will correct the mistake and repost the code in the morning. I thought about it while I was at work.

.....
12/24 morning
Merry Christmas Eve!!!!
I corrected the banksel error and reattached the code. The program works in MPLab simulator but goes to the wrong instruction line following the "call Init" instruction when using the PicKit2 debugger. Any help as to why this is occurring would be greatly appreciated.
 

Attachments

  • DebugTest.ASM
    7.6 KB · Views: 133
Last edited:
You posted the code forget my post I can't debug a 16f690 I don't have the header maybe Mike can.

I'll look at your code when I get home from work.
 
Last edited:
I have found another piece of the puzzle which may help solve the problem I am having. If I reset the device immediately after making and programming the taget device, everything seems to work as expected. Why does the pic need to be reset to work properly?

I have attached a smaller code than the DebugTest.asm file. It's a flashing led. I was experiencing the same problem in both DebugTest.asm and DebugTest2.asm.

I have to go help Santa put toys under the tree.
 

Attachments

  • DebugTest2.asm
    2.7 KB · Views: 131
I believe the problem has been solved. I updated MPLab to version 8.83 from version 8.63. PicKit2 debugger has been working as expected.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top