1.双击图标打开Keil软件
2.单击菜单栏[Project]->[New Project]
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766067.png)
3.将新工程保存到一个文件夹
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766070.png)
4.选择一款CPU芯片,这里STC89C52RC对应着Philips的P89V51RD2
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766072.png)
5.提示是否复制8051的启动代码到文件夹,这里选择“否”
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766075.png)
6.完成后,在Project Workspace中可以看到Source Group1
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766077.png)
7.新建一个代码文件
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766080.png)
8.以“*.c”作为后缀名保存
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766083.png)
9.将刚刚保存的文件led.c添加到工程中来
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766085.png)
10.选中源代码文件,添加
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766088.png)
11.可以看到led.c已经在Source Group1中
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766090.png)
12.添加代码如下
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766093.png)
13.单击工具栏上的“OpTIons for target”工具,选择Output标签,勾上“Create HEX File”
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766095.png)
14.按F7编译生成十六进制HEX文件
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766098.png)
15.打开STC_ISP_V480下载工具
16.选择MCU Type为STC89C52RC
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766101.png)
17.打开程序文件,选择刚刚编译好的led.hex文件
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766103.png)
18.打开电脑设备管理器查看51开发板的串口是哪个口,这里是COM4口
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766106.png)
19.选择COM4
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766109.png)
20.单击“Download/下载”按钮,等待下载完成后上电即可!
![[STC89C52RC单片机]如何使用Keil3开发51单片机程序](https://semi-static.oss-cn-hangzhou.aliyuncs.com/article/2023/06/26/1687766111.png)
21.运行效果如下图所示,第一个LED灯亮