Deep knowledge of a software tool is not a necessity to use it. Tasks can be carried out easily without expertise but deep knowledge means faster and more effective execution of a task. When you are charged with something to do, there are two paths:
- Easiest - less complexity but slower
- Complex - faster but more skill required
This is going to be a two part journey through the MikroC IDE. We are going to focus on those things that will improve your efficiency and make your completion times much shorter. We will also be revealing some of the "Tips and Tricks" that may be undocumented or hidden away beneath 100's of pages of documentation.
Introduction to the MikroC IDE
MikroC IDE is a development tool designed for fast learning with many built in tools that are uniform across several MCU platforms. The primary goal of our software department is to make easy use of a tool which will greatly reduce development time. This was achieved through combining three things:
- Intuitive user interface
- Large number of additional helpful built-in tools and libraries
- Plenty of external resources that provid the added value to the IDE
As of present, MikroC comes with more than 500 libraries included ( CAN, SPI, I2C, UART, USB, Ethernet etc ). All libraries are well documented and most of them have a simplified example of usage. This in itself can be very helpful to aiding how to understand the usage and implementation. Also, the number of libraries increases with every new piece of hardware released.
There are also built-in tools like Unit Converter, ASCII chart, bitmap editor, HID terminal, Interrupt Assistant, LCD Custom Character Creator and many more. The tools are there to make you feel more comfortable while developing. For example you don't have to search for some web based binary to hexadecimal converter, or terminal emulator, it's already there.
Since the main goal of this post is to introduce you to things that might improve your skills inside the MikorC IDE, in this part we will start with toolbars, shortcuts and auto complete. These are common functionalities of every IDE and in the second part we will present the main advantages of MikroC IDE.
( View > Toolbars )
This is a part for those who like to click instead of using keyboard shortcuts, newbies like it, but more experienced developers use just few of them. They can be helpful for options that are not used very often so you don't have to keep the keyboard shortcut in your head but they are accessible by mouse click. Having numerous toolbars turned on will bring perhaps a messy or confusing look to your IDE. Also decreasing your work space, so the default is 1 row.
When you open the drop-down menu you will see that our IDE offers lot of different toolbars that can be revealed by mouse click. Most of them are common for all modern IDEs so we will pay attention to the most useful ones.
Most common of them is probably the Tools toolbar. Inside this toolbar are the most used built-in tools that can be also found in the Tools option menu. The content of this toolbar also depends on external tools added to IDE (we will go through this in the next part). Default tools inside this toolbar consists of the Interrupt Assistant and USART Terminal which are incredibly useful.
Layout toolbar is also the very important one because it allows you fast switching between the different layouts specialized for a different phases of the development process. Default layout have views important while we are in the phase of writing code, so views like library manager or code explorer are visible. Debug layout have only views important for debugging like watch values or watch clock. There is a 1024x768 layout which is layout adapted for the users that have lower resolution screens. All of this layouts except the default can be edited and saved so user can customize them the way he wants.
View toolbar is the one for more experienced developers but that doesn't mean that new users can't use it. This toolbar provides an statistic window which gives user a detailed view to the usage of ROM and RAM. Things like this statistic are helpful to analyze your project and make improvements, decrease RAM and ROM usage and many more. Of course this requires good knowledge of embedded and programming at all.
( Help > Contents > mikroC PRO for ... Environment > mikroC PRO for ... IDE > Keyboard Shortcuts )
This is the fastest way to execute different types of operations inside your IDE, but does take some practice. The knowledge of the shortcuts comes with the experience and time spent inside the specific IDE. In general, it is better to start learning and using shortcuts one by one from the beginning instead of try to memorize all of them in a day. Best strategy is to start with the most important or most frequent shortcuts you use in your project.
All shortcuts are listed inside the help documentation. They can be also found next to the every option inside the different menus. The most frequently used and the shortcuts that you will learn before any other are probably those you using for debugging. That is simply because debugging can take almost 80% of your work time inside the IDE. These some of the most important shortcuts used inside the debug mode :
- F9 - Start debugger
- ctrl + F2 - Stop debugger
- F6 - Run / Pause debugger
- F7 - Step into
- F8 - Step over
- ctrl + F8 - Step out
- F4 - Run to cursor
- F5 - Toggle breakpoint
The other important shortcuts are mostly used for code editing. Some of the most helpful ones are :
- ctrl + shift + space - Parameters assistant (provides a list of the parameters and their types for the particular function which you are implementing )
- ctrl + shift + . - Comment code ( if you previously selected multiple lines all of them are going to be commented, otherwise comments only line where is a cursor position )
- ctrl + shift + , - Uncomment code ( same behavior as comment code )
- ctrl + j - Auto complete ( this is going to be explained in next section )
- ctrl + shif + v - Local variable type definition( after you type variable name this allows you to choose variable type from drop-down list )
ctrl + space - Code assistant - The most frequently used keyboard shortcut on mikroC IDE. Provides a list of all variables and functions which name starts with the already typed letters. This shortcut can be also used in combination with * character. For example you can type letters "UA" and call this shortcut - you will be presented all variables, functions, enums and structs which name starts with "UA" letters but you can continue typing "*1" and then the IDE will filter only ones which name start with "UA" but also have and letter "1" after one or more characters between - same like search file system option which most of OS have. This will filter out all except the UART1 functions.
There is whole bunch of shortcuts so feel free to explore and try to involve usage of them one by one. In a short period of time you will realize the benefits of the shortcut usage.
( Tools > Options > Editor > Auto Complete )
There is no person, I know, that enjoys repeating boring operations or types the same things every time he starting new project or even inside the same project - like defining loops. The Auto Complete option allows user to define his own templates that can be called by typing the keyword and ( ctrl + j ) keyboard shortcut. When you open the location provided as a sub-header you will see that there is already some defined templates. You can edit them or add your own templates.
The first one that you might want to create could be advanced SPI initialization which require lot of arguments especially if we talk about MikroC for ARM. There is at least one more good reason to have code templates like this one and the reason is that possible mistakes and bugs are at the minimum. Now you have only to adapt the parameters according to the requirements for your device on SPI bus.
This was the basics steps of improving your skill inside MikroC IDE. Toolbars, keyboard shortcuts are something that every IDE have. Auto complete is something that can decrease amount of bugs in generally improve your speed. Next part will be more focused on the explanation of options that are specific for the MikroC IDE - Library Manager and tools.