Summary: This simulation requires the use of PC, keil software , proteus software and the corresponding basic C language knowledge.
Brief summary: Use the 89C51 chip of the single-chip microcomputer to connect 8 LED tubes, and connect a debounce switch from /INT0. Each time you press the switch, the next LED will light up and move down in sequence.
Article Directory
1. LED lighting program compilation
1. Open the Keli 4 software and create a new project file
2. Look for the AT89C51 chip in the Atmel catalog
⑴Expand the Atmel catalog
⑵Select AT89C51 and click to confirm
3. Create a new text under the project for C language compilation
⑴New text
⑵Enter the relevant code
#include<reg51.h>
int0 () interrupt 0
{
P1=P1<<1|0x01;
}
main()
{
P1=0xfe; //选择LED接入口
EA=1;
EX0=1;
IT0=1;
do{
}while(1);
}
* Note: Because the text file was used before, it is still a text file compiled by Keil software at this time.
(3) Compile the text file with C language program
Save the compiled file as a C language source
program. After adding .c to the file name suffix, the file will automatically generate a C language source program.
⑷Add the C language file to the project with C51
At this time, the directory will let you select the files that need to be added, we find the previously saved C language program and click Add
4. Convert C language to hex file
The hex file format is a file format that can be written to and executed by the microcontroller (the explanation comes from Baidu Encyclopedia). So we need to generate a hex file for subsequent software simulation and debugging.
⑴Choose the magic wand
⑵Select "Output" and click "Create HEX File", then click "OK" to confirm.
The quoted text now shows that the hex file has been successfully generated, and the
software preparation is complete
Two, Proteus simulation
1. Open the Proteus software to create a new schematic design
2. Select components to design the circuit
⑴Select the component library, search for the desired component
⑵Draw circuit diagram
This circuit is a little simpler and can run normally after the author's test.
⑶ Put the previous hex file into the C51 chip
Double-click the C51 chip and select the file.
Find the hex file saved in the directory and add it
⑷ Simulation results
Three, summary
Using keil and protues to carry out the most basic software development, initially contacted the relationship between software and hardware, and gradually became clear about the relationship between software and hardware. But it is only an entry-level example, not an in-depth discussion of Proteus and C51 microcontroller.