3815 views|0 replies

1379

Posts

0

Resources
The OP
 

Using C language for PIC microcontroller (I) [Copy link]

Using HitechC Compiler in MPLAB-IDE

1. Load the compiler:

1. Start MPLAB-IDE and select Project-》Install Language Tool as shown below ( Click to view full imagescreen.width-300)this.width=screen.width-300" border=0>

2. In the pop-up Install Language Tool dialog box, the "Language Suite" option now shows Microchip. Click the arrow behind it to select the language.

Click to view full imagescreen.width-300)this.width=screen.width-300" border=0>

The tool I use is HI-TECH PICCME, so I choose "HI-TECH PICC".

3. Next, select the calling path of the compiler component in "Tool Name". Here, you need to set the "PICC Compiler" (C compiler), "PICC Assembler" (assembler) and "PICC Linker" (linker).

Click to view full imagescreen.width-300)this.width=screen.width-300" border=0>

Use "Browse" to select the calling path, and set the calling files of the above three components to PICC.EXE. Click "OK" to complete the setting.

Click to view full imagescreen.width-300)this.width=screen.width-300" border=0>

2. Choose a compiler:

1. Create a new project. The default "Language Tool Suite" column in the Edit Project dialog box is "Microchip". Change it to "HI-TECH PICC".

Click to view full imagescreen.width-300)this.width=screen.width-300" border=0>

2. Click "flasha[.hex]" in the project file box, and the "Node Properties" button will light up. Click to enter.

Click to view full imagescreen.width-300)this.width=screen.width-300" border=0>

3. Set node properties. Since FLASHA.C has other related source programs that need to be added, you should select "PICC Linker" in the "Language Tool" column.

Click to view full imagescreen.width-300)this.width=screen.width-300" border=0>

Usually we can choose:

1) Generate debug info: Display debug information;

2) Create map file: After selecting this option, we will see the usage of ROM and RAM;

3) Error file: displays error information;

4) Compile for MPLAB ICD: If you do not use ICD, you do not need to select this item.

4. After the settings are completed, click "Add Node" to add a node.

Click to view full imagescreen.width-300)this.width=screen.width-300" border=0>

This project has two nodes: fla.c and flasha.c. Select the node and click "Node Properties" or double-click the node to enter the node property settings.

Click to view full imagescreen.width-300)this.width=screen.width-300" border=0>

5. The tool for the node file should be "PICC Compiler" (C compiler). The 4 items in the blue circle are: 1) Display debug information; 2) Local optimization; 3) Global optimization; 4) ICD compilation accessories. Selecting optimization will make the program code more reasonable and reduce the resource usage. Similarly, if you are not using ICD, the 4th item should not be selected.

Click to view full imagescreen.width-300)this.width=screen.width-300" border=0>

6. After completing the above settings, you can compile. The figure below is the compilation interface.

Click to view full imagescreen.width-300)this.width=screen.width-300" border=0>

The following is the interface of successful compilation: the blue box contains the compilation success information; the red box displays the resource usage.

Click to view full imagescreen.width-300)this.width=screen.width-300" border=0>

This post is from Microchip MCU
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list