• AVR Freaks

Hot!How to use PICKIT3 to Debug

Author
asWINth
Life is all 0s & 1s
  • Total Posts : 19
  • Reward points : 0
  • Joined: 2016/10/31 03:46:41
  • Location: 0
  • Status: offline
2016/12/03 03:03:16 (permalink)
0

How to use PICKIT3 to Debug

Hi guys,
 
I have a pickit 3 and I work with PIC 8-bit MCU's like PIC16F877A,PIC18F4520,PIC18F45K80 and also some lower range IC's like PIC16F676 etc....
IDE : MPLABX
Compiler: XC8
 
I read that PICKIT 3 can be used for debugging purpose, but how am I suppose to do it? I cannot find any documentation to help me. 
 
I cannot offered to buy a ICD 3 or real ICE, being a self hobbyist. I have used Arduino for a long time now, so till now I am using USART of PIC for my debugging purpose. But I find it time consuming, what is the best and effective way to do this. 
 
I wish I can perform the following debugging 
1. Display the value stored in a variable, like an ADC value.......
2. Write a value to a variable while the program is being executed ....
 
 
Thanks in advance
 
#1

12 Replies Related Threads

    DarioG
    Allmächtig.
    • Total Posts : 54081
    • Reward points : 0
    • Joined: 2006/02/25 08:58:22
    • Location: Oesterreich
    • Status: offline
    Re: How to use PICKIT3 to Debug 2016/12/03 03:34:30 (permalink)
    0
    Yes, you can use it as a Debugger - it may have not-so-great performance but works!
     
    You just select it as a debugger, check that your device is supported, then compile for debugging (in MPLAB 8 or X) and then you can use breakpoints, start and pause, check variables...

    GENOVA :D :D ! GODO
    #2
    RISC
    Super Member
    • Total Posts : 6067
    • Reward points : 0
    • Status: offline
    Re: How to use PICKIT3 to Debug 2016/12/03 05:07:26 (permalink)
    +1 (1)
    Hi,
    there is a dedicated website for developers to learn how to use tools and products from Microchip :
    http://microchip.wikidot.com/
    Regards
     
    #3
    JorgeF
    Super Member
    • Total Posts : 3345
    • Reward points : 0
    • Joined: 2011/07/09 11:56:58
    • Location: PT/EU @ Third rock from the Sun
    • Status: offline
    Re: How to use PICKIT3 to Debug 2016/12/03 05:14:47 (permalink)
    +1 (1)
    Hi
     
    Bear in mind that debugging eats up some Flash and RAM resources and the Pickit will need to handle the ICSPCLK, ICSPDAT and MCLR lines.
     
    Also not all PICs have the debug hardware in place, for example the PIC16F676 doesn't. For that one you will need a special chip that comes in the form of a "debug header" (AC162052 for the 16F676).
     
    You wil find the relevant documentations here...
    http://www.microchip.com/DevelopmentTools/ProductDetails.aspx?PartNO=PG164130
     
    HIH
     
    Best regards
    Jorge
     
    #4
    RISC
    Super Member
    • Total Posts : 6067
    • Reward points : 0
    • Status: offline
    Re: How to use PICKIT3 to Debug 2016/12/03 05:49:24 (permalink)
    +1 (1)
    Hi,
    This is why it makes a lot of sense to use the latest PIC16F1xxx or PIC16F1yyyy because they always include on-chip debug ;=)
    External header is not anymore needed ;=)
    Regards 
    #5
    Mysil
    Super Member
    • Total Posts : 4130
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: online
    Re: How to use PICKIT3 to Debug 2016/12/03 08:14:04 (permalink)
    +1 (1)
    Hi,
    The 40 pin PIC16F877A that original poster is already using have debugger hardware on the chip,
    and may be debugged using MPLAB X (or 8) and PICkit 3.
    Also the PIC18 devices have In-Circuit Debug (ICD) via Two Pins.
    That leave only the PIC16F676 that cannot be debugged on it's own.
     
    Regards,
       Mysil
    #6
    Simone190788
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2021/02/25 08:31:31
    • Location: 0
    • Status: offline
    Re: How to use PICKIT3 to Debug 2021/02/28 11:52:42 (permalink)
    0
    That's interesting for me! I am using a PIC16F18855 with the Microchip Evaluation Board and I have some problem debugging my code:
     
    I connect the board to the PC through the USB port, open the MPLAB X IDE, load my project and press the debug icon.
    it build successfully and the debug starts, but it starts like a simulator, does not seems to load my code in the target MCU. 
     
    In fact, for example I tried to force a digital input high connecting it to 3.3V. The input pin was a LED and it correctly light up, but in the Watches window of the debug I always see that input to 0. If i cannot see the correct values of the variables in that window, I cannot debut more complex projects...
     
    Do you think that my PIC still has on-chip debug? Can you help me understanding what I am doing wrong?
     
    Thanks for reply,
     
    #7
    ric
    Super Member
    • Total Posts : 30244
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: How to use PICKIT3 to Debug 2021/02/28 12:25:54 (permalink)
    +1 (1)
    That usually implies the pin is in analog mode. Any pin which is analog capable will power up in analog mode, and it is your job to switch it to digital mode. This is documented in every PIC datasheet.

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #8
    RISC
    Super Member
    • Total Posts : 6067
    • Reward points : 0
    • Status: offline
    Re: How to use PICKIT3 to Debug 2021/02/28 15:58:41 (permalink)
    0
    Hi,
    Do you own the DM164140 evaluation board .
    If so, this board is actually meant to be used with MPLABXPRESS cloud version.
    It does NOT have debug capabilities under MPLAB X. 
    To debug PIC16F18855, it is better to use HPC curiosity
    You will need also to order PIC16F18855 as it is not shipped together with HPC curiosity
    Regards
     

    For support make sure to check first here : http://microchipdeveloper.com
    There are hundreds of PIC, AVR, SAM...which one do YOU use ?
    #9
    domble
    Super Member
    • Total Posts : 201
    • Reward points : 0
    • Joined: 2007/01/25 04:11:53
    • Location: UK
    • Status: offline
    Re: How to use PICKIT3 to Debug 2021/03/01 02:16:58 (permalink)
    0
    I'm not sure if you're expecting 'live' display (and editing) of variables, while the code is running?  None of the 8 bit PICs can do that - you need to run in debug mode, then pause the running code so the debugger can read back the variables.  While the code is paused you can read and write registers and variables in the PIC, while running all you can do is hit a previously set breakpoint or manually press the pause button again.
     
    I think some PIC32 with newer debuggers have some sort of serial data watching output.. never used it... generally for watching 'live' variables I'd use a UART output.
     
    dom.
    #10
    ric
    Super Member
    • Total Posts : 30244
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: How to use PICKIT3 to Debug 2021/03/01 02:22:54 (permalink)
    0
    I think RISC has identified the main problem.
    Of course, it's only guesswork, as "the Microchip Evaluation Board" doesn't tell us much, there are dozens of them.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #11
    surfer
    New Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2021/03/02 06:06:06
    • Location: 0
    • Status: offline
    Re: How to use PICKIT3 to Debug 2021/03/03 10:51:14 (permalink)
    0
    I could be wrong, but:
    first thing you need understand whether your pickit3 is original or not,
    for example, I have a non-original version,
    and if my memory serves me, using pickit 3 it is impossible to step by step check the program for old chip models, for this, if I am not mistaken, there is a special adapter DEBUG HEADER AC162061.
    now also on sale pikkit4 and pg164100.
    pg164100 can program PIC, AVR, and SAM Flash MCUs, dsPIC, DSCs.
    but, if you can output data through the uart port to a PC,
    parameters such as ADC, variable, text, to serial monitor, as in arduino,
    then you will receive your debug module.
    #12
    ric
    Super Member
    • Total Posts : 30244
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: How to use PICKIT3 to Debug 2021/03/03 14:16:25 (permalink)
    +1 (1)
    surfer
    I could be wrong, but:
    first thing you need understand whether your pickit3 is original or not,
    for example, I have a non-original version,
    and if my memory serves me, using pickit 3 it is impossible to step by step check the program for old chip models, for this, if I am not mistaken, there is a special adapter DEBUG HEADER AC162061.

    Yes, you are wrong.
    The requirement for a header like the AC162061 is determined by what PIC you are debugging, not if your PK3 is genuine or not.
    (That particular header is only required for PIC18F45J10. The PIC16F18855 asked about in the most recent question most certainly does NOT need a header)
     

    now also on sale pikkit4 and pg164100.
    pg164100 can program PIC, AVR, and SAM Flash MCUs, dsPIC, DSCs.

    If a PIC required a header with a PK3, it would still require it with a PK4.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #13
    Jump to:
    © 2021 APG vNext Commercial Version 4.5