mikroC PRO for PIC32 is a full-featured C compiler for PIC32 MCUs
from Microchip. It is designed for developing, building and debugging
PIC32-based embedded applications. This development environment
has a wide range of features such as: easy-to-use IDE, very compact and
efcient code, many hardware and software libraries, comprehensive
documentation, software simulator, COFF le generation, SSA
optimization (up to 30% code reduction) and many more. Numerous
ready-to-use and well-explained examples will give a good start for
your embedded project.
Manual
Compiler
MikroElektronika
mikoC PRO for PIC32
Table of Contents
CHAPTER 1 30
INTRODUCTION 30
Introduction to mikroC PRO for PIC32 31
Features 31
Where to Start 31
Software License Agreement 32
mikroElektronika Associates License Statement and Limited Warranty 32
IMPORTANT - READ CAREFULLY 32
LIMITED WARRANTY 32
HIGH RISK ACTIVITIES 33
GENERAL PROVISIONS 33
Technical Support 34
How to Register 34
Who Gets the License Key 34
How to Get License Key 34
After Receving the License Key 36
CHAPTER 2 38
mikroC PRO for PIC32 38
Environment 38
Main Menu Options 39
File 40
File Menu Options 40
Edit 41
Edit Menu Options 41
Find Text 42
Replace Text 42
Find In Files 43
Go To Line 43
Regular expressions option 43
View 44
View Menu Options 44
Project 46
Project Menu Options 46
Build 47
Build Menu Options 47
Run 48
Run Menu Options 48
Tools 49
Tools Menu Options 49
Help 50
Help Menu Options 50
MikroElektronika
2
mikroC PRO for PIC32
mikroC PRO for PIC32 IDE 51
IDE Overview 51
Code Editor 52
Editor Settings 52
Auto Save 53
Highlighter 53
Spelling 53
Comment Style 53
Code Folding 53
Code Assistant 54
Parameter Assistant 54
Bookmarks 54
Go to Line 54
Column Select Mode 55
Editor Colors 55
Auto Correct 56
Auto Complete (Code Templates) 57
Memory Usage Windows 65
Variables 66
Used RAM Locations 66
SFR Locations 67
ROM Memory Usage 67
ROM Memory Constants 68
Functions 68
Functions Sorted By Name Chart 69
Functions Sorted By Size Chart 69
Functions Sorted By Addresses 70
Function Tree 70
Memory Summary 71
Divergence from the ANSI C Standard 136
C Language Extensions 136
Implementation-dened Behavior 136
Predened Globals and Constants 137
Predened project level denes 137
Accessing Individual Bits 138
sbit type 139
at keyword 140
bit type 140
5
MikroElektronika
mikoC PRO for PIC32
Interrupts 141
Conguring Interrupts 141
Single Vector Mode 141Multi Vector Mode 141
Interrupt Priorities 142
Interrupts and Register Sets 142
Register Set Selection in Single Vector Mode 142Interrupts and Register Sets 142
Interrupt Coding Requirements 142
Interrupt Service Routine 142
Function Calls from Interrupt 143
Interrupt Example 144
Pointer Declarations 203
Null Pointers 204
Function Pointers 204
Assign an address to a Function Pointer 204
Function Pointers 206
Assign an address to a Function Pointer 206
Pointer Arithmetic 207
Arrays and Pointers 207
Assignment and Comparison 208
Pointer Addition 209
Pointer Subtraction 210
Structures 210
Structure Declaration and Initialization 210
Incomplete Declarations 211
Untagged Structures and Typedefs 212
Anonymous Structures 212
Working with Structures 213
Assignment 213
Size of Structure 213
Structures and Functions 213
Managing Project Group 665
Add/Remove Files from Project 665
Project Level Denes: 666
Add/Remove Files from Project 667
Project Level Denes: 668
Source Files 669
Managing Source Files 669
Creating new source le 669
Opening an existing le 669
Printing an open le 669
Saving le 669
Saving le under a different name 670
27
MikroElektronika
mikoC PRO for PIC32
Closing le 670
Search Paths 670
Paths for Source Files (.c) 671
Paths for Header Files (.h) 671
Edit Project 672
Source Files 673
Managing Source Files 673
Creating new source le 673
Opening an existing le 673
Printing an open le 673
Saving le 673
Saving le under a different name 674
Closing le 674
Search Paths 674
Paths for Source Files (.c) 675
Paths for Header Files (.h) 675
Clean Project Folder 676
Compilation 677
Output Files 677
Assembly View 677
Creating New Library 678
Multiple Library Versions 678
Frequently Asked Questions 679
Can I use your compilers and programmer on Windows Vista (Windows 7) ? 679
I am getting “Access is denied” error in Vista, how to solve this problem ? 679
What are differences between mikroC PRO, mikroPascal PRO and mikroC PRO compilers ? Why
do they have different prices ? 679
Why do your PIC compilers don’t support 12F508 and some similar chips ? 679
What are limitations of demo versions of mikroElektronika’s compilers ? 679
Why do I still get demo limit error when I purchased and installed license key ? 679
I have bought license for the older version, do I have to pay license for the new version of the compiler ? 680
Do your compilers work on Windows Vista (Windows 7) ? 680
What does this function/procedure/routine do ? 680
I try to compile one of the provided examples and nothing happens, what is the problem? 680
Can I get your library sources ? I need to provide all sources with my project. 680
Can I use code I developed in your compilers in commercial purposes ? Are there some limitations
? 680
Why does an example provided with your compilers doesn’t work ? 680
Your example works if I use the same MCU you did, but how to make it work for another MCU ? 680
I need this project nished, can you help me ? 681
Do you have some discount on your compilers/development systems for students/professors ? 681
I have a question about your compilers which is not listed here. Where can I nd an answer ? 681
MikroElektronika
28
mikroC PRO for PIC32
29
MikroElektronika
mikoC PRO for PIC32
CHAPTER 1
INTRODUCTION
The mikroC PRO for PIC32 is a powerful, feature-rich development tool for PIC32 microcontrollers. It is designed to
provide the programmer with the easiest possible solution to developing applications for embedded systems, without
compromising performance or control.
mikroC PRO for PIC32 IDE
MikroElektronika
30
mikroC PRO for PIC32
Introduction to mikroC PRO for PIC32
The PIC32 is a 32-bit family of general purpose microcontrollers. This is the Microchip’s rst inherent 32-bit (data)
microcontroller family. It builds upon the MIPS M4K 32-bit core, offering high-performance hardware multiply/divide
unit, programmable user and kernel memory partition through an unied 4GB virtual memory space, with powerful
peripherals to address a wide range of applications.
Having a wide range of application, being prized for its efciency, PIC32 MCUs are a natural choice for developing
embedded systems. mikroC PRO for PIC32 provides a successful match featuring highly advanced IDE, ANSI compliant
compiler, broad set of hardware libraries, comprehensive documentation, and plenty of ready-to-run examples.
Features
mikroC PRO for PIC32 allows you to quickly develop and deploy complex applications:
- Write your source code using the built-in Code Editor (Code and Parameter Assistants, Code Folding,
Syntax Highlighting, Auto Correct, Code Templates, and more.)
- Use included mikroC PRO for PIC32 libraries to dramatically speed up the development: data acquisition,
memory, displays, conversions, communication etc.
- Monitor your program structure, variables, and functions in the Code Explorer.
- Generate commented, human-readable assembly, and standard HEX compatible with all programmers.
- Use the integrated mikroICD (In-Circuit Debugger) Real-Time debugging tool to monitor program execution
on the hardware level.
- Inspect program ow and debug executable logic with the integrated Software Simulator.
- Use Single Static Assignment optimization to shrink your code to even smaller size.
- Get detailed reports and graphs: RAM and ROM map, code statistics, assembly listing, calling tree, and more.
- Active Comments enable you to make your comments alive and interactive.
- mikroC PRO for PIC32 provides plenty of examples to expand, develop, and use as building bricks in your
projects. Copy them entirely if you deem t – that’s why we included them with the compiler.
Where to Start
- In case that you’re a beginner in programming the PIC32 microcontrollers, read carefully the PIC32
Specics chapter. It might give you some useful pointers on the PIC32 constraints, code portability, and
good programming practices.
- If you are experienced in C programming, you will probably want to consult mikroC PRO for PIC32
Specics rst. For language issues, you can always refer to the comprehensive Language Reference. A
complete list of included libraries is available at mikroC PRO for PIC32 Libraries.
- If you are not very experienced in C programming, don’t panic! mikroC PRO for PIC32 provides plenty of
examples making it easy for you to go quickly through it. We suggest that you rst consult Projects and
Source Files rst, and then start browsing the examples that you’re the most interested in.
Copyright (c) 2002-2010 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
31
MikroElektronika
mikoC PRO for PIC32
Software License Agreement
mikroElektronika Associates License Statement and Limited Warranty
IMPORTANT - READ CAREFULLY
This license statement and limited warranty constitute a legal agreement (“License Agreement”) between you (either as
an individual or a single entity) and mikroElektronika (“mikroElektronika Associates”) for software product (“Software”)
identied above, including any software, media, and accompanying on-line or printed documentation.
BY INSTALLING, COPYING, OR OTHERWISE USING SOFTWARE, YOU AGREE TO BE BOUND BY ALL TERMS
AND CONDITIONS OF THE LICENSE AGREEMENT.
Upon your acceptance of the terms and conditions of the License Agreement, mikroElektronika Associates grants you
the right to use Software in a way provided below.
This Software is owned by mikroElektronika Associates and is protected by copyright law and international copyright
treaty. Therefore, you must treat this Software like any other copyright material (e.g., a book).
You may transfer Software and documentation on a permanent basis provided. You retain no copies and the recipient
agrees to the terms of the License Agreement. Except as provided in the License Agreement, you may not transfer,
rent, lease, lend, copy, modify, translate, sublicense, time-share or electronically transmit or receive Software, media
or documentation. You acknowledge that Software in the source code form remains a condential trade secret of
mikroElektronika Associates and therefore you agree not to modify Software or attempt to reverse engineer, decompile,
or disassemble it, except and only to the extent that such activity is expressly permitted by applicable law notwithstanding
this limitation.
If you have purchased an upgrade version of Software, it constitutes a single product with the mikroElektronika
Associates software that you upgraded. You may use the upgrade version of Software only in accordance with the
License Agreement.
LIMITED WARRANTY
Respectfully excepting the Redistributables, which are provided “as is”, without warranty of any kind, mikroElektronika
Associates warrants that Software, once updated and properly used, will perform substantially in accordance with the
accompanying documentation, and Software media will be free from defects in materials and workmanship, for a period
of ninety (90) days from the date of receipt. Any implied warranties on Software are limited to ninety (90) days.
mikroElektronika Associates’ and its suppliers’ entire liability and your exclusive remedy shall be, at mikroElektronika
Associates’ option, either (a) return of the price paid, or (b) repair or replacement of Software that does not meet
mikroElektronika Associates’ Limited Warranty and which is returned to mikroElektronika Associates with a copy of
your receipt. DO NOT RETURN ANY PRODUCT UNTIL YOU HAVE CALLED MIKROELEKTRONIKA ASSOCIATES
FIRST AND OBTAINED A RETURN AUTHORIZATION NUMBER. This Limited Warranty is void if failure of Software
has resulted from an accident, abuse, or misapplication. Any replacement of Software will be warranted for the rest of
the original warranty period or thirty (30) days, whichever is longer.
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MIKROELEKTRONIKA ASSOCIATES AND ITS
SUPPLIERS DISCLAIM ALL OTHER WARRANTIES AND CONDITIONS, EITHER EXPRESSED OR IMPLIED,
INCLUDED, BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO SOFTWARE, AND THE PROVISION OF OR
FAILURE TO PROVIDE SUPPORT SERVICES.
MikroElektronika
32
mikroC PRO for PIC32
IN NO EVENT SHALL MIKROELEKTRONIKA ASSOCIATES OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL,
INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
DAMAGES FOR LOSS OF BUSINESS PROFITS AND BUSINESS INFORMATION, BUSINESS INTERRUPTION, OR
ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE PRODUCT
OR THE PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF MIKROELEKTRONIKA
ASSOCIATES HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY CASE, MIKROELEKTRONIKA
ASSOCIATES’ ENTIRE LIABILITY UNDER ANY PROVISION OF THIS LICENSE AGREEMENT SHALL BE LIMITED
TO THE AMOUNT ACTUALLY PAID BY YOU FOR SOFTWARE PRODUCT PROVIDED, HOWEVER, IF YOU HAVE
ENTERED INTO A MIKROELEKTRONIKA ASSOCIATES SUPPORT SERVICES AGREEMENT, MIKROELEKTRONIKA
ASSOCIATES’ ENTIRE LIABILITY REGARDING SUPPORT SERVICES SHALL BE GOVERNED BY THE TERMS OF
THAT AGREEMENT.
HIGH RISK ACTIVITIES
Software is not fault-tolerant and is not designed, manufactured or intended for use or resale as on-line control
equipment in hazardous environments requiring fail-safe performance, such as in the operation of nuclear facilities,
aircraft navigation or communication systems, air trafc control, direct life support machines, or weapons systems, in
which the failure of Software could lead directly to death, personal injury, or severe physical or environmental damage
(“High Risk Activities”). mikroElektronika Associates and its suppliers specically disclaim any expressed or implied
warranty of tness for High Risk Activities.
GENERAL PROVISIONS
This statement may only be modied in writing signed by you and an authorised ofcer of mikroElektronika Associates.
If any provision of this statement is found void or unenforceable, the remainder will remain valid and enforceable
according to its terms. If any remedy provided is determined to have failed for its essential purpose, all limitations of
liability and exclusions of damages set forth in the Limited Warranty shall remain in effect.
This statement gives you specic legal rights; you may have others, which vary, from country to country. mikroElektronika
Associates reserves all rights not specically granted in this statement.
The latest software can be downloaded free of charge via Internet (you might want to bookmark the page so you could
check news, patches, and upgrades later on): http://www.pic32compilers.com/ .
In case you encounter any problem, you are welcome to our support forums at www.mikroe.com/forum/. Here, you may
also nd helpful information, hardware tips, and practical code snippets. Your comments and suggestions on future
development of the mikroC PRO for PIC32 are always appreciated — feel free to drop a note or two on our Wishlist.
In our Knowledge Base www.mikroe.com/en/kb/ you can nd the answers to Frequently Asked Questions and solutions
to known problems. If you can not nd the solution to your problem in Knowledge Base then report it to Support Desk
www.mikroe.com/en/support/. In this way, we can record and track down bugs more efciently, which is in our mutual
interest. We respond to every bug report and question in a suitable manner, ever improving our technical support.
How to Register
The latest version of the mikroC PRO for PIC32 is always available for downloading from our website. It is a fully functional
software with the mikroICD(in-circuit Debugger), all the libraries, examples, and comprehensive help included.
The only limitation of the free version is that it cannot generate hex output over 2K of program words. Although it might
sound restrictive, this margin allows you to develop practical, working applications with no thinking of demo limit. If
you intend to develop really complex projects in the mikroC PRO for PIC32, then you should consider the possibility of
purchasing the license key.
Who Gets the License Key
Buyers of the mikroC PRO for PIC32 are entitled to the license key. After you have completed the payment procedure,
you have an option of registering your mikroC PRO for PIC32. In this way you can generate hex output without any
limitations.
How to Get License Key
After you have completed the payment procedure, start the program. Select Help › How to Register from the drop-
down menu or click the How To Register Icon .
You can choose between two registering methods, I work online or I work ofine, based on your current internet
connection and click Request license key now button:
MikroElektronika
34
mikroC PRO for PIC32
If you choose I work online registering method, following page will be opened in your default browser:
35
MikroElektronika
Fill out the registration form, select your distributor, and click the Submit button.
If you choose I work ofine registering method, following window will be opened:
mikoC PRO for PIC32
Fill out the registration form, select your distributor, and click the Submit button.
This will start your e-mail client with message ready for sending. Review the information you have entered, and add the
comment if you deem it necessary. Please, do not modify the subject line.
Upon receiving and verifying your request, we will send the license key to the e-mail address you specied in the
form.
After Receving the License Key
The license key comes as a small autoextracting le – just start it anywhere on your computer in order to activate
your copy of compiler and remove the demo limit. You do not need to restart your computer or install any additional
components. Also, there is no need to run the mikroC PRO for PIC32 at the time of activation.
MikroElektronika
36
mikroC PRO for PIC32
Important:
- The license key is valid until you format your hard disk. In case you need to format the hard disk,
you should request a new activation key.
- Please keep the activation program in a safe place. Every time you upgrade the compiler
you should start this program again in order to reactivate the license.
37
MikroElektronika
CHAPTER 2
mikroC PRO for PIC32
Environment
mikoC PRO for PIC32
MikroElektronika
38
mikroC PRO for PIC32
Main Menu Options
Available Main Menu options are:
Related topics: Keyboard shortcuts, Toolbars
39
MikroElektronika
File
File Menu Options
The File menu is the main entry point for manipulation with the source les.
FileDescription
Open a new editor window.
mikoC PRO for PIC32
Open source le for editing or image le for viewing.
Reopen recently used le.
Save changes for active editor.
Save the active source le with the different name or change the le type.
Close active source le.
Close all opened les.
Print Preview.
Print.
Exit IDE.
Related topics: Keyboard shortcuts, File Toolbar, Managing Source Files
MikroElektronika
40
mikroC PRO for PIC32
Edit
Edit Menu Options
The Edit Menu contains commands for editing the contents of the current document.
EditDescription
Undo last change.
Redo last change.
Cut selected text to clipboard.
Copy selected text to clipboard.
Paste text from clipboard.
Delete selected text.
Select all text in active editor.
Find text in active editor.
Find next occurence of text in active editor.
Find previous occurence of text in active editor.
Replace text in active editor.
Find text in current le, in all opened les, or in les from desired folder.
Go to line to the desired line in active editor.
Advanced Code Editor options
41
MikroElektronika
mikoC PRO for PIC32
Advanced »Description
Comment selected code or put single line comment if there is no selection.
Uncomment selected code or remove single line comment if there is no selection.
Indent selected code.
Outdent selected code.
Changes selected text case to lowercase.
Changes selected text case to uppercase.
Changes selected text case to titlercase.
Find Text
Dialog box for searching the document for the specied text. The search is performed in the direction specied. If the
string is not found a message is displayed.
Replace Text
Dialog box for searching for a text string in le and replacing it with another text string.
MikroElektronika
42
mikroC PRO for PIC32
Find In Files
Dialog box for searching for a text string in current le, all opened les, or in les on a disk.
The string to search for is specied in the Text to nd eld. If Search in directories option is selected, The les to search
are specied in the Files mask and Path elds.
Go To Line
Dialog box that allows the user to specify the line number at which the cursor should be positioned.
Regular expressions option
By checking this box, you will be able to advance your search, through Regular expressions.
Related topics: Keyboard shortcuts, Edit Toolbar, Advanced Edit Toolbar
43
MikroElektronika
View
View Menu Options
View Menu contains commands for controlling the on-screen display of the current project.
The Tools toolbar can easily be customized by adding new tools in Options(F12) window.
Related topics: Keyboard shortcuts, Integrated Tools
45
MikroElektronika
Project
Project Menu Options
Project Menu allows the user to easily manipulate current project.
ProjectDescription
Open New Project Wizard
mikoC PRO for PIC32
Open existing project.
Open project group.
Open recently used project or project group.
Save current project.
Save active project le with the different name.
Close active project.
Close project group.
Add le to project.
Remove le from project.
Edit search paths.
Edit project settings
Clean Project Folder
Export Project.
Related topics: Keyboard shortcuts, Project Toolbar, Creating New Project, Project Manager, Project Settings
MikroElektronika
46
mikroC PRO for PIC32
Build
Build Menu Options
Build Menu allows the user to easily manage building and compiling process.
BuildDescription
Build active project.
Rebuild all sources in active project.
Build all projects.
Stop building all projects.
Build and program active project.
Related topics: Keyboard shortcuts, Project Toolbar, Creating New Project, Project Manager, Project Settings
47
MikroElektronika
Run
Run Menu Options
Run Menu is used to debug and test compiled code on a software or harware level.
RunDescription
Start Software Simulator or mikroICD (In-Circuit Debugger).
mikoC PRO for PIC32
Stop Debugger.
Run/Pause Debugger.
Step Into.
Step Over.
Step Out.
Run To Cursor.
Jump to interrupt in current project.
Toggle Breakpoint.
Clear Breakpoints.
Toggle between source and disassembly.
Related topics: Keyboard shortcuts, Debug Toolbar
MikroElektronika
48
mikroC PRO for PIC32
Tools
Tools Menu Options
Tools Menu contains a number of applications designed to ease the use of compiler and included library routines.
ToolsDescription
Run mikroElektronika Programmer.
Run Package Manager.
Show/Hide Active Comment Editor window.
Run ASCII Chart
Run EEPROM Editor
Generate HTML code suitable for publishing source code on the web.
Run Glcd bitmap editor
Run HID Terminal
Run Interrupt Assistant
Run Lcd custom character
Run Seven Segment Editor
Run UDP communication terminal
Run USART Terminal
Open Options window
Related topics: Keyboard shortcuts, Tools Toolbar
49
MikroElektronika
Help
Help Menu Options
HelpDescription
mikoC PRO for PIC32
Оpen Help File.
Оpen Code Migration Document.
Check if new compiler version is available.
Open mikroElektronika Support Forums in a default browser.
Open mikroElektronika Web Page in a default browser.
Information on how to register
Open About window.
Related topics: Keyboard shortcuts, Help Toolbar
MikroElektronika
50
mikroC PRO for PIC32
mikroC PRO for PIC32 IDE
IDE Overview
The mikroC PRO for PIC32 is an user-friendly and intuitive environment.
For a detailed information on a certain part of IDE, simply click on it (hovering a mouse cursor above a desired IDE part
will pop-up its name):
- The Code Editor features adjustable Syntax Highlighting, Code Folding, Code Assistant, Parameters Assistant, Spell
Checker, Auto Correct for common typos and Code Templates (Auto Complete).
- The Code Explorer is at your disposal for easier project management.
- The Project Manager alows multiple project management
- General project settings can be made in the Project Settings window
- Library manager enables simple handling libraries being used in a project
- The Messages Window displays all messages during compiling and linking.
- The source-level Software Simulator lets you debug executable logic step-by-step by watching the program ow.
- The New Project Wizard is a fast, reliable, and easy way to create a project.
- Help les are syntax and context sensitive.
- Like in any modern Windows application, you may customize the layout of mikroC PRO for PIC32 to suit your needs
best.
- Spell checker underlines identiers which are unknown to the project. In this way it helps the programmer to spot
potential problems early, much before the project is compiled.
- Spell checker can be disabled by choosing the option in the Preferences dialog (F12).
51
MikroElektronika
mikoC PRO for PIC32
Code Editor
The Code Editor is advanced text editor fashioned to satisfy needs of professionals. General code editing is the
same as working with any standard text-editor, including familiar Copy, Paste and Undo actions, common for Windows
environment.
Available Code Editor options are: Editor Settings, Editor Colors, Auto Correct, Auto Complete and Style.
Editor Settings
Main Editor Settings Features are:
- Auto Save
- Highlighter
- Spelling
- Comment Style
- Code Folding
- Code Assistant
- Parameter Assistant
- Bookmarks and Go to Line
MikroElektronika
52
mikroC PRO for PIC32
Auto Save
Auto Save is a function which saves an opened project automatically, helping to reduce the risk of data loss in case of
a crash or freeze. Autosaving is done in time intervals dened by the user.
Highlighter
Highlighting is a convenient feature for spotting brackets which notate begin or end of a routine, by making them
visually distinct.
Spelling
The Spell Checker underlines unknown objects in the code, so they can be easily noticed and corrected before compiling
your project.
Select Tools › Options from the drop-down menu, or click the Show Options Icon and then select the Spell
Checker Tab.
Comment Style
Code Editor has a feature to change the comment style to either single-line or multi-line. Commenting or uncommenting
the selected code is done by a simple click of a mouse, using the Comment Icon and Uncomment Icon from
the Advanced Edit Toolbar.
Code Folding
Code folding is IDE feature which allows users to selectively hide and display sections of a source le. In this way it is
easier to manage large regions of code within one window, while still viewing only those subsections of the code that
are relevant during a particular editing session.
While typing, the code folding symbols ( and ) appear automatically. Use the folding symbols to hide/unhide the
code subsections.
53
MikroElektronika
mikoC PRO for PIC32
Another way of folding/unfolding code subsections is by using Alt+← and Alt+→.
If you place a mouse cursor over the tooltip box, the collapsed text will be shown in a tooltip style box.
Code Assistant
If you type the rst few letters of a word and then press Ctrl+Space, all valid identiers matching the letters you have
typed will be prompted in a oating panel (see the image below). Now you can keep typing to narrow the choice, or you
can select one from the list using the keyboard arrows and Enter.
Parameter Assistant
The Parameter Assistant will be automatically invoked when you open parenthesis “(” or press Shift+Ctrl+Space. If the
name of a valid function precedes the parenthesis, then the expected parameters will be displayed in a oating panel.
As you type the actual parameter, the next expected parameter will become bold.
Bookmarks
Bookmarks make navigation through a large code easier. To set a bookmark, use Ctrl+Shift+number. The same
princliple applies to the removal of the bookmarks. To jump to a bookmark, use Ctrl+number.
Go to Line
The Go to Line option makes navigation through a large code easier. Use the shortcut Ctrl+G to activate this option.
MikroElektronika
54
mikroC PRO for PIC32
Column Select Mode
This mode changes the operation of the editor for selecting text. When column select mode is used, highlighted text
is based on the character column position of the rst character selected to the column of the last character of text
selected.
Text selected in this mode does not automatically include all text between the start and end position, but includes all
text in the columns between the rst and last character selected.
Column mode editing is sometimes referred to as block mode editing as the act of selecting text forms a rectangle.
To enter this mode, press Alt + Left mouse button, drag the mouse towards the desired direction thus selecting the
text.
Editor Colors
55
MikroElektronika
mikoC PRO for PIC32
Editor Colors option allows user to set, change and save text and color settings organized in schemes. Schemes
represent custom graphical appearance that can be applied to GUI (Graphical User Interface) to satisfy tastes of
different users.
Auto Correct
Auto Correct option facilitates the user in such a fashion that it automatically corrects common typing or spelling errors
as it types.
This option is already set up to automatically correct some words. For example, if you type whiel, it will be corrected
to while when you press the spacebar:
MikroElektronika
56
mikroC PRO for PIC32
The user can easily add its common typos by entering original typo, for example btye, to the Original box, and
replacement, byte, to the Replacement box, and just click "Add" button.
Next time when the typo occurs, it will be automatically corrected.
Auto Complete (Code Templates)
Auto Complete option saves lots of keystrokes for commonly used phrases by automatically completing user's typing.
57
MikroElektronika
mikoC PRO for PIC32
The user can insert the Code Template by typing the name of the template (for instance, dow), then press Ctrl+J and
the Code Editor will automatically generate a code:
You can add your own templates to the list by entering the desired keyword, description and code of your template in
appropriate boxes.
Autocomplete macros can retreive system and project information:
- %DATE% - current system date
- %TIME% - current system time
- %DEVICE% - device (MCU) name as specied in project settings
- %DEVICE_CLOCK% - clock as specied in project settings
- %COMPILER% - current compiler version
These macros can be used in template code, see template ptemplate provided with mikroC PRO for PIC32
installation.
MikroElektronika
58
mikroC PRO for PIC32
Code Explorer
The Code Explorer gives clear view of each item declared inside the source code. You can jump to a declaration of
any item by double clicking it, or pressing the Enter button. Also, besides the list of dened and declared objects, code
explorer displays message about the rst error and it's location in code.
The following options are available in the Code Explorer:
IconDescription
Expand/Collapse all nodes in tree.
Locate declaration in code.
59
MikroElektronika
mikoC PRO for PIC32
Routine List
Routine list diplays list of routines, and enables ltering routines by name. Routine list window can be accessed by
pressing Ctrl+L.
You can jump to a desired routine by double clicking on it, or pressing the Enter button. Also, you can sort routines by
size or by address.
Project Manager
Project Manager is IDE feature which allows the users to manage multiple projects. Several projects which together
make project group may be open at the same time. Only one of them may be active at the moment.
Setting project in active mode is performed by double clicking the desired project in the Project Manager, which will
result in bolding the project's name.
Also, the name of the currently active project will be diplayed in the Program Manager window title, alongside with the
number of projects in project group.
MikroElektronika
60
mikroC PRO for PIC32
Following options are available in the Project Manager:
IconDescription
For details about adding and removing les from project see Add/Remove Files from Project.
Save project Group.
Open project group.
Close the active project.
Close project group.
Add project to the project group.
Remove project from the project group.
Add le to the active project.
Remove selected le from the project.
Build the active project.
Run mikroElektronika’s Flash programmer.
Related topics: Project Settings, Project Menu Options, File Menu Options, Project Toolbar, Build Toolbar, Add/Remove
Files from Project
61
MikroElektronika
Project Settings
The following options are available in the Project Settings window:
- Device - select the appropriate device from the device drop-down list.
- MCU Clock - enter the clock frequency value.
- Build/Debugger Type - choose debugger type.
mikoC PRO for PIC32
Related topics: Edit Project, Customizing Projects, Project Manager
MikroElektronika
62
mikroC PRO for PIC32
Library Manager
Library Manager enables simple handling libraries being used in a project. Library Manager window lists all libraries
(extension .emcl) which are instantly stored in the compiler Uses folder. The desirable library is added to the project
by selecting check box next to the library name.
In order to have all library functions accessible, simply press the button CheckAll and all libraries will be selected.
In case none library is needed in a project, press the button ClearAll and all libraries will be cleared from the
project.
Only the selected libraries will be linked.
IconDescription
Refresh Library by scanning les in “Uses” folder. Useful when new libraries are added by copying les to
“Uses” folder.
Rebuild all available libraries. Useful when library sources are available and need refreshing.
Include all available libraries in current project.
No libraries from the list will be included in current project.
Restore library to the state just before last project saving.
63
MikroElektronika
mikoC PRO for PIC32
Managing libraries using Package Manager
The Package Manager is a tool which enables users to easily install their own libraries in the mikroIDE. Libraries are
distributed in the form of a package, which is an archive composed of one or more les, containing libraries. For more
information on Package Manager, visit our website.
Upon package installation, a new node with the package name will be created in the Library Manager. For example:
From the Library Manager, the user can also uninstall the desired package by right clicking the the appropriate node,
and from the drop-down menu choose Uninstall package:
Related topics: mikroC PRO for PIC Libraries, Creating New Library
MikroElektronika
64
mikroC PRO for PIC32
Routine List
Routine list diplays list of routines, and enables ltering routines by name. Routine list window can be accessed by
pressing Ctrl+L.
You can jump to a desired routine by double clicking on it, or pressing the Enter button. Also, you can sort routines by
size or by address.
Statistics
After successful compilation, you can review statistics of your code. Click the Statistics Icon .
Memory Usage Windows
Provides overview of RAM and ROM usage in the various forms.
65
MikroElektronika
Variables
Displays variables sorted by addresses.
mikoC PRO for PIC32
Used RAM Locations
Displays used RAM memory locations and their names.
MikroElektronika
66
mikroC PRO for PIC32
SFR Locations
Displays list of used SFR locations.
ROM Memory Usage
Displays ROM memory space usage in a pie-like form.
67
MikroElektronika
ROM Memory Constants
Displays ROM memory constants and their addresses.
mikoC PRO for PIC32
Functions
Sorts and displays functions in various ways.
MikroElektronika
68
mikroC PRO for PIC32
Functions Sorted By Name Chart
Sorts and displays functions by their name, in the ascending order.
Functions Sorted By Size Chart
Sorts and displays functions by their sizes in a chart-like form.
69
MikroElektronika
Functions Sorted By Addresses
Sorts and displays functions by their addresses, in the ascending order.
mikoC PRO for PIC32
Function Tree
Displays Function Tree with the relevant data for each function.
MikroElektronika
70
mikroC PRO for PIC32
Memory Summary
Displays summary of RAM and ROM memory in a pie-like form.
71
MikroElektronika
mikoC PRO for PIC32
Messages Window
Messages Window displays various informations and notications about the compilation process.
It reports for example, time needed for preprocessing, compilation and linking; used RAM and ROM space, generated
baud rate with error percentage, etc.
The user can lter which notications will Messages Window display by checking Errors, Warning and Hints box.
In case that errors were encountered during compiling, the compiler will report them and won’t generate a hex le. The
Messages Window will display errros at the bottom of the window by default.
The compiler also reports warnings, but these do not affect the output; only errors can interefere with the generation
of hex.
Double click the message line in the Message Window to highlight the line where the error was encountered.
MikroElektronika
72
mikroC PRO for PIC32
Quick Converter
Quick Converter enables the user to easily transform numbers from one base to another.
The user can convert integers of various sizes (8, 16 or 32 bits), signed and unsigned, using different representation
(decimal, hexadecimal, binary and character).
Also, Quick Converter features oat point numbers conversion from/to Float Decimal, Float 32bit (IEEE), Float 32bit
(Microchip) and Radix 1.15 for PIC32 family of MCUs.
Macro Editor
A macro is a series of keystrokes that have been 'recorded' in the order performed. A macro allows you to 'record' a
series of keystrokes and then 'playback', or repeat, the recorded keystrokes.
73
MikroElektronika
The Macro offers the following commands:
IconDescription
mikoC PRO for PIC32
Related topics: Code Editor, Code Templates
Starts ‘recording’ keystrokes for later playback.
Stops capturing keystrokes that was started when the Start Recording command was selected.
Allows a macro that has been recorded to be replayed.
New macro.
Delete macro.
Image Preview
There are a lot of occassions in which the user besides the code, must look at the appropriate schematics in order to
succesfully write the desired program.
The mikroC PRO for PIC32 provides this possibility through the Image Preview Window.
To add an image to the Image Preview Window, right click the Image Files node in the Project Manager:
MikroElektronika
74
mikroC PRO for PIC32
Now, navigate to the desired image le, and simply add it:
Next, right click the added le, and choose Set As Preview Image:
75
MikroElektronika
mikoC PRO for PIC32
Once you have added the image, it will appear in the Image Preview Window:
Also, you can add multiple images to the Image Files node, but only the one that is set will be automatically displayed
in the Image Preview Window upon opening the project.
By changing the Image Preview Window size, displayed image will be t by its height in such a way that its proportions
will remain intact.
Toolbars
This section provides an overview of the toolbars available in mikroC PRO for PIC32 Help:
- File Toolbar
- Edit Toolbar
- Advanced Edit Toolbar
- Find Toolbar
- Project Toolbar
- Build Toolbar
- Debug Toolbar
- Styles Toolbar
- Tools Toolbar
- View Toolbar
- Layout Toolbar
- Help Toolbar
MikroElektronika
76
mikroC PRO for PIC32
File Toolbar
File Toolbar is a standard toolbar with the following options:
IconDescription
Opens a new editor window.
Open source le for editing or image le for viewing.
Save changes for active window.
Save changes in all opened windows.
Print Preview.
Print.
Edit Toolbar
Edit Toolbar is a standard toolbar with the following options:
IconDescription
Undo last change.
77
Redo last change.
Cut selected text to clipboard.
Copy selected text to clipboard.
Paste text from clipboard.
MikroElektronika
Advanced Edit Toolbar
Advanced Edit Toolbar comes with the following options:
IconDescription
mikoC PRO for PIC32
Comment selected code or put a single line comment if there is no selection
Uncomment selected code or remove single line comment if there is no selection.
Select text from starting delimiter to ending delimiter.
Go to ending delimiter.
Go to line.
Indent selected code lines.
Outdent selected code lines.
Generate HTML code suitable for publishing current source code on the web.
Find/Replace Toolbar
Find/Replace Toolbar is a standard toolbar with the following options:
IconDescription
Find text in current editor.
Find next occurence.
Find previous occurence.
Replace text.
Find text in les.
MikroElektronika
78
mikroC PRO for PIC32
Project Toolbar
Project Toolbar comes with the following options:
IconDescription
New project.
Open Project
Save Project
Edit project settings.
Close current project.
Clean project folder.
Add File To Project
Remove File From Project
Build Toolbar
Build Toolbar comes with the following options:
IconDescription
Build current project.
Build all opened projects.
Build and program active project.
Start programmer and load current HEX le.
79
MikroElektronika
Debug Toolbar
Debug Toolbar comes with the following options:
IconDescription
mikoC PRO for PIC32
Start Software Simulator or mikroICD (In-Circuit Debugger).
Run/Pause Debugger.
Stop Debugger.
Step Into.
Step Over.
Step Out.
Run To Cursor.
Toggle Breakpoint.
View Breakpoints Window
Clear Breakpoints.
View Watch Window
View Stopwatch Window
Styles Toolbar
Styles toolbar allows you to easily change colors of your workspace.
MikroElektronika
80
mikroC PRO for PIC32
Tools Toolbar
Tools Toolbar comes with the following default options:
IconDescription
Tip : The Tools toolbar can easily be customized by adding new tools in Options menu window.
Run USART Terminal
EEPROM
ASCII Chart
Seven Segment Editor.
Open Active Comment editor.
Options menu
View Toolbar
View Toolbar provides access to assembly code, listing le and statistics windows.
IconDescription
81
Open assembly code in editor.
Open listing le in editor.
View statistics for current project.
MikroElektronika
mikoC PRO for PIC32
Layout Toolbar
Styles toolbar allows you to easily customize workspace through a number of different IDE layouts.
Help Toolbar
Help Toolbar provides access to information on using and registering compilers:
IconDescription
Related topics: Keyboard shortcuts, Integrated Tools
Open Help le.
How To Register.
MikroElektronika
82
mikroC PRO for PIC32
Customizing IDE Layout
Docking Windows
You can increase the viewing and editing space for code, depending on how you arrange the windows in the IDE.
Step 1: Click the window you want to dock, to give it focus.
Step 2: Drag the tool window from its current location. A guide diamond appears. The four arrows of the diamond point
towards the four edges of the IDE.
83
MikroElektronika
mikoC PRO for PIC32
Step 3: Move the pointer over the corresponding portion of the guide diamond. An outline of the window appears in the
designated area.
Step 4: To dock the window in the position indicated, release the mouse button.
Tip : To move a dockable window without snapping it into place, press CTRL while dragging it.
Saving Layout
Once you have a window layout that you like, you can save the layout by typing the name for the layout and pressing
the Save Layout Icon .
To set the layout select the desired layout from the layout drop-down list and click the Set Layout Icon .
To remove the layout from the drop-down list, select the desired layout from the list and click the Delete Layout
Icon .
Auto Hide
Auto Hide enables you to see more of your code at one time by minimizing tool windows along the edges of the IDE
when not in use.
- Click the window you want to keep visible to give it focus.
- Click the Pushpin Icon on the title bar of the window.
MikroElektronika
84
mikroC PRO for PIC32
When an auto-hidden window loses focus, it automatically slides back to its tab on the edge of the IDE. While a window
is auto-hidden, its name and icon are visible on a tab at the edge of the IDE. To display an auto-hidden window, move
your pointer over the tab. The window slides back into view and is ready for use.
Options
Options menu consists of three tabs: Code Editor, Tools and Output settings.
Code editor
The Code Editor is advanced text editor fashioned to satisfy needs of professionals.
Tools
The mikroC PRO for PIC32 includes the Tools tab, which enables the use of shortcuts to external programs, like
Calculator or Notepad.
You can set up to 10 different shortcuts, by editing Tool0 - Tool9.
85
MikroElektronika
mikoC PRO for PIC32
Output settings
By modifying Output Settings, user can congure the content of the output les.
You can enable or disable, for example, generation of ASM and List le.
Also, user can choose optimization level, and compiler specic settings, which include case sensitivity, dynamic link for
string literals setting (described in mikroC PRO for PIC32 specics).
Build all les as library enables user to use compiled library (*.emcl) on any MCU (when this box is checked), or for a
selected MCU (when this box is left unchecked).
For more information on creating new libraries, see Creating New Library.
MikroElektronika
86
mikroC PRO for PIC32
87
MikroElektronika
mikoC PRO for PIC32
Integrated Tools
Active Comments Editor
Active Comments Editor is a tool, particularly useful when working with Lcd display. You can launch it from the drop-
down menu Tools › Active Comments Editor or by clicking the Active Comment Editor Icon from Tools toolbar.
MikroElektronika
88
mikroC PRO for PIC32
ASCII Chart
The ASCII Chart is a handy tool, particularly useful when working with Lcd display. You can launch it from the drop-
down menu Tools › ASCII chart or by clicking the View ASCII Chart Icon from Tools toolbar.
89
MikroElektronika
mikoC PRO for PIC32
EEPROM Editor
The EEPROM Editor is used for manipulating MCU's EEPROM memory. You can launch it from the drop-down menu
Tools › EEPROM Editor.
When you run mikroElektronika programmer software from mikroC PRO for PIC32 IDE - project_name.hex le will
be loaded automatically while ihex le must be loaded manually.
MikroElektronika
90
mikroC PRO for PIC32
Graphic Lcd Bitmap Editor
The mikroC PRO for PIC32 includes the Graphic Lcd Bitmap Editor. Output is the mikroC PRO for PIC32 compatible
code. You can launch it from the drop-down menu Tools › Glcd Bitmap Editor.
91
MikroElektronika
mikoC PRO for PIC32
HID Terminal
The mikroC PRO for PIC32 includes the HID communication terminal for USB communication. You can launch it from
the drop-down menu Tools › HID Terminal.
Interrupt Assistant
mikroC PRO for PIC32 includes the Interrupt Assistant that assist user in conguring interrupts. Output is the code for
the congured interrupt routine. You can launch it from the drop-down menu Tools › Interrupt Assistant.
MikroElektronika
92
mikroC PRO for PIC32
Lcd Custom Character
mikroC PRO for PIC32 includes the Lcd Custom Character. Output is mikroC PRO for PIC32 compatible code. You can
launch it from the drop-down menu Tools › Lcd Custom Character.
93
MikroElektronika
mikoC PRO for PIC32
Seven Segment Editor
The Seven Segment Editor is a convenient visual panel which returns decimal/hex value for any viable combination you
would like to display on seven segment display. Click on the parts of seven segment image to get the requested value
in the edit boxes. You can launch it from the drop-down menu Tools › Seven Segment Editor or by clicking the Seven
Segment Editor Icon from Tools toolbar.
UDP Terminal
The mikroC PRO for PIC32 includes the UDP Terminal. You can launch it from the drop-down menu Tools › UDP Terminal.
MikroElektronika
94
mikroC PRO for PIC32
USART Terminal
The mikroC PRO for PIC32 includes the USART communication terminal for RS232 communication. You can launch it
from the drop-down menu Tools › USART Terminal or by clicking the USART Terminal Icon from Tools toolbar.
95
MikroElektronika
mikoC PRO for PIC32
Active Comments
The idea of Active Comments is to make comments alive and give old fashioned comments new meaning and look.
From now on, you can assign mouse event on your comments and 'tell' your comments what to do on each one. For
example, on left mouse click, open some web address in your browser, on mouse over show some picture and on
mouse double click open some le.
Suppose we are writing a example for a GSM/GPSR module which is connected to the EasyPIC6 and we would like to
provide a photo of our hardware (jumpers, cables, etc.). within the example.
It would also be nice to put some documentation about chip we are using and a GSM module extra board. Now we can
have all those things dened in one single comment using Active Comment Editor.
New Active Comment
When you start Active Comment Editor for the rst time (from the View menu, from editor's pop-up menu, or by pressing
Ctrl + Alt + P) you will get an empty editor:
By clicking the button you are prompted to enter a name for the comment:
MikroElektronika
96
mikroC PRO for PIC32
You can notice that when you start typing a name, properties pane is automatically displayed so you can edit properties
if you wish. A Comment will be is created when you click button.
Properties are consisted of two major categories - Attributes and Events.
Attributes can be:
- URL - Valid web address.
- Image - Image has to be previously added to Project (Project Manager > Images).
- File - File has to be previously added to Project (Project Manager > Other Files).
There are four predened event types you can apply to an Active Comment:
1. OnLeftClick + Alt
2. OnRightClick
3. OnDoubleClick
4. OnMouseOver
97
MikroElektronika
mikoC PRO for PIC32
First three event types can have one of the following three actions:
1. OpenUrl - Opens entered URL in default Web browser.
2. OpenFile - Opens a le within a default program associated with the le extension (dened by Windows).
3. None - Does nothing.
The fourth event, OnMouseOver, has only 2 actions:
1. PreviewImage - Shows image when cursor is moved over a comment.
2. None - Does nothing.
Attributes are tightly bounded with events. For example, you can not have OnLeftClick + Alt -> OpenFile if there is no
le attribute set, or if there is no le added to project. The same behavior applies to image attribute.
Let's start editing our Active Comment by entering some valid web address in the URL eld:
For every Active Comment a XML le will be created, containing all valid information regarding the Active Comment -
attributes, events, etc. and it is automatically added to Project manager after saving it:
MikroElektronika
98
mikroC PRO for PIC32
You can see the contents of the created XML le by expanding Active Comment Editor:
As we mentioned above you can add image or le which are already included in project. If the the desired image or le
aren't added, you can do it directly from here by clicking the or button.
99
MikroElektronika
mikoC PRO for PIC32
Next le dialog will be opened:
There, you should select the desired image to be added. In our example, Easy_GSM_GPRS.jpg image will be added.
Selected picture is automatically added to the drop down list of the Image eld in Active Comment Editor:
MikroElektronika
100
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.