MikroElektronika mikroPascal PRO for PIC32 User guide

mikroPascal PRO for PIC32
mikroPascal 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
Manual
Compiler
MikroElektronika
mikoPascal PRO for PIC32
Table of Contents
CHAPTER 1 30 INTRODUCTION 30
Introduction to mikroPascal 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 mikroPascal 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
MikroElektronika
2
mikroPascal PRO for PIC32
Help Menu Options 50
mikroPascal 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
3
MikroElektronika
mikoPascal PRO for PIC32
Edit Toolbar 77 Advanced Edit Toolbar 78 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
MikroElektronika
4
mikroPascal PRO for PIC32
Metacharacters - Iterators 109 Metacharacters - Alternatives 110 Metacharacters - Subexpressions 110 Metacharacters - Backreferences 110
Keyboard Shortcuts 111
CHAPTER 3 113 mikroPascal 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 mikroPascal PRO for PIC32 Specics 135
Predened Globals and Constants 136
Predened project level denes 136
Accessing Individual Bits 137
sbit type 138 at keyword 139 bit type 139
Interrupts 140
5
MikroElektronika
mikoPascal PRO for PIC32
Conguring Interrupts 140 Single Vector Mode 140 Multi Vector Mode 140 Interrupt Priorities 141 Interrupts and Register Sets 141 Register Set Selection in Single Vector Mode 141 Interrupts and Register Sets 141 Interrupt Coding Requirements 141 Interrupt Service Routine 141 Function Calls from Interrupt 142 Interrupt Example 143
Linker Directives 144
Directive absolute 144 Directive org 144 Directive orgall 145
Built-in Routines 146
Lo 147 Hi 147 Higher 148 Highest 148 LoWord 149 HiWord 149 Inc 150 Dec 150 Chr 150 Ord 151 SetBit 151 ClearBit 151 TestBit 152 Delay_us 152 Delay_ms 152 VDelay_ms 153 VDelay_advanced_ms 153 Delay_Cyc 153 Delay_Cyc_Long 154 Clock_kHz 154 Clock_MHz 154 Get_Fosc_kHz 155 Get_Fosc_Per_Cyc 155 Reset 155 ClrWdt 156 DisableContextSaving 156 SetFuncCall 157 SetOrg 157 DoGetDateTime 158 GetVersion 158
MikroElektronika
6
mikroPascal PRO for PIC32
KVA0_TO_KVA1 158 KVA1_TO_KVA0 159 KVA_TO_PA 159 PA_TO_KVA0 159 PA_TO_KVA1 159 CP0_GET 160 CP0_SET 160 EnableInterrupts 160 DisableInterrupts 161
Code Optimization 163
Constant folding 163 Constant propagation 163 Copy propagation 163 Value numbering 163 "Dead code" ellimination 163 Stack allocation 163 Local vars optimization 163 Better code generation and local optimization 163
Single Static Assignment Optimization 164
Introduction 164 Proper Coding Recommendations 165 Asm code and SSA optimization 166 Debugging Notes 166 Warning Messages Enhancement 166
CHAPTER 7 168 PIC32 Specics 168
Types Efciency 169 Nested Calls Limitations 169 Variable, constant and routine alignment 169 Boot Start-up Initialization 169
PIC32 Memory Organization 170
PIC32MX Memory Layout 171 Virtual vs Physical Addresses 172
Memory Type Speciers 173
code 173 data 173 rx 173 sfr 173
Read Modify Write Problem 174
CHAPTER 8 178 mikroPascal PRO for PIC32 Language Reference 178
Lexical Elements Overview 180 Whitespace 180
Newline Character 180
7
MikroElektronika
mikoPascal PRO for PIC32
Whitespace in Strings 180
Comments 181
Nested comments 181
Tokens 182
Token Extraction Example 182
Literals 183
Integer Literals 183 Floating Point Literals 183 Character Literals 184 String Literals 184
Keywords 185 Identiers 186
Case Sensitivity 186 Uniqueness and Scope 186 Identier Examples 186
Punctuators 187
Brackets 187 Parentheses 187 Comma 187 Semicolon 188 Colon 188 Dot 188
Program Organization 189
Organization of Main Unit 189 Organization of Other Units 190
Scope and Visibility 191
Scope 191 Visibility 191
Name Spaces 192 Units 193
Uses Clause 193 Main Unit 193 Other Units 194 Interface Section 194 Implementation Section 194
Variables 195
External Modier 195 Variables and PIC32 196
Constants 197 Labels 198 Functions and Procedures 199
Functions 199 Calling a function 199 Example 199
MikroElektronika
8
mikroPascal PRO for PIC32
Procedures 200
Calling a procedure 200 Example 200 Example: 201 Forward declaration 201 Functions reentrancy 202
Types 202
Type Categories 202
Simple Types 203 Derived Types 203 Arrays 204
Array Declaration 204 Constant Arrays 204 Multi-dimensional Arrays 204
Strings 205
String Concatenating 205
Pointers 206
Pointers and memory spaces 206 Function Pointers 207 Example: 207
@ Operator 209 Pointer Arithmetic 209
Assignment and Comparison 209 Pointer Addition 210 Pointer Subtraction 211
Records 212
Accessing Fields 212
Types Conversions 213
Implicit Conversion 213 Promotion 213 Clipping 214
Explicit Conversion 214
Conversions Examples 214
Type Specier 215 Type Qualiers 216
Qualier const 216 Qualier volatile 216
Operators 216 Operators Precedence and Associativity 217 Arithmetic Operators 217
Division by Zero 217 Unary Arithmetic Operators 218
Relational Operators 218
9
MikroElektronika
mikoPascal PRO for PIC32
Relational Operators in Expressions 218
Bitwise Operators 219
Bitwise Operators Overview 219 Logical Operations on Bit Level 219 Unsigned and Conversions 220 Signed and Conversions 220 Bitwise Shift Operators 220
Boolean Operators 221 Unary Operators 221
Unary Arithmetic Operator 221 Unary Bitwise Operator 221 Address and Indirection Operator 221
Sizeof Operator 222
Sizeof Applied to Expression 222 Sizeof Applied to Type 222
Expressions 223
Expression Evaluation 223 General Rule 223 Left side exception 223 Conditional expressions 224 Explicit Typecasting 224
Statements 224 Assignment Statements 225 Compound Statements (Blocks) 225 Conditional Statements 225 If Statement 226
Nested if statements 226
Case Statement 227
Nested Case statement 227
Iteration Statements 228 For Statement 228
Endless Loop 228
While Statement 229 Repeat Statement 229 Jump Statements 230 asm Statement 230
Accessing variables 230 Asm code and SSA optimization 231
With Statement 232 Directives 232 Compiler Directives 232
Directives $DEFINE and $UNDEFINE 233 Directives $IFDEF, $IFNDEF, $ELSE and $ENDIF 233
MikroElektronika
10
mikroPascal PRO for PIC32
Include Directive $I 234
Linker Directives 234
Directive absolute 234 Directive org 235 Directive orgall 235
CHAPTER 9 236 mikroPascal PRO for PIC32 Libraries 236
Hardware Libraries 237 Miscellaneous Libraries 237 Hardware Libraries 238 ADC Library 239
Library Routines 239 ADC1_Init 239 ADC1_Init_Advanced 240 ADC1_Get_Sample 240 ADC1_Read 241 Library Example 242
CANSPI Library 243
Library Dependency Tree 243 External dependencies of CANSPI Library 243 Library Routines 244 CANSPISetOperationMode 244 CANSPIGetOperationMode 245 CANSPIInit 245 CANSPISetBaudRate 247 CANSPISetMask 248 CANSPISetFilter 249 CANSPIRead 250 CANSPIWrite 251 CANSPI Constants 251 CANSPI_OP_MODE Constants 251 CANSPI_CONFIG_FLAGS Constants 252 CANSPI_TX_MSG_FLAGS Constants 253 CANSPI_RX_MSG_FLAGS Constants 253 CANSPI_MASK Constants 254 CANSPI_FILTER Constants 254 Library Example 255 HW Connection 258
Compact Flash Library 259
Library Dependency Tree 259 External dependencies of Compact Flash Library 260 Library Routines 261 Cf_Init 262 Cf_Detect 263 Cf_Enable 263
11
MikroElektronika
mikoPascal PRO for PIC32
Cf_Disable 263 Cf_Read_Init 264 Cf_Read_Byte 264 Cf_Write_Init 264 Cf_Write_Byte 265 Cf_Read_Sector 265 Cf_Write_Sector 265 Cf_Fat_Init 266 Cf_Fat_QuickFormat 266 Cf_Fat_Assign 267 Cf_Fat_Reset 268 Cf_Fat_Read 268 Cf_Fat_Rewrite 269 Cf_Fat_Append 269 Cf_Fat_Delete 269 Cf_Fat_Write 270 Cf_Fat_Set_File_Date 270 Cf_Fat_Get_File_Date 271 Cf_Fat_Get_File_Date_Modied 271 Cf_Fat_Get_File_Size 272 Cf_Fat_Get_Swap_File 272 Library Example 274 HW Connection 279
Epson S1D13700 Graphic Lcd Library 280
External dependencies of the Epson S1D13700 Graphic Lcd Library 280 Library Routines 281 S1D13700_Init 282 S1D13700_Write_Command 283 S1D13700_Write_Parameter 284 S1D13700_Read_Parameter 284 S1D13700_Fill 284 S1D13700_GrFill 285 S1D13700_TxtFill 285 S1D13700_Display_GrLayer 285 S1D13700_Display_TxtLayer 286 S1D13700_Set_Cursor 286 S1D13700_Display_Cursor 287 S1D13700_Write_Char 287 S1D13700_Write_Text 288 S1D13700_Dot 288 S1D13700_Line 289 S1D13700_H_Line 289 S1D13700_V_Line 290 S1D13700_Rectangle 290 S1D13700_Box 291 S1D13700_Rectangle_Round_Edges 291 S1D13700_Rectangle_Round_Edges_Fill 292
MikroElektronika
12
mikroPascal PRO for PIC32
S1D13700_Circle 292 S1D13700_Circle_Fill 293 S1D13700_Image 293 S1D13700_PartialImage 294
Flash Memory Library 294
Library Routines 294 Flash_Write_Word 295 Flash_Write_Row 295 Flash_Erase_Page 295
Graphic Lcd Library 296
Library Dependency Tree 296 External dependencies of Graphic Lcd Library 297 Library Routines 298 Glcd_Init 298 Glcd_Set_Side 300 Glcd_Set_X 300 Glcd_Set_Page 300 Glcd_Read_Data 301 Glcd_Write_Data 301 Glcd_Fill 302 Glcd_Dot 302 Glcd_Line 302 Glcd_V_Line 303 Glcd_H_Line 303 Glcd_Rectangle 304 Glcd_Rectangle_Round_Edges 304 Glcd_Rectangle_Round_Edges_Fill 305 Glcd_Box 305 Glcd_Circle 306 Glcd_Circle_Fill 306 Glcd_Set_Font 307 Glcd_Write_Char 308 Glcd_Write_Text 308 Glcd_Image 309 Glcd_PartialImage 309
I²C Library 310
Library Routines 310 I2Cx_Init 310 I2Cx_Init_Advanced 311 I2Cx_Start 311 I2Cx_Restart 312 I2Cx_Is_Idle 312 I2Cx_Read 313 I2Cx_Write 313 I2Cx_Stop 314 Library Example 314
13
MikroElektronika
mikoPascal PRO for PIC32
Keypad Library 316
External dependencies of Keypad Library 316 Library Routines 316 Keypad_Init 316 Keypad_Key_Press 317 Keypad_Key_Click 317 Library Example 318 HW Connection 319
Lcd Library 320
Library Dependency Tree 320 Keypad_Key_Click 320 Library Routines 320 Lcd_Init 321 Lcd_Out 322 Lcd_Out_Cp 322 Lcd_Chr 322 Lcd_Chr_Cp 323 Lcd_Cmd 323 Available Lcd Commands 323 Library Example 324
Memory Manager Library 326
Library Routines 326 Heap_Init 326 GetMem 326 FreeMem 327 MM_LargestFreeMemBlock 327 MM_TotalFreeMemSize 327
Multi Media Card Library 328
Secure Digital Card 328 Secure Digital High Capacity Card 328 Library Dependency Tree 329 External dependencies of MMC Library 329 Library Routines 329 Mmc_Init 330 Mmc_Read_Sector 331 Mmc_Write_Sector 331 Mmc_Read_Cid 332 Mmc_Read_Csd 332 Mmc_Fat_Init 333 Mmc_Fat_QuickFormat 334 Mmc_Fat_Assign 335 Mmc_Fat_Reset 336 Mmc_Fat_Read 336 Mmc_Fat_Rewrite 337 Mmc_Fat_Append 337 Mmc_Fat_Delete 337
MikroElektronika
14
mikroPascal PRO for PIC32
Mmc_Fat_Write 338 Mmc_Fat_Set_File_Date 338 Mmc_Fat_Get_File_Date 339 Mmc_Fat_Get_File_Date_Modied 340 Mmc_Fat_Get_File_Size 340 Mmc_Fat_Get_Swap_File 341 Library Example 342 HW Connection 347
OneWire Library 347
Library Routines 347 Ow_Reset 348 Ow_Read 348 Ow_Write 348
Port Expander Library 349
Library Dependency Tree 349 External dependencies of Port Expander Library 349 Library Routines 349 Expander_Init 350 Expander_Init_Advanced 351 Expander_Read_Byte 352 Expander_Write_Byte 352 Expander_Read_PortA 352 Expander_Read_PortB 353 Expander_Read_PortAB 353 Expander_Write_PortA 354 Expander_Write_PortB 354 Expander_Write_PortAB 355 Expander_Set_DirectionPortA 355 Expander_Set_DirectionPortB 356 Expander_Set_DirectionPortAB 356 Expander_Set_PullUpsPortA 356 Expander_Set_PullUpsPortB 357 Expander_Set_PullUpsPortAB 357 Library Example 358 HW Connection 359
PS/2 Library 360
External dependencies of PS/2 Library 360 Library Routines 360 Ps2_Cong 361 Ps2_Key_Read 361 Special Function Keys 362 Library Example 363 HW Connection 364
PWM Library 364
Library Routines 364 PWM_Init 365
15
MikroElektronika
mikoPascal PRO for PIC32
PWM_Init_Advanced 365 PWM_Set_Duty 366 PWM_Start 366 PWM_Stop 366 Library Example 367 HW Connection 368
RS-485 Library 369
Library Dependency Tree 369 External dependencies of RS-485 Library 369 Library Routines 370 RS485Master_Init 370 RS485Master_Receive 371 RS485Master_Send 371 RS485Slave_Init 372 RS485Slave_Receive 373 RS485Slave_Send 373 Library Example 374 HW Connection 377 Message format and CRC calculations 378
Software I²C Library 379
External dependencies of Software I²C Library 379 Library Routines 379 Soft_I2C_Init 380 Soft_I2C_Start 380 Soft_I2C_Read 381 Soft_I2C_Write 381 Soft_I2C_Stop 381 Soft_I2C_Break 382 Library Example 383
Software SPI Library 385
External dependencies of Software SPI Library 385 Library Routines 385 Soft_SPI_Init 386 Soft_SPI_Read 387 Soft_SPI_Write 387 Library Example 387
Software UART Library 389
Library Routines 389 Soft_UART_Init 389 Soft_UART_Read 390 Soft_UART_Write 390 Soft_UART_Break 391 Library Example 392
Sound Library 393
Library Routines 393 Sound_Init 393
MikroElektronika
16
mikroPascal PRO for PIC32
Sound_Play 393 Library Example 394 HW Connection 396
SPI Library 397
Library Routines 397 SPIx_Init 398 SPIx_Init_Advanced 399 SPIx_Read 401 SPIx_Write 401 SPI_Set_Active 402 Library Example 402 HW Connection 404
SPI Ethernet Library 405
Library Dependency Tree 405 External dependencies of SPI Ethernet Library 406 Library Routines 407 SPI_Ethernet_Init 407 SPI_Ethernet_Enable 409 SPI_Ethernet_Disable 410 SPI_Ethernet_doPacket 411 SPI_Ethernet_putByte 411 SPI_Ethernet_putBytes 412 SPI_Ethernet_putConstBytes 412 SPI_Ethernet_putString 413 SPI_Ethernet_putConstString 413 SPI_Ethernet_getByte 413 SPI_Ethernet_getBytes 414 SPI_Ethernet_UserTCP 414 SPI_Ethernet_UserUDP 415 SPI_Ethernet_setUserHandlers 415 SPI_Ethernet_getIpAddress 416 Ethernet_getGwIpAddress 416 SPI_Ethernet_getDnsIpAddress 416 SPI_Ethernet_getIpMask 417 SPI_Ethernet_confNetwork 417 SPI_Ethernet_arpResolve 418 SPI_Ethernet_sendUDP 418 SPI_Ethernet_dnsResolve 419 SPI_Ethernet_initDHCP 420 SPI_Ethernet_doDHCPLeaseTime 420 SPI_Ethernet_renewDHCP 421 Library Example 422 HW Connection 429
SPI Ethernet ENC24J600 Library 430
Library Dependency Tree 430 External dependencies of SPI Ethernet ENC24J600 Library 431
17
MikroElektronika
mikoPascal PRO for PIC32
Library Routines 432 SPI_Ethernet_24j600_Init 433 SPI_Ethernet_24j600_Enable 435 SPI_Ethernet_24j600_Disable 436 SPI_Ethernet_24j600_doPacket 437 SPI_Ethernet_24j600_putByte 437 SPI_Ethernet_24j600_putBytes 438 SPI_Ethernet_24j600_putConstBytes 438 SPI_Ethernet_24j600_putString 439 SPI_Ethernet_24j600_putConstString 439 SPI_Ethernet_24j600_getByte 439 SPI_Ethernet_24j600_getBytes 440 SPI_Ethernet_24j600_UserTCP 440 SPI_Ethernet_24j600_UserUDP 441 SPI_Ethernet_24j600_getIpAddress 441 SPI_Ethernet_24j600_getGwIpAddress 442 SPI_Ethernet_24j600_getDnsIpAddress 442 SPI_Ethernet_24j600_getIpMask 443 SPI_Ethernet_24j600_confNetwork 443 SPI_Ethernet_24j600_arpResolve 444 SPI_Ethernet_24j600_sendUDP 444 SPI_Ethernet_24j600_dnsResolve 445 SPI_Ethernet_24j600_initDHCP 446 SPI_Ethernet_24j600_doDHCPLeaseTime 447 SPI_Ethernet_24j600_renewDHCP 447
SPI Graphic Lcd Library 448
Library Dependency Tree 448 External dependencies of SPI Lcd Library 448 Library Routines 448 SPI_Glcd_Init 449 SPI_Glcd_Set_Side 450 SPI_Glcd_Set_Page 450 SPI_Glcd_Set_X 450 SPI_Glcd_Read_Data 451 SPI_Glcd_Write_Data 451 SPI_Glcd_Fill 452 SPI_Glcd_Dot 452 SPI_Glcd_Line 453 SPI_Glcd_V_Line 453 SPI_Glcd_H_Line 454 SPI_Glcd_Rectangle 454 SPI_Glcd_Rectangle_Round_Edges 455 SPI_Glcd_Rectangle_Round_Edges_Fill 455 SPI_Glcd_Box 456 SPI_Glcd_Circle 456 SPI_Glcd_Circle_FIll 457 SPI_Glcd_Set_Font 458
MikroElektronika
18
mikroPascal PRO for PIC32
SPI_Glcd_Write_Char 459 SPI_Glcd_Write_Text 459 SPI_Glcd_Image 460 SPI_Glcd_PartialImage 460 Library Example 461 HW Connection 463
SPI Lcd Library 464
Library Dependency Tree 464 External dependencies of SPI Lcd Library 464 Library Routines 464 SPI_Lcd_Cong 465 SPI_Lcd_Out 465 SPI_Lcd_Out_Cp 466 SPI_Lcd_Chr 466 SPI_Lcd_Chr_Cp 466 SPI_Lcd_Cmd 467 Available SPI Lcd Commands 467 Library Example 468 Default Pin Conguration 468
SPI Lcd8 (8-bit interface) Library 470
Library Dependency Tree 470 External dependencies of SPI Lcd Library 470 Library Routines 470 SPI_Lcd8_Cong 471 SPI_Lcd8_Out 472 SPI_Lcd8_Out_Cp 472 SPI_Lcd8_Chr 472 SPI_Lcd8_Chr_Cp 473 SPI_Lcd8_Cmd 473 Available SPI Lcd8 Commands 474 Library Example 474
SPI T6963C Graphic Lcd Library 477
Library Dependency Tree 477 External dependencies of SPI T6963C Graphic Lcd Library 477 Library Routines 478 SPI_T6963C_cong 479 SPI_T6963C_writeData 480 SPI_T6963C_writeCommand 480 SPI_T6963C_setPtr 481 SPI_T6963C_waitReady 481 SPI_T6963C_ll 481 SPI_T6963C_dot 482 SPI_T6963C_write_char 482 SPI_T6963C_write_text 483 SPI_T6963C_line 484 SPI_T6963C_rectangle 484
19
MikroElektronika
mikoPascal PRO for PIC32
SPI_T6963C_rectangle_round_edges 485 SPI_T6963C_rectangle_round_edges_ll 485 SPI_T6963C_box 486 SPI_T6963C_circle 486 SPI_T6963C_circle_ll 486 SPI_T6963C_image 487 SPI_T6963C_PartialImage 487 SPI_T6963C_sprite 488 SPI_T6963C_set_cursor 488 SPI_T6963C_clearBit 488 SPI_T6963C_setBit 489 SPI_T6963C_negBit 489 SPI_T6963C_displayGrPanel 489 SPI_T6963C_displayTxtPanel 490 SPI_T6963C_setGrPanel 490 SPI_T6963C_setTxtPanel 490 SPI_T6963C_panelFill 491 SPI_T6963C_grFill 491 SPI_T6963C_txtFill 491 SPI_T6963C_cursor_height 492 SPI_T6963C_graphics 492 SPI_T6963C_text 492 SPI_T6963C_cursor 493 SPI_T6963C_cursor_blink 493 Library Example 493 HW Connection 499
T6963C Graphic Lcd Library 500
Library Dependency Tree 500 External dependencies of T6963C Graphic Lcd Library 501 Library Routines 502 T6963C_init 503 T6963C_writeData 504 T6963C_writeCommand 505 T6963C_setPtr 505 T6963C_waitReady 505 T6963C_ll 506 T6963C_dot 506 T6963C_write_char 507 T6963C_write_text 508 T6963C_line 508 T6963C_rectangle 509 T6963C_rectangle_round_edges 509 T6963C_rectangle_round_edges_ll 510 T6963C_box 510 T6963C_circle 510 T6963C_circle_ll 511 T6963C_image 511
MikroElektronika
20
mikroPascal PRO for PIC32
T6963C_PartialImage 512 T6963C_sprite 512 T6963C_set_cursor 513 T6963C_displayGrPanel 513 T6963C_displayTxtPanel 513 T6963C_setGrPanel 514 T6963C_setTxtPanel 514 T6963C_panelFill 514 T6963C_grFill 515 T6963C_txtFill 515 T6963C_cursor_height 515 T6963C_graphics 516 T6963C_text 516 T6963C_cursor 516 T6963C_cursor_blink 517 Library Example 517 HW Connection 524
TFT Library 525
External dependencies of TFT Library 525 Library Routines 526 TFT_Init 527 TFT_Set_Index 528 TFT_Write_Command 528 TFT_Write_Data 528 TFT_Set_Active 529 TFT_Set_Font 530 TFT_Write_Char 531 TFT_Write_Text 531 TFT_Fill_Screen 532 TFT_Dot 533 TFT_Set_Pen 534 TFT_Set_Brush 535 TFT_Line 537 TFT_H_Line 538 TFT_V_Line 538 TFT_Rectangle 538 TFT_Rectangle_Round_Edges 539 TFT_Circle 539 TFT_Image 539 TFT_Partial_Image 540 TFT_Image_Jpeg 540 TFT_RGBToColor16bit 541 TFT_Color16bitToRGB 541 HW Connection 542
Touch Panel Library 543
Library Dependency Tree 543
21
MikroElektronika
mikoPascal PRO for PIC32
External dependencies of Touch Panel Library 543 Library Routines 543 TP_Init 544 TP_Set_ADC_Threshold 544 TP_Press_Detect 545 TP_Get_Coordinates 546 TP_Calibrate_Bottom_Left 546 TP_Calibrate_Upper_Right 546 TP_Get_Calibration_Consts 547 TP_Set_Calibration_Consts 547
Touch Panel TFT Library 548
Library Dependency Tree 548 External dependencies of Touch Panel TFT Library 548 Library Routines 548 TP_TFT_Init 549 TP_TFT_Set_ADC_Threshold 549 TP_TFT_Press_Detect 550 TP_TFT_Get_Coordinates 551 TP_TFT_Calibrate_Min 551 TP_TFT_Calibrate_Max 551 TP_TFT_Get_Calibration_Consts 552 TP_TFT_Set_Calibration_Consts 552 HW Connection 553
UART Library 554
Library Routines 554 UARTx_Init 555 UARTx_Init_Advanced 556 UARTx_Data_Ready 557 UARTx_Tx_Idle 557 UARTx_Read 558 UARTx_Read_Text 559 UARTx_Write 560 UARTx_Write_Text 560 UART_Set_Active 561 Library Example 562 HW Connection 563
USB Library 564
USB HID Class 564 Descriptor File 564 Library Routines 564 HID_Enable 565 HID_Read 565 HID_Write 565 HID_Disable 566 USB_Interrupt_Proc 566 USB_Polling_Proc 567
MikroElektronika
22
mikroPascal PRO for PIC32
Gen_Enable 567 Gen_Read 568 Gen_Write 568 Library Example 569 HW Connection 569
Miscellaneous Libraries 570 Button Library 570
Library Routines 570 Button 570 Button 571
C Type Library 571
Library Functions 571 isalnum 571 isalpha 572 iscntrl 572 isdigit 572 isgraph 572 islower 572 ispunct 573 isspace 573 isupper 573 isxdigit 573 toupper 573 tolower 573
Conversions Library 574
Library Dependency Tree 574 Library Routines 574 ByteToStr 575 ShortToStr 575 WordToStr 576 IntToStr 576 LongToStr 577 LongWordToStr 577 FloatToStr 578 WordToStrWithZeros 578 IntToStrWithZeros 579 LongWordToStrWithZeros 579 LongIntToStrWithZeros 580 ByteToHex 580 ShortToHex 581 WordToHex 581 IntToHex 582 LongWordToHex 582 LongIntToHex 582 StrToInt 583 StrToWord 583
23
MikroElektronika
mikoPascal PRO for PIC32
Bcd2Dec 583 Dec2Bcd 584 Bcd2Dec16 584 Dec2Bcd16 584
Setjmp Library 585
Library Routines 585 Setjmp 585 Longjmp 585 Library Example 586
Sprint Library 587
Library Dependency Tree 587 Functions 587 memchr 588 memcmp 588 memcpy 589 memmove 589 memset 589 strcat 590 strcat2 590 strchr 590 strcmp 591 strcpy 591 strlen 591 strncat 591 strncpy 592 strspn 592 strncmp 592 strstr 593 strcspn 593 strpbrk 593 strrchr 593 ltrim 594 rtrim 594 strappendpre 594 strappendsuf 594 length 594
Time Library 595
Library Routines 595 Time_dateToEpoch 595 Time_epochToDate 596 Time_dateDiff 596 Library Example 596 TimeStruct type denition 597
Trigon Library 598
Library Functions 598 acos 598
MikroElektronika
24
mikroPascal PRO for PIC32
asin 598 atan 599 atan2 599 ceil 599 cos 599 cosh 599 eval_poly 599 exp 600 fabs 600 oor 600 frexp 600 ldexp 600 log 600 log10 600 modf 601 pow 601 sin 601 sinh 601 sqrt 601 tan 601 tanh 601
Trigonometry Library 602
Library Routines 602 sinE3 602 cosE3 602
CHAPTER 10 603 Tutorials 603
Managing Project 603
Projects 603
New Project 604
New Project Wizard Steps 604
Customizing Projects 608
Managing Project Group 608
Add/Remove Files from Project 608
Project Level Denes: 609
Source Files 610 Managing Source Files 610
Creating new source le 610 Opening an existing le 610 Printing an open le 610 Saving le 610 Saving le under a different name 611 Closing le 611
Search Paths 611 Paths for Source Files (.mpas) 612
25
MikroElektronika
mikoPascal PRO for PIC32
Edit Project 613 Clean Project Folder 614 Compilation 615
Output Files 615
Assembly View 615 Creating New Library 616
Multiple Library Versions 616
Frequently Asked Questions 617
Can I use your compilers and programmer on Windows Vista (Windows 7) ? 617 I am getting “Access is denied” error in Vista, how to solve this problem ? 617 What are differences between mikroC PRO, mikroPascal PRO and mikroBasic PRO compilers ? Why do they have different prices ? 617 Why do your PIC compilers don’t support 12F508 and some similar chips ? 617 What are limitations of demo versions of mikroElektronika’s compilers ? 617 Why do I still get demo limit error when I purchased and installed license key ? 617 I have bought license for the older version, do I have to pay license for the new version of the com­piler ? 618 Do your compilers work on Windows Vista (Windows 7) ? 618 What does this function/procedure/routine do ? 618 I try to compile one of the provided examples and nothing happens, what is the problem? 618 Can I get your library sources ? I need to provide all sources with my project. 618 Can I use code I developed in your compilers in commercial purposes ? Are there some limitations ? 618 Why does an example provided with your compilers doesn’t work ? 618 Your example works if I use the same MCU you did, but how to make it work for another MCU ? 618 I need this project nished, can you help me ? 619 Do you have some discount on your compilers/development systems for students/professors ? 619 I have a question about your compilers which is not listed here. Where can I nd an answer ? 619
MikroElektronika
26
mikroPascal PRO for PIC32
27
MikroElektronika
mikoPascal PRO for PIC32
CHAPTER 1
INTRODUCTION
The mikroPascal 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.
mikroPascal PRO for PIC32 IDE
MikroElektronika
28
mikroPascal PRO for PIC32
Introduction to mikroPascal 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. mikroPascal 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
mikroPascal 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 mikroPascal 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.
- mikroPascal 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 Pascal programming, you will probably want to consult mikroPascal 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 mikroPascal PRO for PIC32 Libraries.
- If you are not very experienced in Pascal programming, don’t panic! mikroPascal 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!
29
MikroElektronika
mikoPascal 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
30
mikroPascal 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
31
MikroElektronika
mikoPascal 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 mikroPascal 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 mikroPascal 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 mikroPascal PRO for PIC32, then you should consider the possibility of purchasing the license key.
Who Gets the License Key
Buyers of the mikroPascal PRO for PIC32 are entitled to the license key. After you have completed the payment procedure, you have an option of registering your mikroPascal 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
32
mikroPascal PRO for PIC32
If you choose I work online registering method, following page will be opened in your default browser:
33
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:
mikoPascal 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 mikroPascal PRO for PIC32 at the time of activation.
MikroElektronika
34
mikroPascal 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.
35
MikroElektronika
mikoPascal PRO for PIC32
CHAPTER 2
mikroPascal PRO for PIC32 Environment
MikroElektronika
36
mikroPascal PRO for PIC32
Main Menu Options
Available Main Menu options are:
Related topics: Keyboard shortcuts, Toolbars
37
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.
mikoPascal 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
38
mikroPascal 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
39
MikroElektronika
mikoPascal 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
40
mikroPascal 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
41
MikroElektronika
mikoPascal PRO for PIC32
View
View Menu Options
View Menu contains commands for controlling the on-screen display of the current project.
MikroElektronika
42
mikroPascal 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
43
MikroElektronika
Project
Project Menu Options
Project Menu allows the user to easily manipulate current project.
Project Description
Open New Project Wizard
mikoPascal 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
Import projects created in previous versions of mikroPascal.
Export Project.
Related topics: Keyboard shortcuts, Project Toolbar, Creating New Project, Project Manager, Project Settings
MikroElektronika
44
mikroPascal 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
45
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).
mikoPascal 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
46
mikroPascal 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
47
MikroElektronika
Help
Help Menu Options
Help Description
mikoPascal 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
48
mikroPascal PRO for PIC32
mikroPascal PRO for PIC32 IDE
IDE Overview
The mikroPascal 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 mikroPascal 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).
49
MikroElektronika
mikoPascal 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
50
mikroPascal 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.
51
MikroElektronika
mikoPascal 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
52
mikroPascal 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
53
MikroElektronika
mikoPascal 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
54
mikroPascal 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.
55
MikroElektronika
mikoPascal 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 mikroPascal PRO for PIC32 installation.
MikroElektronika
56
mikroPascal 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.
57
MikroElektronika
mikoPascal 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
58
mikroPascal 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
59
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.
mikoPascal PRO for PIC32
Related topics: Edit Project, Customizing Projects, Project Manager
MikroElektronika
60
mikroPascal 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.
61
MikroElektronika
mikoPascal 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: mikroPascal PRO for PIC Libraries, Creating New Library
MikroElektronika
62
mikroPascal 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.
63
MikroElektronika
Variables
Displays variables sorted by addresses.
mikoPascal PRO for PIC32
Used RAM Locations
Displays used RAM memory locations and their names.
MikroElektronika
64
mikroPascal PRO for PIC32
SFR Locations
Displays list of used SFR locations.
ROM Memory Usage
Displays ROM memory space usage in a pie-like form.
65
MikroElektronika
ROM Memory Constants
Displays ROM memory constants and their addresses.
mikoPascal PRO for PIC32
Functions
Sorts and displays functions in various ways.
MikroElektronika
66
mikroPascal 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.
67
MikroElektronika
Functions Sorted By Addresses
Sorts and displays functions by their addresses, in the ascending order.
mikoPascal PRO for PIC32
Function Tree
Displays Function Tree with the relevant data for each function.
MikroElektronika
68
mikroPascal PRO for PIC32
Memory Summary
Displays summary of RAM and ROM memory in a pie-like form.
69
MikroElektronika
mikoPascal 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
70
mikroPascal 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.
71
MikroElektronika
The Macro offers the following commands:
Icon Description
mikoPascal 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 mikroPascal 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
72
mikroPascal 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:
73
MikroElektronika
mikoPascal 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 mikroPascal 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
74
mikroPascal 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.
75
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
mikoPascal 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
76
mikroPascal 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.
77
MikroElektronika
Debug Toolbar
Debug Toolbar comes with the following options:
Icon Description
mikoPascal 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
78
mikroPascal 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
79
Open assembly code in editor.
Open listing le in editor.
View statistics for current project.
MikroElektronika
mikoPascal 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
80
mikroPascal 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.
81
MikroElektronika
mikoPascal 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
82
mikroPascal 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 mikroPascal 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.
83
MikroElektronika
mikoPascal 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 mikroPascal 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
84
mikroPascal PRO for PIC32
85
MikroElektronika
mikoPascal 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
86
mikroPascal 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.
87
MikroElektronika
mikoPascal 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 mikroPascal PRO for PIC32 IDE - project_name.hex
le will be loaded automatically while ihex le must be loaded manually.
MikroElektronika
88
mikroPascal PRO for PIC32
Graphic Lcd Bitmap Editor
The mikroPascal PRO for PIC32 includes the Graphic Lcd Bitmap Editor. Output is the mikroPascal PRO for PIC32 compatible code. You can launch it from the drop-down menu Tools › Glcd Bitmap Editor.
89
MikroElektronika
mikoPascal PRO for PIC32
HID Terminal
The mikroPascal 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
mikroPascal 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
90
mikroPascal PRO for PIC32
Lcd Custom Character
mikroPascal PRO for PIC32 includes the Lcd Custom Character. Output is mikroPascal PRO for PIC32 compatible code. You can launch it from the drop-down menu Tools › Lcd Custom Character.
91
MikroElektronika
mikoPascal 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 mikroPascal PRO for PIC32 includes the UDP Terminal. You can launch it from the drop-down menu Tools › UDP Terminal.
MikroElektronika
92
mikroPascal PRO for PIC32
USART Terminal
The mikroPascal 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.
93
MikroElektronika
mikoPascal 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
94
mikroPascal 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
95
MikroElektronika
mikoPascal 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
96
mikroPascal 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.
97
MikroElektronika
mikoPascal 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
98
mikroPascal PRO for PIC32
Now, when image has been selected, we can assign an event to it. For example, OnMouseOver will be used for PreviewImage action, and OnLeftClick + Alt will be assigned to OpenUrl action:
Now we can save our changes to Active Comment by clicking the Save button.
Note: Setting le attributes is same as for image, so it won't be explained separately.
Once we have nished creating our active comment, we can notice that it has been added to source le on current caret
position with ac: prex 'telling' IDE that it is active comment:
Now let's try it. If you LeftClick+Alt on it, URL in default Web browser will be opened. If you hover the mouse over it, you will see an Image preview:
99
MikroElektronika
mikoPascal PRO for PIC32
There is another way to add an active comment to an active project. You can do it simply by typing a comment in old fashion way, except with ac: prex. So it would look like this:
Notice that when you stop typing, Add Comment To Project button will show. By clicking on it, you will open Active Comment Editor and comment name will be already set, so you need only to adjust attributes and settings. After saving you can always edit your active comment by Active Comment Editor, and switch between comments directly from editor.
If you remove a le from the Project Manager or add an Active Comment File which contains information about the le which is no longer in project, and hover the mouse over the comment, you will be prompted to either add le to project or remove event denition from Active Comment for this le:
If you remove active comment le from the Project Manager, you'll receive this message:
Click on Yes button you'll prompted for an active comment le:
MikroElektronika
100
Loading...