How to Program a PIC® MCU with PICkit™ 4 In-Circuit Debugger
HTML-код
- Опубликовано: 10 фев 2025
- Have you ever wondered how to flash a PIC MCU? This brief tutorial will show you how to program a PIC microcontroller with the PICkit 4 In-Circuit Debugger. This means you may no longer need to purchase full development boards for your projects, which can greatly help reduce the cost and size of your application.
For more information, visit:
Check out the PICkit4 Here: mchp.us/2ZL4nmF
www.microchip....
Thanks Ricky. A simple, clear explanation on how to use and program a PIC device.
Amazing explanation! Couldn't have said it better. Thank you!
Great video! Don't know why I haven't tried PIC before!
This is not all. For example, the functions Output_SetHigh(); and low, are undefined. Should be a header somewhere?
What about pic24f32ka302? Truly spoken, I bought pickit 4 when it was released. I also have pickit 3 and some pic microcontrolers. I don't know how to use them. Is there any board which makes them look like arduino?
Hi Alfred,
A PIC microcontroller's device pin allocations, internal device architecture and programming language differ from AVR devices typically found on Arduino boards.
Available Arduino boards such as the UNO R3 use Arduino's IDE to program the specific board's device. The UNO R3 has an ATmega328P chip device installed in the board's socket. This ATmega328P chip is an AVR device from Microchip. This chip has a specific 28 pin allocation which determines the board's PCB design, this differs from a 28 pin PIC device pin allocation such as the PIC24f32KA302.
The PICKIT3/4 is used with Microchips free MPLAB X IDE and XC compilers, this is a whole differrent environment to the Arduino IDE and programming language style, so you will have a steep learning curve but it is worth it and this takes time. You will be able to program the PIC devices using the PICKIT3/4 programmer/debuggers with MPLAB X IDE installed and the specific C compiler which must match your device. The PIC24f32KA302 is a 16 bit device so the XC16 compiler needs to be installed after installing the MPLAB X IDE.
Once you have both MPLAB X IDE and XC16 compiler installed you will then be able to setup connections to the device on a breadboard as demonstrated in this video and program the device successfully. There are also development boards available allowing various pin count devices to be installed and programmed. The XC16 compiler is vastly different to the Arduino style programming, but all PIC device datasheets have C and Assembly code examples so making the transition to switch from Arduino is a wise decision.
Note that AVR devices originally designed and supplied by Atmel (Purchased by Microchip) also can be programmed in C or Assembly. This C and assembly style differs from the PIC compilers and Assembly.
I decided to move to MPLAB X IDE and compilers and Assembler to gain better understanding of the PIC device and access functionality with no "black box" in between. I chose the Micro-X PIC development board from Embedded Results t/a Kanda.com to start my journey as this board allows programming of 8, 14, 20 28 and 40 pin PIC devices, the kit comes with the PICKIT4 programmer. It is a bit pricey but the many various features are worth it. Kanda also starts with Assembly language, which is referred to in datasheets on even the newest devices, so important to be able to use if to fully understand the device. This is a low level language which is fast and efficient but not intuitive to beginners. The the programming process still converts the final code into a hex file and along the way uses the assembly files before the conversion.
Good luck in your transition.
What if there is no ICDSPDAT pin on the micro-controller's spec sheet, such as aPIC24F32KA302?
Would you use pin 4's PGED1, as well as tie in pin21-PGED2, and pin14-PGED3, on the same line going to the same port on the PicKit4 Programmer, at the same time?
The PIC24F32KA302 also has additional Vss and Vdd pins on pins 27 and 28, how does that work? Do you have to also tie them into the relevant ports of the PicKit4 at the same time by brigding some wire or something?
Thanks.
did you figure it out?
He sounds like the burger king commercial guy
No explanation of indicator lights on Pickit-4 during programming process.
I'm struggling to get it to work with PIC24FJ256GA702, who do I ask for help?
Why is this not called ICD4? I've been using ICDs from the very beginning, so why the change?
I remember when 8-bit PICs had 100 pages long datasheets and could be programmed by Assembly alone because of the simplicity. Today we need quite expensive programmer (80$), architecture is more complex and datasheets are 500+ pages long and less clear.
There is no advantage to program PICs over ARM platforms :'(
My PICkit4 doesn''t program any PIC18/PIC16 microcontroller> All the time I have an issue regardig ID device is 0 and don't recognize the microcontroller> Please help me.
Criss, provide part numbers of the PIC 16 and PIC18 devices.
@@PICMICRO PIC18F27Q10, PIC 18F27K42. The problem is with PicKit4 programmer, the PGD and PGC was broken. Is the secod one PICKit4 that breaks down inexplicably. Please review the hardware, I saw that you have buffers for these pins.
@@crissb9357 Hi Criss, are you attempting to program these devices on a breadboard or are you using the two Curiosity Nano boards that have the two PIC devices mentioned?
How does this work on Linux?
Hi there, thanks for your question! This device is compatible with Linux, Windows 7 or later and MacOSX. You will need to use the compatible IDE - MPLAB X IDE V6.20 is our latest version. However, the PICkit4 is EOL and we do recommend moving to the PICkit 5 or the ICD5.
@@MicrochipDeveloperHelp Thank you for the quick reply. Is there a trustworthy distributor of the product in Brazil? It seems almost impossible to get them here.
Please can someone hep me with hardware connections for AVR128DB64 chip
Abdul, here's some information I gathered, I'd suggest you verify this all with a case to technical support. You need a Microchip account to log on and then you able to open a case asking about your connections.
See link for PICKIT4 pin connections to UPDI for your AVR128DB64 www.avrfreaks.net/forum/pickit-4-and-avr-mcu
See device manual "AVR128DB28-32-48-64-DataSheet" Microchip document number DS40002247A page 17 of 660 for 64 pin device connections and pg 24 for Figure 4-5. Recommended UPDI Programming Circuit Schematic
PICKIT4 Pin AVR128DB64
#2 (VDD) # 6 & 56 (Note: For the AVR® Family of devices, AVDD is internally connected to VDD (not separate power domains).
#3 (VSS) GND # 7, 21, 35 &57 (All Ground pins connected.)
The decoupling capacitor between VDD and GND must be placed as close to the pin pair as possible. The decoupling capacitor must be included even if the UPDI connector is not included in the circuit. See page 24 of 660 for Typical values.
#4 PGD # 51
Normally a 100-mil 6-pin 2x3 connector is used for connections to the device, what development board are you using with the AVR128DB64?
@@PICMICRO finally I got it worked with ardiuno nano, with two wires, thanks for your link
Ok, I understood this but I'd like to use mplab IPE. I can't even connect my pick it 4... I'm afraid of asking this... I don't know why I think this is a stup#id question and you may not know why am I having issues, but the options read, program etc are not available...
Hi there, thanks for reaching out. If the options like 'Read' or 'Program' aren’t available in MPLAB IPE, it could be due to the Pickit 4 not being properly connected or recognized. First, ensure that you’re using the latest version of MPLAB IPE and that your Pickit 4 firmware is up to date. Also, double-check the connections to your target device to make sure they're correct and secure.
If everything seems fine and it’s still not working, try running MPLAB IPE as an administrator on your computer to rule out permission issues. If you're still stuck, our technical support team at Microchip.com/CSS is here to help troubleshoot further.
@@MicrochipDeveloperHelp thanks, I'll try this, I hope it works!
Thanks Ricky. A simple, clear explanation on how to use and program a PIC device.