PIC16F887 MPLAB IDE Multiple Projects Creation Multi-Machine Simulation

Publisher:cyzceeLatest update time:2021-01-11 Source: eefocusKeywords:PIC16F887  MPLAB  IDE  engineering Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.
insert image description here
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.
insert image description here
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.
insert image description here
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.

insert image description here

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.

insert image description here
6.
We have created our first project. The following figure shows the perspective we should see.
insert image description here
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.

insert image description here
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.
insert image description here
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.
insert image description here
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.
insert image description here

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.
insert image description here
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.

insert image description here
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.
insert image description here
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.
insert image description here

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.

insert image description here
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.


Keywords:PIC16F887  MPLAB  IDE  engineering Reference address:PIC16F887 MPLAB IDE Multiple Projects Creation Multi-Machine Simulation

Previous article:PIC16F887 Practical Programming Microcontroller Programming Basic Experiment Tutorial
Next article:Several issues that need attention in PIC microcontroller development

Latest Microcontroller Articles
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号