MikroElektronika mikroC PRO for PIC32 User guide

mikroC PRO for PIC32
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
efcient 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
Code Explorer 59
Routine List 60
Project Manager 60 Project Settings 62 Library Manager 63
Managing libraries using Package Manager 64
Routine List 65 Statistics 65
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
Messages Window 72 Quick Converter 73 Macro Editor 73 Image Preview 74 Toolbars 76
File Toolbar 77 Edit Toolbar 77 Advanced Edit Toolbar 78
3
MikroElektronika
mikoC PRO for PIC32
Find/Replace Toolbar 78 Project Toolbar 79 Build Toolbar 79 Debug Toolbar 80 Styles Toolbar 80 Tools Toolbar 81 View Toolbar 81 Layout Toolbar 82 Help Toolbar 82
Customizing IDE Layout 83
Docking Windows 83 Saving Layout 84 Auto Hide 84
Options 85
Code editor 85 Tools 85 Output settings 86
Integrated Tools 88
Active Comments Editor 88 ASCII Chart 89 EEPROM Editor 90 Graphic Lcd Bitmap Editor 91 HID Terminal 92 Interrupt Assistant 92 Lcd Custom Character 93 Seven Segment Editor 94 UDP Terminal 94 USART Terminal 95
Active Comments 96
New Active Comment 96 Renaming Active Comment 103 Deleting Active Comment 104
Export Project 105 Jump To Interrupt 106 Regular Expressions 107
Introduction 107 Simple matches 107 Escape sequences 107 Character classes 107 Metacharacters 108 Metacharacters - Line separators 108 Metacharacters - Predened classes 109 Metacharacters - Word boundaries 109 Metacharacters - Iterators 109 Metacharacters - Alternatives 110 Metacharacters - Subexpressions 110
MikroElektronika
4
mikroC PRO for PIC32
Metacharacters - Backreferences 110
Keyboard Shortcuts 111
CHAPTER 3 113 mikroC PRO for PIC32 Command Line Options 113 CHAPTER 4 115 mikroICD (In-Circuit Debugger) 115
Introduction 115 mikroICD Debugger Options 117
Debugger Options 117
mikroICD Debugger Example 118 mikroICD Debugger Windows 122
Debug Windows 122 Breakpoints Window 122 Watch Values Window 122 RAM Window 124 Stopwatch Window 124 EEPROM Watch Window 125 Code Watch Window 126
CHAPTER 5 127 Software Simulator Overview 127
Software Simulator 128 Software Simulator Debug Windows 129
Debug Windows 129 Breakpoints Window 129 Watch Values Window 129 RAM Window 131 Stopwatch Window 131 EEPROM Watch Window 132 Code Watch Window 133
Software Simulator Debugger Options 134
Debugger Options 134
CHAPTER 6 135 mikroC PRO for PIC32 Specics 135
ANSI Standard Issues 136
Divergence from the ANSI C Standard 136 C Language Extensions 136
Implementation-dened Behavior 136
Predened Globals and Constants 137
Predened project level denes 137
Accessing Individual Bits 138
sbit type 139 at keyword 140 bit type 140
5
MikroElektronika
mikoC PRO for PIC32
Interrupts 141
Conguring Interrupts 141 Single Vector Mode 141 Multi Vector Mode 141 Interrupt Priorities 142 Interrupts and Register Sets 142 Register Set Selection in Single Vector Mode 142 Interrupts and Register Sets 142 Interrupt Coding Requirements 142 Interrupt Service Routine 142 Function Calls from Interrupt 143 Interrupt Example 144
Linker Directives 145
Directive absolute 145 Directive org 146 Directive orgall 146 Directive funcorg 146
Indirect Function Calls 146 Built-in Routines 147
Lo 148 Hi 148 Higher 149 Highest 149 LoWord 150 HiWord 150 Delay_us 151 Delay_ms 151 Vdelay_ms 151 VDelay_Advanced_ms 152 Delay_Cyc 152 Delay_Cyc_Long 152 Clock_kHz 153 Clock_Mhz 153 Get_Fosc_kHz 153 Get_Fosc_Per_Cyc 154 KVA0_TO_KVA1 154 KVA1_TO_KVA0 154 KVA_TO_PA 155 PA_TO_KVA0 155 PA_TO_KVA1 155 CP0_GET 155 CP0_SET 156 EnableInterrupts 156 DisableInterrupts 156
Code Optimization 158
Constant folding 158
MikroElektronika
6
mikroC PRO for PIC32
Constant propagation 158 Copy propagation 158 Value numbering 158 "Dead code" ellimination 158 Stack allocation 158 Local vars optimization 158 Better code generation and local optimization 158
Single Static Assignment Optimization 159
Introduction 159 Proper Coding Recommendations 160 Asm code and SSA optimization 161 Debugging Notes 161 Warning Messages Enhancement 161
CHAPTER 7 162 PIC32 Specics 162
Types Efciency 163 Nested Calls Limitations 163 Variable, constant and routine alignment 163 Boot Start-up Initialization 163
PIC32 Memory Organization 164
PIC32MX Memory Layout 165 Virtual vs Physical Addresses 166
Memory Type Speciers 167
code 167 data 167 rx 167 sfr 167
Read Modify Write Problem 168
CHAPTER 8 172 mikroC PRO for PIC32 Language Reference 172
Lexical Elements Overview 175 Whitespace 176
Whitespace in Strings 176 Line Splicing with Backslash (\) 176
Comments 177
C comments 177 C++ comments 177 Nested comments 177
Tokens 178
Token Extraction Example 178
Constants 179 Integer Constants 179
Long and Unsigned Sufxes 179 Decimal 179
7
MikroElektronika
mikoC PRO for PIC32
Hexadecimal 180 Binary 180 Octal 180
Floating Point Constants 181 Character Constants 181
Escape Sequences 181 Disambiguation 182
String Constants 183
Line Continuation with Backslash 183
Enumeration Constants 184 Pointer Constants 184 Constant Expressions 185 Keywords 186 Identiers 187
Case Sensitivity 187 Uniqueness and Scope 188 Identier Examples 188
Punctuators 188
Brackets 188 Parentheses 189 Braces 189 Comma 189 Semicolon 190 Colon 190 Asterisk (Pointer Declaration) 190 Equal Sign 191 Pound Sign (Preprocessor Directive) 191
Concepts 192 Objects 192
Objects and Declarations 192 Lvalues 193 Rvalues 193
Scope and Visibility 193
Scope 193 Visibility 193
Name Spaces 194 Duration 195
Static Duration 195 Local Duration 195
Types 196
Type Categories 196
Fundamental Types 197 Arithmetic Types 197
Integral Types 197
MikroElektronika
8
mikroC PRO for PIC32
Floating-point Types 198
Enumerations 198
Enumeration Declaration 198 Anonymous Enum Type 199 Enumeration Scope 199
Void Type 200
Void Functions 200 Generic Pointers 200
Derived Types 200 Arrays 201
Array Declaration 201 Array Initialization 201 Arrays in Expressions 202 Multi-dimensional Arrays 202
Pointers 203
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
Structure Member Access 214
Accessing Nested Structures 215 Structure Uniqueness 215
Unions 216
Union Declaration 216 Size of Union 216 Union Member Access 216 Anonymous Unions 217 Anonymous Union Member Access 217
Bit Fields 218
9
MikroElektronika
mikoC PRO for PIC32
Bit Fields Declaration 218 Bit Fields Access 219
Types Conversions 219 Standard Conversions 220
Arithmetic Conversions 220 Pointer Conversions 221
Explicit Types Conversions (Typecasting) 221 Declarations 222
Declarations and Denitions 222 Declarations and Declarators 223
Linkage 223
Linkage Rules 224 Internal Linkage Rules 224
Storage Classes 224
Auto 225 Register 225 Static 225 Extern 225
Type Qualiers 226
Qualier const 226 Qualier volatile 226
Typedef Specier 226
asm Declaration 227
Accessing variables 227 Asm code and SSA optimization 228
Initialization 229
Automatic Initialization 229
Functions 230
Function Declaration 230 Function Prototypes 231 Function Denition 231 Functions reentrancy 232
Function Calls and Argument Conversions 232
Function Calls 232 Argument Conversions 233
Ellipsis (‘...’) Operator 234 Operators 235
Operators Precedence and Associativity 236
Arithmetic Operators 237
Arithmetic Operators Overview 237 Binary Arithmetic Operators 238 Unary Arithmetic Operators 238
Relational Operators 239
Relational Operators Overview 239
MikroElektronika
10
mikroC PRO for PIC32
Relational Operators in Expressions 239
Bitwise Operators 240
Bitwise Operators Overview 240 Logical Operations on Bit Level 240 Bitwise Shift Operators 241 Bitwise vs. Logical 241
Logical Operators 242
Logical Operators Overview 242 Logical Operations 242 Logical Expressions and Side Effects 242 Logical vs. Bitwise 243
Conditional Operator ? : 243
Conditional Operator Rules 243
Assignment Operators 244
Simple Assignment Operator 244 Compound Assignment Operators 244 Assignment Rules 244
Unary Operators 245
Unary Arithmetic Operators 245 Unary Logical Operator 246 Unary Bitwise Operator 246 Address and Indirection Operator 246
Sizeof Operator 247
Sizeof Applied to Expression 247 Sizeof Applied to Type 247
Expressions 248 Comma Expressions 248 Statements 249 Labeled Statements 249 Expression Statements 250 Selection Statements 250 If Statement 250
Nested If statements 250
Switch Statement 251
Nested switch 252
Iteration Statements (Loops) 252
While Statement 252
Do Statement 252 For Statement 253 Jump Statements 254 Break and Continue Statements 254
Break Statement 254 Continue Statement 254
11
MikroElektronika
mikoC PRO for PIC32
Goto Statement 255 Return Statement 255 Compound Statements (Blocks) 256 Preprocessor 256 Preprocessor Directives 256
Line Continuation with Backslash (\) 257
Macros 257
Dening Macros and Macro Expansions 257 Macros with Parameters 258 Undening Macros 259
File Inclusion 259
Explicit Path 260
Preprocessor Operators 261
Operator # 261 Operator ## 261
Conditional Compilation 262
Directives #if, #elif, #else, and #endif 262 Directives #ifdef and #ifndef 263
CHAPTER 9 264 mikroC PRO for PIC32 Libraries 264
Hardware Libraries 265 Standard ANSI C Libraries 266 Miscellaneous Libraries 266 Hardware Libraries 267 ADC Library 267
Library Routines 268 ADCx_Init 268 ADCx_Init_Advanced 268 ADCx_Get_Sample 269 ADCx_Read 269 Library Example 270
CANSPI Library 271
Library Dependency Tree 271 External dependencies of CANSPI Library 271 Library Routines 272 CANSPISetOperationMode 272 CANSPIGetOperationMode 273 CANSPIInitialize 273 CANSPISetBaudRate 275 CANSPISetMask 276 CANSPISetFilter 277 CANSPIRead 278 CANSPIWrite 279 CANSPI Constants 279
MikroElektronika
12
mikroC PRO for PIC32
CANSPI_OP_MODE Constants 279 CANSPI_CONFIG_FLAGS Constants 280 CANSPI_TX_MSG_FLAGS Constants 281 CANSPI_RX_MSG_FLAGS Constants 281 CANSPI_MASK Constants 282 CANSPI_FILTER Constants 282 Library Example 283 HW Connection 286
Compact Flash Library 287
Library Dependency Tree 287 External dependencies of Compact Flash Library 288 Library Routines 289 Cf_Init 290 Cf_Detect 291 Cf_Enable 291 Cf_Disable 291 Cf_Read_Init 292 Cf_Read_Byte 292 Cf_Write_Init 292 Cf_Write_Byte 293 Cf_Read_Sector 293 Cf_Write_Sector 293 Cf_Fat_Init 294 Cf_Fat_QuickFormat 294 Cf_Fat_Assign 295 Cf_Fat_Reset 296 Cf_Fat_Read 296 Cf_Fat_Rewrite 297 Cf_Fat_Append 297 Cf_Fat_Delete 297 Cf_Fat_Write 298 Cf_Fat_Set_File_Date 298 Cf_Fat_Get_File_Date 299 Cf_Fat_Get_File_Date_Modied 299 Cf_Fat_Get_File_Size 300 Cf_Fat_Get_Swap_File 300 Library Example 302 HW Connection 306
Epson S1D13700 Graphic Lcd Library 307
External dependencies of the Epson S1D13700 Graphic Lcd Library 307 Library Routines 308 S1D13700_Init 309 S1D13700_Write_Command 310 S1D13700_Write_Parameter 311 S1D13700_Read_Parameter 311 S1D13700_Fill 311 S1D13700_GrFill 312
13
MikroElektronika
mikoC PRO for PIC32
S1D13700_TxtFill 312 S1D13700_Display_GrLayer 312 S1D13700_Display_TxtLayer 313 S1D13700_Set_Cursor 313 S1D13700_Display_Cursor 314 S1D13700_Write_Char 314 S1D13700_Write_Text 315 S1D13700_Dot 315 S1D13700_Line 316 S1D13700_H_Line 316 S1D13700_V_Line 317 S1D13700_Rectangle 317 S1D13700_Box 318 S1D13700_Rectangle_Round_Edges 318 S1D13700_Rectangle_Round_Edges_Fill 319 S1D13700_Circle 319 S1D13700_Circle_Fill 320 S1D13700_Image 320 S1D13700_PartialImage 321
Flash Memory Library 322
Library Routines 322 Flash_Write_Word 323 Flash_Write_Row 323 Flash_Erase_Page 323
Graphic Lcd Library 324
Library Dependency Tree 324 External dependencies of Graphic Lcd Library 325 Glcd_Init 326 Glcd_Set_Side 328 Glcd_Set_X 328 Glcd_Set_Page 328 Glcd_Read_Data 329 Glcd_Write_Data 329 Glcd_Fill 330 Glcd_Dot 330 Glcd_Line 330 Glcd_V_Line 331 Glcd_H_Line 331 Glcd_Rectangle 332 Glcd_Rectangle_Round_Edges 332 Glcd_Rectangle_Round_Edges_Fill 333 Glcd_Box 333 Glcd_Circle 334 Glcd_Circle_Fill 334 Glcd_Set_Font 335 Glcd_Write_Char 336 Glcd_Write_Text 336
MikroElektronika
14
mikroC PRO for PIC32
Glcd_Image 337 Glcd_PartialImage 337
I²C Library 338
Library Routines 338 I2Cx_Init 338 I2Cx_Init_Advanced 339 I2Cx_Start 339 I2Cx_Restart 340 I2Cx_Is_Idle 340 I2Cx_Read 341 I2Cx_Write 341 I2Cx_Stop 342 Library Example 342
Keypad Library 344
External dependencies of Keypad Library 344 Library Routines 344 Keypad_Init 344 Keypad_Key_Press 345 Keypad_Key_Click 345 Library Example 346 HW Connection 347
Lcd Library 348
Library Dependency Tree 348 Keypad_Key_Click 348 Library Routines 348 Lcd_Init 349 Lcd_Out 350 Lcd_Out_Cp 350 Lcd_Chr 350 Lcd_Chr_Cp 351 Lcd_Cmd 351 Available Lcd Commands 351 Library Example 352
Manchester Code Library 354
External dependencies of Manchester Code Library 354 Library Routines 355 Man_Receive_Init 355 Man_Receive 356 Man_Send_Init 356 Man_Send 357 Man_Synchro 357 Man_Break 358 Library Example 359 Connection Example 361
Memory Manager Library 362
Library Routines 362
15
MikroElektronika
mikoC PRO for PIC32
Heap_Init 362 malloc 362 free 363 LargestFreeMemBlock 363 TotalFreeMemSize 363
Multi Media Card Library 364
Secure Digital Card 364 Secure Digital High Capacity Card 364 Library Dependency Tree 365 External dependencies of MMC Library 365 Library Routines 365 Mmc_Init 366 Mmc_Read_Sector 367 Mmc_Write_Sector 367 Mmc_Read_Cid 368 Mmc_Read_Csd 368 Mmc_Fat_Init 369 Mmc_Fat_QuickFormat 370 Mmc_Fat_Assign 371 Mmc_Fat_Reset 372 Mmc_Fat_Read 372 Mmc_Fat_Rewrite 373 Mmc_Fat_Append 373 Mmc_Fat_Delete 373 Mmc_Fat_Write 374 Mmc_Fat_Set_File_Date 374 Mmc_Fat_Get_File_Date 375 Mmc_Fat_Get_File_Date_Modied 376 Mmc_Fat_Get_File_Size 376 Mmc_Fat_Get_Swap_File 377 Library Example 378 HW Connection 382
OneWire Library 383
Library Routines 383 Ow_Reset 383 Ow_Read 384 Ow_Write 384
Port Expander Library 385
Library Dependency Tree 385 External dependencies of Port Expander Library 385 Library Routines 385 Expander_Init 386 Expander_Init_Advanced 387 Expander_Read_Byte 388 Expander_Write_Byte 388 Expander_Read_PortA 388
MikroElektronika
16
mikroC PRO for PIC32
Expander_Read_PortB 389 Expander_Read_PortAB 389 Expander_Write_PortA 390 Expander_Write_PortB 390 Expander_Write_PortAB 391 Expander_Set_DirectionPortA 391 Expander_Set_DirectionPortB 392 Expander_Set_DirectionPortAB 392 Expander_Set_PullUpsPortA 392 Expander_Set_PullUpsPortB 393 Expander_Set_PullUpsPortAB 393 Library Example 394 HW Connection 395
PS/2 Library 396
External dependencies of PS/2 Library 396 Library Routines 396 Ps2_Cong 397 Ps2_Key_Read 397 Special Function Keys 398 Library Example 399 HW Connection 400
PWM Library 400
Library Routines 400 PWM_Init 401 PWM_Init_Advanced 401 PWM_Set_Duty 402 PWM_Start 402 PWM_Stop 402 Library Example 403 HW Connection 404
RS-485 Library 405
Library Dependency Tree 405 External dependencies of RS-485 Library 405 Library Routines 406 RS485Master_Init 406 RS485Master_Receive 407 RS485Master_Send 407 RS485Slave_Init 408 RS485Slave_Receive 409 RS485Slave_Send 409 Library Example 410 HW Connection 413 Message format and CRC calculations 414
Software I²C Library 415
External dependencies of Software I²C Library 415 Library Routines 415
17
MikroElektronika
mikoC PRO for PIC32
Soft_I2C_Init 416 Soft_I2C_Start 416 Soft_I2C_Read 417 Soft_I2C_Write 417 Soft_I2C_Stop 417 Soft_I2C_Break 418 Library Example 419
Software SPI Library 421
External dependencies of Software SPI Library 421 Library Routines 421 Soft_SPI_Init 422 Soft_SPI_Read 423 Soft_SPI_Write 423 Library Example 423
Software UART Library 425
Library Routines 425 Soft_UART_Init 425 Soft_UART_Read 426 Soft_UART_Write 426 Soft_UART_Break 427 Library Example 428
Sound Library 430
Library Routines 430 Sound_Init 430 Sound_Play 430 HW Connection 432
SPI Library 433
Library Routines 433 SPIx_Init 434 SPIx_Init_Advanced 435 SPIx_Read 437 SPIx_Write 437 SPI_Set_Active 438 Library Example 438 HW Connection 440
SPI Ethernet Library 441
Library Dependency Tree 441 External dependencies of SPI Ethernet Library 442 Library Routines 443 SPI_Ethernet_Init 443 SPI_Ethernet_Enable 445 SPI_Ethernet_Disable 446 SPI_Ethernet_doPacket 447 SPI_Ethernet_putByte 447 SPI_Ethernet_putBytes 448 SPI_Ethernet_putConstBytes 448
MikroElektronika
18
mikroC PRO for PIC32
SPI_Ethernet_putString 448 SPI_Ethernet_putConstString 449 SPI_Ethernet_getByte 449 SPI_Ethernet_getBytes 449 SPI_Ethernet_UserTCP 450 SPI_Ethernet_UserUDP 451 SPI_Ethernet_getIpAddress 452 Ethernet_getGwIpAddress 452 SPI_Ethernet_getDnsIpAddress 452 SPI_Ethernet_getIpMask 453 SPI_Ethernet_confNetwork 453 SPI_Ethernet_arpResolve 454 SPI_Ethernet_sendUDP 454 SPI_Ethernet_dnsResolve 455 SPI_Ethernet_initDHCP 456 SPI_Ethernet_doDHCPLeaseTime 456 SPI_Ethernet_renewDHCP 457 Library Example 458 HW Connection 465
SPI Ethernet ENC24J600 Library 466
Library Dependency Tree 466 External dependencies of SPI Ethernet ENC24J600 Library 467 Library Routines 468 SPI_Ethernet_24j600_Init 469 SPI_Ethernet_24j600_Enable 471 SPI_Ethernet_24j600_Disable 472 SPI_Ethernet_24j600_doPacket 473 SPI_Ethernet_24j600_putByte 473 SPI_Ethernet_24j600_putBytes 474 SPI_Ethernet_24j600_putConstBytes 474 SPI_Ethernet_24j600_putString 475 SPI_Ethernet_24j600_putConstString 475 SPI_Ethernet_24j600_getByte 475 SPI_Ethernet_24j600_getBytes 476 SPI_Ethernet_24j600_UserTCP 476 SPI_Ethernet_24j600_UserUDP 477 SPI_Ethernet_24j600_getIpAddress 477 SPI_Ethernet_24j600_getGwIpAddress 478 SPI_Ethernet_24j600_getDnsIpAddress 478 SPI_Ethernet_24j600_getIpMask 479 SPI_Ethernet_24j600_confNetwork 479 SPI_Ethernet_24j600_arpResolve 480 SPI_Ethernet_24j600_sendUDP 480 SPI_Ethernet_24j600_dnsResolve 481 SPI_Ethernet_24j600_initDHCP 482 SPI_Ethernet_24j600_doDHCPLeaseTime 483 SPI_Ethernet_24j600_renewDHCP 483
19
MikroElektronika
mikoC PRO for PIC32
SPI Graphic Lcd Library 484
Library Dependency Tree 484 External dependencies of SPI Lcd Library 484 Library Routines 484 SPI_Glcd_Init 485 SPI_Glcd_Set_Side 486 SPI_Glcd_Set_Page 486 SPI_Glcd_Set_X 486 SPI_Glcd_Read_Data 487 SPI_Glcd_Write_Data 487 SPI_Glcd_Fill 488 SPI_Glcd_Dot 488 SPI_Glcd_Line 489 SPI_Glcd_V_Line 489 SPI_Glcd_H_Line 490 SPI_Glcd_Rectangle 490 SPI_Glcd_Rectangle_Round_Edges 491 SPI_Glcd_Rectangle_Round_Edges_Fill 491 SPI_Glcd_Box 492 SPI_Glcd_Circle 492 SPI_Glcd_Circle_FIll 493 SPI_Glcd_Set_Font 494 SPI_Glcd_Write_Char 495 SPI_Glcd_Write_Text 495 SPI_Glcd_Image 496 SPI_Glcd_PartialImage 496 Library Example 497 HW Connection 499
SPI Lcd Library 500
Library Dependency Tree 500 External dependencies of SPI Lcd Library 500 Library Routines 500 SPI_Lcd_Cong 501 SPI_Lcd_Out 501 SPI_Lcd_Out_Cp 502 SPI_Lcd_Chr 502 SPI_Lcd_Chr_Cp 502 SPI_Lcd_Cmd 503 Available SPI Lcd Commands 503 Library Example 504 Default Pin Conguration 504
SPI Lcd8 (8-bit interface) Library 506
Library Dependency Tree 506 External dependencies of SPI Lcd Library 506 Library Routines 506 SPI_Lcd8_Cong 507
MikroElektronika
20
mikroC PRO for PIC32
SPI_Lcd8_Out 508 SPI_Lcd8_Out_Cp 508 SPI_Lcd8_Chr 508 SPI_Lcd8_Chr_Cp 509 SPI_Lcd8_Cmd 509 Available SPI Lcd8 Commands 510 Library Example 510
SPI T6963C Graphic Lcd Library 513
Library Dependency Tree 513 External dependencies of SPI T6963C Graphic Lcd Library 513 Library Routines 514 SPI_T6963C_cong 515 SPI_T6963C_writeData 516 SPI_T6963C_writeCommand 516 SPI_T6963C_setPtr 517 SPI_T6963C_waitReady 517 SPI_T6963C_ll 517 SPI_T6963C_dot 518 SPI_T6963C_write_char 518 SPI_T6963C_write_text 519 SPI_T6963C_line 520 SPI_T6963C_rectangle 520 SPI_T6963C_rectangle_round_edges 521 SPI_T6963C_rectangle_round_edges_ll 521 SPI_T6963C_box 522 SPI_T6963C_circle 522 SPI_T6963C_circle_ll 522 SPI_T6963C_image 523 SPI_T6963C_PartialImage 523 SPI_T6963C_sprite 524 SPI_T6963C_set_cursor 524 SPI_T6963C_clearBit 524 SPI_T6963C_setBit 525 SPI_T6963C_negBit 525 SPI_T6963C_displayGrPanel 525 SPI_T6963C_displayTxtPanel 526 SPI_T6963C_setGrPanel 526 SPI_T6963C_setTxtPanel 526 SPI_T6963C_panelFill 527 SPI_T6963C_grFill 527 SPI_T6963C_txtFill 527 SPI_T6963C_cursor_height 528 SPI_T6963C_graphics 528 SPI_T6963C_text 528 SPI_T6963C_cursor 529 SPI_T6963C_cursor_blink 529 Library Example 529
21
MikroElektronika
mikoC PRO for PIC32
HW Connection 535
T6963C Graphic Lcd Library 536
Library Dependency Tree 536 External dependencies of T6963C Graphic Lcd Library 537 Library Routines 538 T6963C_init 539 T6963C_writeData 540 T6963C_writeCommand 541 T6963C_setPtr 541 T6963C_waitReady 541 T6963C_ll 542 T6963C_dot 542 T6963C_write_char 543 T6963C_write_text 544 T6963C_line 544 T6963C_rectangle 545 T6963C_rectangle_round_edges 545 T6963C_rectangle_round_edges_ll 546 T6963C_box 546 T6963C_circle 546 T6963C_circle_ll 547 T6963C_image 547 T6963C_PartialImage 548 T6963C_sprite 548 T6963C_set_cursor 549 T6963C_clearBit 549 T6963C_setBit 549 T6963C_negBit 550 T6963C_displayGrPanel 550 T6963C_displayTxtPanel 550 T6963C_setGrPanel 551 T6963C_setTxtPanel 551 T6963C_panelFill 551 T6963C_grFill 552 T6963C_txtFill 552 T6963C_cursor_height 552 T6963C_graphics 553 T6963C_text 553 T6963C_cursor 553 T6963C_cursor_blink 554 Library Example 554 HW Connection 560
TFT Library 561
External dependencies of TFT Library 561 Library Routines 562 TFT_Init 563
MikroElektronika
22
mikroC PRO for PIC32
TFT_Set_Index 564 TFT_Write_Command 564 TFT_Write_Data 564 TFT_Set_Active 565 TFT_Set_Font 566 TFT_Write_Char 567 TFT_Write_Text 567 TFT_Fill_Screen 568 TFT_Dot 569 TFT_Set_Pen 570 TFT_Set_Brush 571 TFT_Line 573 TFT_H_Line 574 TFT_V_Line 574 TFT_Rectangle 574 TFT_Rectangle_Round_Edges 575 TFT_Circle 575 TFT_Image 575 TFT_Partial_Image 576 TFT_Image_Jpeg 576 TFT_RGBToColor16bit 577 TFT_Color16bitToRGB 577 HW Connection 578
Touch Panel Library 579
Library Dependency Tree 579 External dependencies of Touch Panel Library 579 Library Routines 579 TP_Init 580 TP_Set_ADC_Threshold 580 TP_Press_Detect 581 TP_Get_Coordinates 582 TP_Calibrate_Bottom_Left 582 TP_Calibrate_Upper_Right 582 TP_Get_Calibration_Consts 583 TP_Set_Calibration_Consts 583
Touch Panel TFT Library 584
Library Dependency Tree 584 External dependencies of Touch Panel TFT Library 584 Library Routines 584 TP_TFT_Init 585 TP_TFT_Set_ADC_Threshold 585 TP_TFT_Press_Detect 586 TP_TFT_Get_Coordinates 587 TP_TFT_Calibrate_Min 587 TP_TFT_Calibrate_Max 587 TP_TFT_Get_Calibration_Consts 588
23
MikroElektronika
mikoC PRO for PIC32
TP_TFT_Set_Calibration_Consts 588 HW Connection 589
UART Library 590
Library Routines 590 UARTx_Init 591 UARTx_Init_Advanced 592 UARTx_Data_Ready 593 UARTx_Tx_Idle 593 UARTx_Read 594 UARTx_Read_Text 595 UARTx_Write 596 UARTx_Write_Text 596 UART_Set_Active 597 Library Example 598 HW Connection 599
USB Library 600
USB HID Class 600 Descriptor File 600 Library Routines 600 HID_Enable 601 HID_Read 601 HID_Write 601 HID_Disable 602 USB_Interrupt_Proc 602 USB_Polling_Proc 603 Gen_Enable 603 Gen_Read 604 Gen_Write 604 Library Example 605 HW Connection 605
Standard ANSI C Libraries 606 ANSI C Ctype Library 606
Library Functions 606 isalnum 607 isalpha 607 iscntrl 607 isdigit 607 isgraph 607 islower 608 ispunct 608 isspace 608 isupper 608 isxdigit 608 toupper 609 tolower 609
ANSI C Math Library 610
MikroElektronika
24
mikroC PRO for PIC32
Library Functions 610 acos 610 asin 611 atan 611 atan2 611 ceil 611 cos 611 cosh 612 exp 612 fabs 612 oor 612 frexp 612 ldexp 613 log 613 log10 613 modf 613 pow 613 sin 614 sinh 614 sqrt 614 tan 614 tanh 614
ANSI C Stdlib Library 615
Library Dependency Tree 615 Library Functions 615 abs 615 atof 616 atoi 616 atol 616 div 616 ldiv 617 uldiv 617 labs 617 max 617 min 618 rand 618 srand 618 xtoi 618 Div Structures 619
ANSI C String Library 620
Library Functions 620 memchr 620 memcmp 621 memcpy 621 memmove 621 memset 622 strcat 622
25
MikroElektronika
mikoC PRO for PIC32
strchr 622 strcmp 623 strcpy 623 strlen 623 strncat 624 strncpy 624 strspn 624 strncmp 625 strstr 625 strcspn 625 strpbrk 626 strrchr 626 strtok 627
Miscellaneous Libraries 628 Button Library 628
Library Routines 628 Button 628
Conversions Library 630
Library Dependency Tree 630 Library Routines 630 ByteToStr 631 ShortToStr 631 WordToStr 632 IntToStr 632 LongToStr 633 LongWordToStr 633 FloatToStr 634 WordToStrWithZeros 634 IntToStrWithZeros 635 LongWordToStrWithZeros 635 LongIntToStrWithZeros 636 ByteToHex 636 ShortToHex 637 WordToHex 637 IntToHex 638 LongWordToHex 638 LongIntToHex 639 Dec2Bcd 639 Bcd2Dec 640 Dec2Bcd16 640 Bcd2Dec16 640 Rtrim 641 Ltrim 641
PrintOut Library 642
Library Dependency Tree 642 Library Routines 642
MikroElektronika
26
mikroC PRO for PIC32
PrintOut 642
Setjmp Library 646
Library Routines 646 Setjmp 646 Longjmp 647 Library Example 647
Sprint Library 649
Library Dependency Tree 649 Functions 649 sprintf 649 sprintl 651 sprinti 651 Library Example 652
Time Library 653
Library Routines 653 Time_dateToEpoch 653 Time_epochToDate 654 Time_dateDiff 654 Library Example 655
Trigonometry Library 656
Library Routines 656 sinE3 656 cosE3 656
CHAPTER 10 657 Tutorials 657
Managing Project 657
Projects 657
New Project 658
New Project Wizard Steps 658
New Project 661
New Project Wizard Steps 661
Customizing Projects 665
Managing Project Group 665 Add/Remove Files from Project 665 Project Level Denes: 666
Add/Remove Files from Project 667
Project Level Denes: 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 com­piler ? 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 unied 4GB virtual memory space, with powerful
peripherals to address a wide range of applications.
Having a wide range of application, being prized for its efciency, 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
Specics 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
Specics 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”)
identied 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 condential 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 trafc 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 specically disclaim any expressed or implied warranty of tness for High Risk Activities.

