IAR Embedded Workbench
for PICmicro (EWPic) ver.
2.2 Software User Guide
It is an integrated development environment that consists
of a project handler, editor,
compiler, assembler, linker and debugger for PIC
microcontrollers. Find out more at www.iar.com .
1.
To Download
- Click here to download IAR-EWPic.zip
and unzip it to extract all files (remember the destination). Check that
the destination contains 4 folders and 4 files, namely autorun.exe, .inf, .ini and IAR License.txt .
2.
To Install
- Make
sure you are login as the administrator or the user with administrative
rights on your computer.
- First
double-click IAR License.txt and keep its window open, then invoke autorun.exe
to begin installation.
¨
Cut and paste from IAR License.txt for the License # and License Key; &
¨
For simplicity, use the default settings for the
Destination folder, Installation type and Program folder.
- Ignore
any error message that says the IAR Systems Setup has failed to install
license key.
3. To Setup Licensing
- Launch
IAR License Manager v1.22A by
clicking:
Start à All Programs à IAR Systems à IAR Systems
License Manager
- In the
License Manager v1.22A
window, click the Install License …
button.
- In the
Install License dialog box,
paste the License Key with Ctrl+V into the text
field. Make sure the pasted key does not contain any spaces or hard line
breaks before the ending # mark, then click Install.
- If you
encounter an error that says “Failed to install license key on server. …
…” (skip this step if you don’t!),
just proceed to specify our license server name nus-ee2001 in the Optional
for Network Licenses text field found in the Install License dialog box and click Install.
- Select
xx-xxx.priv20.nus.edu.sg
(xx-xxx are just some numbers) or nus-ee2001 as the License
Server you want to use and click OK.
- If the
setup is successful, you should see the following message:
Permanent license key was found on
server.
Feature: EWPIC
Product: IAR Embedded Workbench
for PICmicro
Server: xx-xxx.priv20.nus.edu.sg OR Server: nus-ee2001
4. To
Get Started
4.1 Creating a new project.
- As
files are organized into projects in EWPic, it
is recommended that you create a directory where you keep the project
files, e.g. D:\projects.
- The
first step in using the EWPic is to create a new
project and to include a list of the files contained in the project. This
can be done via:
¨
Choose File à
New… and select Project from the menu and
enter project file name in the New
Project dialog box;
¨
When done, the Project window will appear. Two
types of targets are possible -- Debug
(for testing) and Release (final);
¨
To add file, first select the target type then
from the menu bar, choose Project à Files… to display the Project
Files dialog box;
¨
To edit
a file, simply double-click the filename in the Project window.
4.2 Compiling the project.
- Always
set the compiler options at least once for each target type in every
project. Mainly, we need to select the correct Processor setup file for
both Debug and Release targets. Let us do it for Debug first, then for
Release. The steps are as follows:
¨
Select Debug
folder icon in the Project window and right-click Options… , to launch the Options
For Target “Debug” dialog box;
¨
Under Category General, Taget
tab, browse for 16f877.i39 or 16f877a.i39 (depending on the PIC you use) and select it
as the Processor setup file, then
click OK;
¨
Repeat the above two steps for target “Release”;
- To
compile a source file, select its name on the Project window (or select
its Editor window if you are editing it) and select the Compile command from the Project menu (or press Ctrl+F9) or simply click on the Compile icon.
- The
progress, and any error messages, will be displayed in the Messages window. You can
double-click an error message to go directly to the appropriate line in
the source code and you can correct the error there.
4.3 Debugging the project.
- Select
the Debugger command from the Project menu, or just click on the
Debugger icon on the menu bar
to launch IAR Systems C-SPY.
- Use
the Execute menu (or their
respective icons on the menu bar) to execute the source code in C-SPY.
- To
keep track of variables, select the Watch
command from the Window menu to
open the Watch window. Then select and left-click briefly on the dotted
rectangle so that you can enter a variable’s name into the text box that
appears on its left. Alternatively, you may select a variable from the
Source window then drag and drop it into the Watch window to watch its
values.
- To
execute a program up to a specific statement, you can set a breakpoint at
that statement by:
¨
First place the cursor at that statement;
¨
Then choose Toggle
Breakpoint in the Control menu
(or press F5);
¨
The statement will be highlighted in red to show
the breakpoint.
- The
output from the program can also be displayed on the Terminal I/O window which can be launched from the Window menu.
4.4 Making the project.
- Instead
of compiling and assembling the files in a project individually and then
linking them, you can automatically bring the project up-to-date using the
Make command from the Project menu (or press F9) or click on the Make icon at the menu bar.
- When
you run Make, EWPic checks the dependency files (e.g. include files), and recompiles or
reassembles as necessary to keep the project updated.
- The project’s
executable files (.hex) are, by
default, saved in the …\Release\Exe folder after every
Make.
- In
conclusion, by following all the steps described above, you should be able
to create a project, add and edit a source file, compile and debug it, and
finally generate its executable .hex by making the project.
***
***