Using C language for PIC microcontroller (I)

Publisher:知识阁楼Latest update time:2019-10-12 Source: eefocusKeywords:PIC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Using HitechC Compiler in MPLAB-IDE


1. Load the compiler:

    1. Start MPLAB-IDE and select Project-》Install Language Tool as shown belowClick to view full image

    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 image

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, "PICC Compiler" (C compiler), "PICC Assembler" (assembler) and "PICC Linker" (linker) all need to be set.

Click to view full image

      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 image

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 image

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

Click to view full image

    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 image

    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 image

      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 image

      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 image

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

Click to view full image

      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 image


Keywords:PIC Reference address:Using C language for PIC microcontroller (I)

Previous article:The composition of PIC8-bit microcontroller source program
Next article:PIC CCS C language program examples

Recommended ReadingLatest update time:2024-11-16 15:19

Reduce space and improve efficiency: PIC microcontroller A/D conversion data packaging
The data after A/D conversion of PIC microcontroller usually needs to occupy two 8-bit wide RAM units, but the storage units of PIC microcontroller are limited, so the storage units of the microcontroller cannot be effectively utilized. At the same time, it takes a lot of time to transmit data to the host computer thro
[Power Management]
Typical applications and experience sharing of independent buttons of PIC microcontroller human-machine interface module
    The expansion circuit of the independent keyboard is mainly used in instruments, industrial controllers, bar displays, control panels and other equipment with low real-time requirements.   The following are some experiences in application.   When a key is pressed, the bit becomes low, the NAND gate outputs a hig
[Microcontroller]
Summary of PIC microcontroller key errors
1. If the main program entry MIAN is defined as VOID type, a statement error will appear and the program cannot be compiled. Please use the following statement: int main(int argc, char const *argv ) { /* code */ return 0; } 2. When defining the button, try to use high level setting for the port definition to avoid un
[Microcontroller]
PIC microcontroller TIME2
The width of TMR2 is 8 bits, the same as TMR0, and it usually appears together with the CCP module and PWM function. The 8-bit TMR2 timer has a pre-prescaler and a post-prescaler, and a cycle control register that works together with it to count the instruction cycles of the microcontroller. TMR2 can only be used
[Microcontroller]
Issues to be aware of when using PIC microcontroller TIMER1
1. When TMR1H and TMR1L are initialized, the prescaler will be automatically cleared. 2. When the register is written to TMR1H and TMR1L, the prescaler will be cleared. When TMR1 is in operation, writing to TMR1H or TMR1L value may write undesired values. 3. When TMR1 works in asynchronous counting mode, it cannot b
[Microcontroller]
SPI communication software and hardware implementation method based on PIC16F73 microcontroller and ADS8341
    PIC microcontrollers are developed and manufactured by Microchip (Ml-CROChip) in the United States. They are extremely rich in variety, and the functional resources in each series of chips are different, which can meet the development requirements of users at different levels. It adopts Harvard bus structure and r
[Microcontroller]
SPI communication software and hardware implementation method based on PIC16F73 microcontroller and ADS8341
PIC microcontroller DS1302 clock
Hello everyone, through the previous study, we have learned and become familiar with the usage and learning methods of ICD2 simulation burner and enhanced PIC experiment board, and learned how to use single-chip microcomputer to control light-emitting tubes, relays, buzzers, buttons, digital tubes, RS232 serial ports,
[Microcontroller]
PIC microcontroller DS1302 clock
Six new 32-bit PIC32MX5/6/7 microcontrollers (Microchip)
Microchip Technology Inc. (Microchip Technology, Inc.) announced the launch of six new 32-bit PIC32MX5/6/7 microcontroller series products, providing the same integrated Ethernet, CAN, USB and serial connection peripherals with new and more cost-effective storage capacity options. In addition, after design improveme
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号