GENERAL PROVISIONS

This statement may only be modied in writing signed by you and an authorised ofcer 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 specic legal rights; you may have others, which vary, from country to country. mikroElektronika Associates reserves all rights not specically granted in this statement.
mikroElektronika
Visegradska 1A, 11000 Belgrade, Europe.
Phone: + 381 11 36 28 830 Fax: +381 11 36 28 831 Web: www.mikroe.com E-mail: ofce@mikroe.com
33
MikroElektronika
mikoC PRO for PIC32

Technical Support

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 efciently, 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 ofine, 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 ofine 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 specied 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.
File Description
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.
Edit Description
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 specied text. The search is performed in the direction specied. 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 specied in the Text to nd eld. If Search in directories option is selected, The les to search are specied 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.
mikoC PRO for PIC32
MikroElektronika
44
mikroC PRO for PIC32
View Description
Show/Hide Software Simulator / mikroICD (In-Circuit Debugger) Debug Windows.
Show/Hide Toolbars.
Show/Hide Bookmarks window.
Show/Hide Code Explorer window.
Show/Hide Library Manager window.
Show/Hide Macro Editor window.
Show/Hide Messages window.
Show/Hide Project Manager window.
Show/Hide Project Settings window.
Show/Hide Routine List in active editor.
Show/Hide Quick Converter window.
Show/Hide View Image Preview window.
View Assembly.
View Listing.
View Statistics.
Show Window List window.
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.
Project Description
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.
Build Description
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.
Run Description
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.
Tools Description
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

Help Description
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 identiers 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 dened 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 identiers 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 specied in project settings
- %DEVICE_CLOCK% - clock as specied 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 dened 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:
Icon Description
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:
Icon Description
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 Check All and all libraries will be selected.
In case none library is needed in a project, press the button Clear All and all libraries will be cleared from the
project.
Only the selected libraries will be linked.
Icon Description
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 notications 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 notications 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:
Icon Description
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:
Icon Description
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:
Icon Description
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:
Icon Description
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:
Icon Description
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:
Icon Description
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:
Icon Description
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:
Icon Description
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:
Icon Description
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.
Icon Description
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:
Icon Description
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 congure 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 specic settings, which include case sensitivity, dynamic link for string literals setting (described in mikroC PRO for PIC32 specics).
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 conguring interrupts. Output is the code for the congured 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 dened 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 predened 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 (dened 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...