An Introduction to the MPLAB IDE ( En528144 )
-
Upload
gautam-monipatro -
Category
Documents
-
view
219 -
download
0
Transcript of An Introduction to the MPLAB IDE ( En528144 )
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
1/39
Page 1
Microchip Technology IncorporatedMicrochip Technology Incorporated
An Introduction to the
MPLAB
Integrated DevelopmentEnvironment
This seminar is an introduction to the MPLAB Integrated DevelopmentEnvironment.
My name is Darrel Johansen and Im a manager for the DevelopmentSystems Group here at Microchip Technology.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
2/39
Page 2
2An Introduction to MPLAB IDE
What Is MPLAB IDE?
MPLAB IDE is a software program that runson your PC to provide a development
environment for your embedded system
design.
www.microchip.com/mplab
What is MPLAB IDE?
MPLAB IDE is a software program that runs on your developmentenvironment for your embedded microcontroller design.
You can download MPLAB IDE for free at microchip.com/mplab.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
3/39
Page 3
3An Introduction to MPLAB IDE
Design Cycle
1. High Level Design2. Software Coding
3. Generate Executable
4. Test
5. Burn into Device
The design cycle for developing an embedded controller application is:
1) Do the high level design From the features and performance desired,decide which PICmicro or dsPIC device you need, then design theassociated hardware circuitry.
2) Knowing which peripherals and pins control your hardware, write thesoftware. Use either assembly language, which is directly translatable intomachine code, or using a compiler that allows a more natural language forcreating programs. With these Language Tools you can write and edit codethat is more or less understandable, with constructs that help you organizeyour code.
3) Compile or assemble the software using a Language Tool to convert yourcode into machine code for the PICmicro device. This machine code willeventually becomes firmware, the code programmed into the microcontroller.
4) Test your code. Usually a complex program does not work exactly theway you might have imagined, and bugs need to be removed from your
design to get it to act properly.5) Burn your code into a microcontroller and verify that it executes correctlyin your finished application.
This seminar will show you how MPLAB can do steps 1 through 4.
Step 5 will require some hardware and will be covered in another seminar.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
4/39
Page 4
4An Introduction to MPLAB IDE
First Project
Create Project
Build Project
Test Code with Simulator
This exercise will show you how to put together a project framework, how to build anapplication, and
how to test it with the simulator to verify that it works as expected.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
5/39
Page 5
5An Introduction to MPLAB IDE
MPLAB Desktop
After you have downloaded and installed MPLAB IDE, you can start it up,and youll see a standard windows graphical user interface
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
6/39
Page 6
6An Introduction to MPLAB IDE
MPLAB Desktop
Menus
with menus
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
7/39
Page 7
7An Introduction to MPLAB IDE
MPLAB Desktop
Toolbar
toolbar icons
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
8/39
Page 8
8An Introduction to MPLAB IDE
MPLAB Desktop
Status
Bar
and a status bar.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
9/39
Page 9
9An Introduction to MPLAB IDE
MPLAB Desktop
To get started, well use the Project Wizard, which is selected from theProject menu.
Many of our development boards and starter kits come with finished projectsthat you can load and examine.
The Project Wizard makes it very easy to set up a new project.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
10/39
Page 10
10An Introduction to MPLAB IDE
Create A Project
The first thing the wizard asks for is to define which processor you are using.Well use one of the 16-bit dsPIC Digital Signal Controllers for this project.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
11/39
Page 11
11An Introduction to MPLAB IDE
Project Wizard
If you have installed any C compilers, they will show up in this list. If not, youmay only see the free assemblers that come with MPLAB IDE. Note that allof Microchips C Compilers can be downloaded for free evaluation.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
12/39
Page 12
12An Introduction to MPLAB IDE
Project Wizard
Next well browse to the folder to store our project and name it ProjectX.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
13/39
Page 13
13An Introduction to MPLAB IDE
Project Wizard
We have already written the code for this project, so we simply add them toour project, selecting them from the left file listing
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
14/39
Page 14
14An Introduction to MPLAB IDE
Project Wizard
and pressing the Add>> button
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
15/39
Page 15
15An Introduction to MPLAB IDE
Project Wizard
to make them show up in the right pane..
If you had not written any code yet, you easily can add files to the projectlater.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
16/39
Page 16
16An Introduction to MPLAB IDE
Project Wizard
And thats all there is to creating the project. The summary screen tells usthat were using a dsPIC33 processor with MPLAB C for the PIC30 (alsocalled C30), and that the project is in a folder on drive C:.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
17/39
Page 17
17An Introduction to MPLAB IDE
Wizard
When we exit the project wizard, the project window will look like this.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
18/39
Page 18
18An Introduction to MPLAB IDE
Wizard
If the project window is not shown, pull down the View menu and select theproject window.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
19/39
Page 19
19An Introduction to MPLAB IDE
Select Simulator
In order to test the code, we need a debug tool. MPLAB SIM is a debug tool.It is software simulator that can be used to test code on the PC.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
20/39
Page 20
20An Introduction to MPLAB IDE
Select Simulator
Select the Debugger Tool pull down menu
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
21/39
Page 21
21An Introduction to MPLAB IDE
Select Simulator
..scroll over to Select Tool and the submenu will pop up so we can selectMPLAB SIM.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
22/39
Page 22
22An Introduction to MPLAB IDE
Build Project
Now we can build the project by selecting Build Project under the projectmenu pull down
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
23/39
Page 23
23An Introduction to MPLAB IDE
Build ProjectOr
or use the Build All icon from the tool bar. The output window will pop upand tell us if the project built correctly.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
24/39
Page 24
24An Introduction to MPLAB IDE
Set Init ial Breakpoint
Double
click
If we double click on the file named main.c in the project window, it willopen in the programmers text editor window. Here, we scrolled down to thefunction, main.
Using the right mouse button, we set a breakpoint two lines into the function,as indicated by the red symbol with a B.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
25/39
Page 25
25An Introduction to MPLAB IDE
Run To Breakpoint
Next we select Run from the Debugger menu
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
26/39
Page 26
26An Introduction to MPLAB IDE
Run To BreakpointOr
or the green arrow on the tool bar.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
27/39
Page 27
27An Introduction to MPLAB IDE
Set Init ial Breakpoint
Now we can single step through the code from our breakpoint. Use theDebugger menu pulldown
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
28/39
Page 28
28An Introduction to MPLAB IDE
Set Init ial BreakpointOr
or the toolbar icon to step.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
29/39
Page 29
29An Introduction to MPLAB IDE
Set Init ial Breakpoint
We can continue stepping through the code
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
30/39
Page 30
30An Introduction to MPLAB IDE
Set Init ial Breakpoint
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
31/39
Page 31
31An Introduction to MPLAB IDE
Set Init ial Breakpoint
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
32/39
Page 32
32An Introduction to MPLAB IDE
Set Init ial Breakpoint
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
33/39
Page 33
33An Introduction to MPLAB IDE
Watch Window
And thats how to get started. If you want to look at variables and theirvalues, you can open the Watch window, which is on the View pulldown, andadd variables to be viewed.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
34/39
Page 34
34An Introduction to MPLAB IDE
Summary: The Next Step
Other main debugging features: Step-Into/Step-Over
Once you are familiar with these basic steps, you are ready to go on toexplore the power of the MPLAB tool.
You might wish to explore the difference between Step-Into and Step-Over.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
35/39
Page 35
35An Introduction to MPLAB IDE
Summary: The Next Step
Other main debugging features: Step-Into/Step-Over
Trace
As an alternative to breakpoints, you can choose to trace your code with arecord of instruction execution
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
36/39
Page 36
36An Introduction to MPLAB IDE
Summary: The Next Step
Other main debugging features: Step-Into/Step-Over
Trace
Change variable in Watch window
You can change variable values in the Watch window to see the effects onyour application
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
37/39
Page 37
37An Introduction to MPLAB IDE
Summary: The Next Step
Other main debugging features: Step-Into/Step-Over
Trace
Change variable in Watch window
Complex breakpoints
And you can set complex breakpoints on particular variable values orsequences of events.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
38/39
Page 38
38An Introduction to MPLAB IDE
Summary: The Next Step
Other main debugging features: Step-Into/Step-Over
Trace
Change variable in Watch window
Complex breakpoints
Many, many other features:
Tabbed editor
Color highlighted text
Version control support
Macros
Custom hot keys
Free C compilers
Powerful plug-ins
Mouse over variable
Stimulus generator
Dockable windows
HW Debuggers
Programmers
Third party tools
Data Monitor and Control Interface
Stopwatch
Code coverage
There is a lot more to MPLAB than weve covered here. Some features arelisted here. All are covered in the on-line documentation that comes withMPLAB.
Once you have the basics mastered, its easy to explore and find valuable
tools to assist in your development efforts.
-
8/13/2019 An Introduction to the MPLAB IDE ( En528144 )
39/39
39An Introduction to MPLAB IDE
Download MPLAB and TryIt!
WWW.MICROCHIP.COM/MPLABWWW.MICROCHIP.COM/MPLAB
If you havent already done it, now is the time to get started with MPLABIDE.
For an overview of more of Microchips development tools, you might wish toview the web seminar titled An Introduction to Microchips DevelopmentTools.
To get MPLAB for free, simply go to our web site at microchip.com/mplab.
This is the end of our presentation.
Thank you for your time.