Slide Ads

Wednesday, July 8, 2009

Overview MPLAB IDE - MPLAB C30

MPLAB IDE
Paradoxically — considering its size and power — little
needs to be said about this renowned PIC microcontroller
development platform from Microchip. The reason
is simple: MPLAB has been around for many years now
and has matured into the de facto development platform
for PIC MCUs. The program, (or suite of utilities, really),
is comprehensive, user-friendly and marked by excellent
support not just by virtue of the Help file functions but also
through Microchip’s online Forum and technical support.
MPLAB Integrated Development Environment (IDE) is a
development platform for the Microchip Technology PIC
MCU and dsPIC® microcontroller families.
MPLAB IDE includes the following components: MPASM™
Assembler; MPSIM™ software simulator; MPLINK™
linker; Source Level Debugger; On-line Help; Project and
set-up wizards; Project Manager; Visual Device Initializer;
Programmer’s Editor; drivers for various hardware tools.
Special versions of a number of utilities like the assembler
and linker, are supplied for the dsPIC30 devices.
With MPLAB IDE you can:
• write, build and debug source code;
• automatically locate errors in source files for editing;
• debug with breakpoints;
• single-step the program with software simulator,
in-circuit debugger or in-circuit emulator;
• view variables in watch windows;
• program code with certain programmers;
• find quick answers to questions using the MPLAB IDE
on-line help.
MPLAB looks rather dead when launched. To see some
action on the screen follow File ➞ Open Workspace and
then navigate to the ‘examples’ folder. Various projects
can be opened there. Although not very meaningful just
yet, they allow the newcomer to explore a large number
of functions without ‘serious consequences’.
Importantly, release notes for all utilities in MPLAB can be
found at Start ➞ All Programs ➞ Microchip ➞ MPLAB IDE
v. 7.50 ➞ Documentation. This screen also lists ‘install
and repair’ utilities.
Even an introductory discussion of the features packed
into MPLAB and the best way to use them for your PIC
projects would easily fill an entire magazine hence is beyond
the scope of this article. Not to worry, the complete
MPLAB Users Guide and various other pdf documents are
accessible via the CD-ROM install screen under ‘View
Design Series Literature’. Plus, there’s MPLAB Getting
Started.
MPLAB C30
The free Explorer-16 CD-ROM contains the student edition
of the Microchip C30 compiler, version 2.05. This is
a fully functioning C compiler for the first 60 days after
which a number of the cleverest optimisations are disabled.
If you start using the C30 compiler now, you will
have a full version of the product all the way till the third
article instalment.
The functions disabled after 60 days are described by
Microchip as: ‘procedural abstraction’ and ‘optimisation
options -02, -03 and –Os’. Not too worrying, we’d say.
Everything else works the same as the full version and
with the huge memory capacity on the PIC24F128 used,
code size optimisation is unlikely to become a problem.
Of course, you are free to use C30 for any smaller 16-bit
PIC MCU or dsPIC® DSC you may have available, just
give it a try.
The student edition of C30 may be upgraded to a full edition
by purchasing a licence key from Microchip. Good
news: with the publication of the February 2007 issue,
buyers of the Explorer-16 Development Board will be able
to purchase the full version of C30 at a discounted price
by returning a voucher enclosed in the box.
MPLAB C30 seems to be a lesser known ‘plug-in’ of the
MPLAB environment so a short introduction is given here
(realising that the real work starts with coding your own C
programs, compiling, debugging and finally transferring
them to a PIC — but stop, do your simulation first!).
MPLAB C30 is a fully ANSI compliant compiler with
standard libraries for all popular PICs including the latest
dsPIC® DSC devices. It is fully integrated with the MPLAB
IDE for high level debugging at the source code level.
This compiler comes complete with its own assembler,
linker and librarian to write mixed-mode C and assembly
programs and link the resulting object files into a single
executable file.
The MPLAB C30 library includes functions for string manipulation,
dynamic memory allocation, data conversion,
timekeeping, and math functions (trigonometric, exponential
and hyperbolic).
The ‘small code model’ offered by C30 takes advantage
of a more efficient form of call instructions, while the
‘small data model’ supports the use of compact instructions
for accessing data in SFR space.
Although C30 is embedded into the MPLAB environment,
you still be able to run it as a separate command line program.
Use the ‘Open Workspace’ menu item in MPLAB
and navigate to MPLAB C30 ➞ Examples ➞ MPLAB
Link30. The example ‘Locate_access_EEPROM’ is shown
in Figure 5 with the Program Memory and File Registers
viewers open.
The complete C30 Users Guide is accessible via the menu
on the CD-ROM, as discussed with MPLAB.

No comments: