Before reading the content here, you have already installed the environment and can do a basic experiment. That is the content of the following three links.
https://blog.csdn.net/x1131230123/article/details/100907773
https://blog.csdn.net/x1131230123/article/details/106951776
https://blog.csdn.net/x1131230123/article/details/108757436Now
you should know that the C language program we write needs to be compiled into a machine file that the machine can understand with the help of a compiler, that is, a hex file. At the same time, you should also know where the file directory of this hex file is located. Then you can read the following content:
1.
If we have 4 single-chip microcomputers in the simulation diagram, then the programs required for each single-chip microcomputer are different, and each program file is generated by a project, so we need to create 4 new projects. Of course, if the experiment you are doing only requires three or two MCUs in the simulation diagram, then you need to create the corresponding number of projects.
In the following steps, I assume that I am working on a topic that requires two MCUs, and I need to create two new project files. The following steps will show the specific operations.
2.
First we need to create a new folder on the desktop. It must be in English.
3.
Then we open MPLAB. In the situation shown in the figure below, there are other projects in the software, which does not look good. It is recommended to delete it directly. How to delete it? Right-click the project name in the figure below, and then press the delete button on the keyboard.
You will see this page. This page is telling you whether you want to remove it. Click yes. This operation directly removes the project from the IDE, but does not delete the project file from your disk storage. You can still find your previous files in the project file directory you created before. But if you check the option above and click yes, it means that you have deleted the entire project file cleanly.
4.
If you open the software and see the situation shown in the figure below, there is no project file in the IDE. Then we can proceed to the next step.
5.
Create a new project according to the content of blog 3, but pay attention to the selection of file directory and project name at the end, it is best to be like the following figure. The first red box in the figure below is the project name. The project name must be in English, and it is best to give it an identifier. For example, I named it gongcheng1 in the figure below. The number here makes it easier for us to identify which project it is. When we see this project name, we know that it is the program required by the first microcontroller. The second red box in the figure below is the selection of the project directory. We first created an empty folder on the desktop. We should select that folder as our project directory. In the figure below, I selected my newly created folder zongwenjian.
These operations are good for the recognition later.
6.
We have created our first project. The following figure shows the perspective we should see.
7.
Similar to creating the first project, we create the second project. The following figure also shows the perspective we should see. This is our second newly created project. We name the project gongcheng2.
8.
According to the rules and principles described above, we can also create more engineering projects. What I want to emphasize is that the project name must be distinguishable, and the project directory must be on the desktop or in a place where you can find it. It is best to put these engineering projects in the same general project directory.
I will not demonstrate the creation of other engineering projects here. I used two projects here. I only have two microcontrollers in the simulation diagram later, and I only need two programs. So now the perspective I see should be that there are two projects in my IDE, as shown in the figure below.
I have already marked the microcontrollers in the simulation diagram later with identifiers in my mind. I call the two microcontrollers that appear in them microcontroller 1 and microcontroller 2 respectively. I will use the program written in this gongcheng1 for microcontroller 1, and I will use the program written in this gongcheng2 for microcontroller 2.
9.
In each project, I should create a main.c to write their respective programs, because the working content of each microcontroller is different, so their programs are also different.
10.
According to the content of blog 3, I should click the icon in the figure below to compile the program, but this is a wrong operation. Please note that we can no longer click this icon to compile the program.
The correct operation is:
If I want to compile our project Gongcheng1, I should use my right mouse button to click on the name of Gongcheng1. Then you will see the option shown in the figure below. At this time, I click build (translated as compile) to compile the C language of the project Gongcheng1 into a machine file. After this operation, we can find the hex machine file we want in the corresponding project directory file. Similarly, if we want to compile the project Gongcheng2, we should right-click the mouse to enter the options of the project Gongcheng2, and then click compile.
11.
After writing all the programs, compile all the programs.
I need to use two single-chip microcomputers in one of my projects, which are the two single-chip microcomputers in the simulation diagram below. I have already remembered the single-chip microcomputer on the left as single-chip microcomputer 1 and the single-chip microcomputer on the right as single-chip microcomputer 2. And I already know in my mind that single-chip microcomputer 1 needs the machine file of Gongcheng1, and single-chip microcomputer 2 needs the machine file of Gongcheng2.
First, I double-click MCU 1, and I need to click the open file button in the picture below to open the machine file of gongcheng 1, and then click OK to complete the setting.
Then I double-click MCU 2, and I need to click the open file button in the picture below to open the machine file of gongcheng 2, and then click OK to complete the setting.
12.
At this time, I have selected different programs for the two microcontrollers in the simulation diagram. I can click Run in the simulation diagram to start the simulation.
13.
It's over now. If I want to do the real thing, I should know that my project uses two single-chip microcomputers, so I should ask the administrator for two experimental boxes to carry out this experiment. Come on.
Previous article:PIC16F887 Practical Programming Microcontroller Programming Basic Experiment Tutorial
Next article:Several issues that need attention in PIC microcontroller development
- Popular Resources
- Popular amplifiers
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Design of ONU in PON System
- Freescale K60
- Help regarding HCMOS and LS-TTL
- Experiment on the effective value method of power consumption measurement
- Design of real-time TS-type fuzzy controller and its application in CAN bus control system
- TI K2 Heterogeneous SoC (66AK&663x) Software Development Difficulties and Software Solutions
- Silicon Laboratories Launches POL Reference Design for Digital Power Applications
- Comparative Analysis of Communication Initialization Setting Method and Application of CC-Link Fieldbus
- This is a simplified circuit for measuring insulation resistance using the unbalanced bridge method.
- The ratio of using Verilog and VHDL