The author completed his final year engineering project with the dsPic micro-controllers, gaining extensive insight in these devices.
To get you up and running with the Pic micro-controllers for the first time, you need to settle these three things.
- Find a programming device.
- Decide a development tool-chain.
- Learn how to program the code.
All the PIC and dsPic devices can be easily programmed by the PicKit™ as the programmer and debugger.
Microchip's latest Integrated Development Environment, the Mplab-X® is the recommended development tool-chain for all PIC devices.
What is PicKit?
PicKit is an integrated programmer and debugger, developed by Microchip to program its microcontrollers. The PicKit provides the following functionalities to its users:
- Debugger with provision of 2 breakpoints.
- 3 channel Logic analyzer.
- UART receiving and transmitting interface.
- May also be used as a smooth, noise free 5 V and 3.3 V Vcc supply for the micro-controller.
Programming a Pic Microcontroller
This is a very simple three step process.
- Make the necessary connections between the micro-controller and the PicKit™ required for programming.
- Select the programming tool from within Mplab-X IDE.
- Build and load the code.
1: Connection Required for Programming a PIC and dsPic
Following connections are required to be made with the PicKit programmer:
Refer to datasheet of your target Pic device for specific pin numbers.
|Pin Number on the PicKit Programming Header||Corresponding Micro-controller Pin|
1 (to be identified by an arrow printed on device)
Vdd (There may be 2-3 Vdd pins on one Pic device.)
Vss (Can also be more then one.)
ICSPDAT / PGD
ICSPCLK / PGC
2: Selecting the Programmer in Mplab-X
Programmer can be selected while you are creating a new project in the Mplab-X®. In step three of new project wizard, you will see a list of devices which can be used and the serial number of your attached device (if plugged in).
3: Build and Load the Code from Mplab-X
After selecting the programmer you have to build and load the code into the target device. This can be done by clicking on the green arrow in the top menu bar. Make sure your code is error free before doing that.
To get you up and running fast you can use this LED blinking code to instantly test the code uploading procedure.
LED Blinking Code for dspic Microcontroller
© 2017 StormsHalted
StormsHalted (author) from Karachi, Pakistan on March 16, 2018:
delay 32 takes number of instruction cycles as input. delay takes a time value as input and converts it to instruction cycles and then feeds it to delay 32 inside the function.
kerbila manar on March 16, 2018:
please , can you explain to me what does it mean delay 32 , and what is a defferent between delay .thank you .