Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Use Keil uVision to build a new project

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

As far as the single-chip microcomputer program is concerned, every function program must have a matching project (Project). Even lighting such a complex function program like LED is no exception, so we start a new project first. After opening our Keil software, click: Project-- > New uVision Project... A new project interface is then presented, as shown in figure 2-8.

Figure 2-8 create a new project

Now that we are talking about the second chapter, so we set up a lesson2 list on the hard disk, and then specify the way of the LED project here, so as to facilitate future governance procedures, different functional procedures are placed in different folders, and give the project a name LED, the software will take the initiative to add an extension .uvproj. This is shown in figure 2-9.

Figure 2-9 safekeeping project

We can keep it directly, the project will take the initiative to keep it as a LED.uvproj file, and when you mainly open the LED project, you can directly find the folder and double-click the .uvproj file to open it directly.

After storage, a dialog box will pop up, which allows us to choose the single-chip microcomputer model. As the Keil software is developed by local people, our international STC89C52 is not on the list, but we only need to choose similar models. Since the 51 kernel was invented by Intel, here we directly choose 80/87C52 under the name of Intel to replace it. The choice of this option does not have any adverse effect on the later programming. This is shown in figure 2-10.

Figure 2-10 selection of single-chip microcomputer model

After clicking OK, a dialog box pops up. As shown in figure 2-11, each project requires a piece of startup code. If you click "No", the compiler will take the initiative to deal with this result. If you click "Yes", the local code will be provided to our users, and we can stop the local code according to the demand. Then this partial code usually does not need to be modified during this period of time when we first learn 51. However, with the improvement of skills and the expansion of common sense, we will be able to understand this piece of content, so in this center, we choose "Yes" to let the code appear, but we do not need to correct it temporarily. Everyone knows that.

Figure 2-11 Startup code selection

In this way, the project is set up, as shown in figure 2-12. If we click the plus sign to the right of Target 1, it will show the initialization file STARTUP.A51 that we have just participated in, which we will ignore.

Figure 2-12 Engineering documents

After the project is in place, we need to set up a file for writing code, click File-- > New, as shown in figure 2-13, and create a new file, which is the platform on which we write the program. Then click File-- > Save or click the shortcut key of who Save directly, you can keep the file, when we keep it, we name it LED.c, this central must add .c, because if you write assembly words, the expanded name of this central is .asm, the header file is .h, etc., what we are writing is the C language program, this central must add the extension .c of the file, as shown in figure 2-14.

Figure 2-13 create a new file

Figure 2-14 keeping documents

Now we can output our program code in the file we have set up, and there is one more task to do before we write it. Every time we do a function program, we must build a new project, and a project represents a function to be completed by a single-chip microcomputer. However, for a project, sometimes we can divide our program into multiple files, so every time we write a file, we have to add it to the project we have set up, right-click Source Group 1, click Add Files to GroupSource Group 1. As shown in figure 2-15.

Figure 2-15 add files (1)

In the pop-up dialog box, click LED.c to select it, and then click Add, or double-click LED.c directly to join the file under the project, and then click Close to close add. At this point, everyone will see another LED.c file under Source Group 1.

Figure 2-16 add files (2)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report