Introduction to Keil C51 and MCU Development

Publisher:tony520Latest update time:2021-07-05 Source: eefocusKeywords:Keil Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Step 1: Install the development tools

I downloaded Keil 4 (MDK) according to the book, but encountered various problems and could not install the STC series products. I calmed down and thought about it, changed my mind, and re-downloaded the development tool, keil C51. The regular download link is: https://www.keil.com/download/product/ , select C51. If you can't download it, there is another link at the end of this article.

       

After installation, you need to register, open keil, select File - Liscense Management, copy the CID, enter the CID in the registration tool, click "Generate", copy the generated serial number to the New Liscense ID Code dialog box in the "Liscense Management" form, then click "Add LIC", and the registration is successful.

 

Step 2: Import STC product library

Download STC-ISP,  http://www.stcisp.com/   . After opening the software, select "Keil Simulation Settings", click "Add Model and Header File to Keil to Add STC Simulator Driver to Keil", and follow the prompts.

 

Step 3: Create a new project

In Keil, "Project - new uVision Project", fill in the project name, and in the target device dialog box, select the target microcontroller.

After the project is established, create a new file, enter the code, and save it as "XXX.c" with the .c extension.

Then right-click "Source Group1", select "Add Existing Files to Group 'Source Group 1'", and add the code file saved in the previous step.

 

Step 4: Generate HEX file

Click the "Options for Target" button in the toolbar.

In the pop-up dialog box, set the crystal oscillator (Xtal) to 12Mhz

In the Output tab, check Create HEX File

After saving, click the "Rebuild" button and observe the output information. If there is no error prompt, it is successful.

The generated file name is "project name".hex

 

Step 5: Burn the program to the development board

Open STC-ISP, click "Open Program File", select the hex file generated in the previous step, connect the development board to the computer, and set the serial port number.

Click "Download/Program" and the program will be burned to the lower computer.

If the software gets stuck at the step "Detecting target MCU...", don't panic. You can complete the process by powering on the development board again.

As written in the previous program, the light of P1.0 is on.

 

Development tool download: https://download.csdn.net/download/zhouyingge1104/10991154


Keywords:Keil Reference address:Introduction to Keil C51 and MCU Development

Previous article:Function pointers in C51
Next article:PCON Register Experiment Report

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号