It is the first time to use proteus and mdk for C51 simulation experiment

mdk program preparation

Open mdk5, create a new project, select AT89C51
Insert picture description here
configuration to generate a hex file, click the magic wand icon on the main page, select output, check Create HEX File, and then compile a hex file.
Insert picture description here
Right-click the file Source Group 1 for proteus simulation , Select Add New…
Insert picture description here
Select C language file, enter the file name
Enter the corresponding code in the creation file
Insert picture description here
Source code

#include<reg51.h>
#define uint unsigned int 
#define uchar unsigned char 
main()
{ 	  int i;
uint j;
 uchar code tab[16]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};/*?????*/
while(1)
{for(i=0;i<=15;i++)
{P0=tab[i];
for(j=0;j<30000;j++);/*??*/
}
	}
	}

Proteus software design circuit diagram

Component selection:

89c51, transistor (7-SEG-COM-CAT-B), crystal oscillator (CRYSTAL), exclusion (RESPACK-7), resistance (RES), capacitance (CAP), button (button)

Insert picture description here
Power terminal POWER, ground GROUND to
Insert picture description here
complete the drawing.
Insert picture description here
Finally import the hex file generated by the mdk compiler, double-click the c51 chip, and
Insert picture description here
finally debug and run successfully in proteus

to sum up

This time, I did it according to the blog of a blogger. Although I didn't do it myself, I couldn't help but be happy when I succeeded.
Imitation from: https://blog.csdn.net/weixin_46522844/article/details/108954570 .

Guess you like

Origin blog.csdn.net/xianyudewo/article/details/108980466