15% OFF on everything in the shop - the offer lasts until June 27, 12:00 CET. Discount applies at checkout

MikroElektronika Learn

Software, User Manual

Compiler Quick Start Guide

20 Dec , 2016  

IntroductionIDE | Creating Your First Project | Examples

 

Creating Your First Project

In this part of the guide, we will show you how to create your first project in the compiler, compile it and then test the results.

When you open the compiler select the New Project option from the Project menu.

my first project

The New Project Wizard window will appear and easily guide you through the process of creating your project.

Step 1 — Visual TFT or Standard Project

A new window will appear asking you to choose whether you will be creating a Visual TFT project or a Standard project if you are using one of the followings
compilers: PIC, dsPIC or FT90x.

My First Project

Step 2 — Project Settings

The first thing we have to do is specify the general project information. Select the target microcontroller, it’s operating frequency and the name of your project.

My first project
The compiler will adjust the internal settings based on the information you have entered. The default configuration is suggested for you at the beginning.
If you don’t want to use the suggested path for storing your new project, you can change the destination folder. In order to do that please follow these instructions:

  1. Click on the Browse button on the Project Settings window to open the Browse for Folder window.
  2. Select the desired folder to be the destination path for storing your new project files.
  3. Click the OK button to confirm your selection and apply the new path.

Now we can do the rest of the project settings:

  1. Enter the name of the project, depending on the type of project you will be working on. For example, it could be “LEDblinking”.
  2. Set the Device clock. Clock speed depends on your target hardware. Make sure you specify the exact clock that the microcontroller is operating on.
  3. Click the OK button.

Step 3 — Add files

This step allows you to include additional files that you need in your project: some headers or source files that you already wrote, and that you might need in further development
. If you are going to add files, choose the folder they are located in and click the Next button. You can also add files later, by opening the Project Manager.

My First Project

Step 4 — Include Libraries

This step allows you to quickly set whether you want to include all libraries in your project, or not.
Even if all libraries are included, they will not consume any memory unless
they are explicitly used from within your code. The main advantage of including all libraries is that you will have over 500 functions available to use
in your code right away. These functions will be visible from Code Assistant [CTRL+Space]. The default configuration is the “Include All” option.
When you are done click on the Finish button.

My First Project

New Project created

Now that you have successfully created a new project you will see that the source file is called the way you have named the project. For example “LEDblinking.mpas”.


In case you want to see code examples for LED blinking, for each of our compilers, click on the following link: Examples

Helpful shortcuts

You can use keyboard shortcuts for repetitive tasks:

  • Ctrl+Alt+G to Generate Code
  • Ctrl + Shift + S to Save All files
  • Ctrl + F9 to build generated code
  • Ctrl + F11 build generated code and program to MCU

In case you want to see the full list of shortcuts you can find them in the Help file.

Creating your first project in the Visual TFT

Visual TFT software is a standalone application used for rapid development of graphical user interfaces for TFT displays.
The software generates code compatible with MikroElektronika compilers.
The visual/design process for creating new projects is the same for every compiler and on every architecture.

Visual TFT IDE

These are the most important sections in the Visual TFT IDE for you to learn about before you begin:

  1. Main Toolbar — This section features buttons with icons that depict each button’s function. Here you can open, save or export projects, add or delete screens,
    generate code, start the target compiler, invoke Project Settings window and much more.
  2. Object Inspector — This window can be used to change properties of each screen and component. Change names, captions, fonts, sizes, position,
    add events to components and define their behavior.
  3. Welcome Screen Buttons — The New Project option will take you through the process of creating your new project. The second one, Open Project, allows you to open existing
    projects, and the third one, Open Examples, lets you choose from the Examples folder.
  4. Components Palette — Collection of components which can be placed on screens. There are simple, basic components, such as a box, circle, line, image and label,
    and as well as more complex components such as buttons, checkbox and progress bar.
  5. Layers Window — Like in any other vector graphic editor, you can group components on layers while designing, and quickly navigate through different layers using this
    window.

In this tutorial, we will show you how to develop a simple application with two screens. Each screen will carry a button which can be used to switch to the other screen.
You will be designing a graphical interface in Visual TFT software.

New Project Wizard

Step 1 — Create the project in the wizard

Let’s start by creating a new project. On the Start page, click the New Project button. A new window will appear asking you to choose whether you will be creating
a Visual TFT project or a Standard project. Choose the Visual TFT project and click the Next button at the bottom of the screen.

The first thing we need to do is to specify the new project’s name and destination folder. Give a name to your project, “MyFirstProject”, for example.
Click the browse button if you want to edit the destination of the project. After you are done, click the Next button to continue with the creation of your project.

MyFirstProject VTFT.png

In the next window, you can add files to your project. Choose the files on your computer that you want to add and click the “Add” button.
After you have added all the files you wanted you can click the “Next” button and proceed to the last step in the New Project Wizard.
This step allows you to include additional files that you might need in your project – some headers or source files that you already wrote, and that you might
need in future development.

Add file to project VTFT.png

If you are a beginner we suggest that you choose the “Include All (Default)” option.
This step allows you to quickly set whether you want to include all libraries in your project, or not.
Even if you do include all libraries, they will not consume all memory unless they are explicitly used from within your code.
The main advantage of including all libraries is that you will have over 500 functions available for use in your code right away.
All the functions will be visible from the Code Assistant [CTRL+Space].

boarder

 

Step 2 — Design the user interface

VisualTFT first project.PNG

So far, we have successfully created a blank new project for EasyPIC Fusion v7 development board. Now, we are going to design the user interface.
We are going to add one button and one text section. In the tools section, in the upper right corner of the IDE, you have a list buttons you can add.
Choose the one you like and drag it to the display screen in the middle of the IDE.
After you click on the button, you can change its color, size, text and font in the Components section – Properties tab, in the bottom left corner of the IDE.
You can change the features of the screen in the upper lest corner of the IDE.
The Events tab, next to the Properties tab in the Components section defines what a button does.

 

Step 3 — Building the code in the compiler

Build Code vtft.PNG

Once you are satisfied with how your buttons, text, and display look click on “Build” (CTRL+F9) in the drop-down menu.
If an error happens you will be notified in the Message section of the compiler.
You can switch between the compiler and Visual TFT mode by pressing F12 on your keyboard.

Pages: 1 2 3 4

By  
Firmware developer in MikroElektronika with a passion for telemetry in the field of IoT. Low level is for the true modern day warriors.