当前位置:网站首页>LED lighting experiment with simulation software proteus
LED lighting experiment with simulation software proteus
2022-06-12 07:10:00 【luffy5459】
Before this experiment , Make sure that the system is properly installed proteus and keil Tools .proteus It is used to design circuit diagrams ,keil It's for writing c The language code is compiled into the chip usable hex programmatic .
front install keil When , In the end, I mentioned , If installed keil,proteus, During the simulation , You can use it directly proteus. Without opening keil, And then use what kind of joint debugging , need proteus Turn on remote debugging ,keil Open the debug , You need to download an extra one VDM51.dll Dynamic library files , Then configure , Too many locks , And it's a waste of keil resources .
The light here led All the experiments used proteus Software complete .
stay proteus Medium new project : Enter the project name , Choose a save path .

Select template , Select the second radio box , Create from template , This template directly uses the default DEFAULT, This is for drawing design drawings .

This step is to choose PCB Layout , It is also created from the template , Still select the default DEFAULT type .

In this step, choose “ Create a hardware project ”, The English version is :Create Firmware Project.Family choice 8051,Controller choice 80C51, Compiler selection Keil for 8051, If it shows not configured, You have to configure it yourself .

This step , without Keil for 8051 compiler , You can click on Compilers Button , Configure the system installation Keil compiler :

With this option , The project we created , To source code , And it's c Linguistic .

You can then switch views to Schematic Capture, Novices should never switch to PCB Layout View , Otherwise, it will run away . There is a direct 80C51 Chip , We don't have to go to the equipment library to choose .

This experiment is to light up led, We still need to choose other components , Light-emitting diode LED-RED, 220R resistance . stay Schematic Capture Under View , We are working on components Component In mode , Choose the device , Click on "P":

The pop-up box shown below appears : In the keyword input box , Input separately LED-RED,220R Select the diode on the right and 220 Ohmic resistance . Finally, click at the bottom of the page “ok” End selecting components .

Then there is drawing , First select the diode or resistor in the device box , Then left click in the drawing area to drag out the components .
We still need to Terminal Mode Choose “ Grounding ”(GROUND):

Then there is the circuit connection , It's very simple , Directly connect the place you want to connect with the mouse .
The circuit diagram drawn is as follows :

This circuit , The positive pole of the diode is connected to the single chip microcomputer , The negative pole is connected to a resistor , Final grounding , According to the principle of luminescence , Need MCU pin P2.0 Give the high level .
The source code is very simple , It will almost disappoint you :
#include <reg51.h>
#include <stdio.h>
sbit led = P2^0;
void main(void)
{
while (1){
led = 1;
}
}Simulation effect picture :

This experiment , You can continue to do it , Here's just a simple light-emitting diode , In fact, a delay can be used to make the diode flash . The principle is : Turn on high level , Time delay 1 second , Turn on low level , Time delay 1 second , Go back and forth , You can see the diode flashing .
Code :
#include <reg51.h>
#include <stdio.h>
sbit led = P2^0;
void delay()
{
unsigned int i,j;
for(i=0;i<1000;i++)
{
for(j=0;j<110;j++);
}
}
void main(void)
{
while (1){
led = 1;
delay();
led = 0;
delay();
}
}Simulation effect :

It can also be observed that , Directly lit with the front led The difference is ,P2.0 The pin will be red , High level , It's blue for a while , Indicates low level , That's it led Flashing effect .
There is another way to draw the circuit diagram , One end of the resistor is connected to the power supply , such , The direction of the diode needs to be rotated 180 degree , The negative pole of the diode needs to be connected to the development board , The lighting program naturally needs to be modified , If it is flashing , In fact, there is no need to modify .

In all development software , Personally, I think this kind of simulation software is the most fun , Build the circuit , Programming , Finally, simulation , You can see the effect directly , Really excited .
It is worth noting that , I began to choose the pin connection , Direct to P0 Pin , Later, it was found that the diode did not light at the dead or alive point , The simulation does not report an error , Later, I found that I received P2 Pin , It lit up immediately , And when observing experimental phenomena , Find out P0 The pins have not changed at all , Other P1,P2,P3 Will be displayed in red ,P2 Connect the diode pin P2.0 From time to time, it also shows blue , You can see it here ,P0 The pin does not participate in the level output . So pay attention to the wiring .
边栏推荐
- ConVIRT论文详解(医疗图片)
- Database syntax related problems, solve a correct syntax
- Day 4 of pyhon
- Putty installation and use
- D
- Redis supports data structure types
- sql server2019安装到这步无法进行下一步了,如何解决?
- RT thread studio learning summary
- Recommend 17 "wheels" to improve development efficiency
- 3 strings, containers, and arrays
猜你喜欢

descheduler 二次调度让 Kubernetes 负载更均衡

【图像检测】基于深度差分和PCANet实现SAR图像变化检测附matlab代码

Imx6q PWM drive

9 Sequence container

应届生苦恼:是去华为拿1万多低薪,还是去互联网拿2万多高薪

3 strings, containers, and arrays

Day 4 of pyhon

Thoroughly understand the "rotation matrix / Euler angle / quaternion" and let you experience the beauty of three-dimensional rotation

leetcode:890. 查找和替换模式【两个dict记录双射(set)】

RT thread studio learning (x) mpu9250
随机推荐
Redis supports data structure types
Stm32cubemx learning (I) USB HID bidirectional communication
Meituan won the first place in fewclue in the small sample learning list! Prompt learning+ self training practice
Node: cannot open /node: access denied
libprint2
应届生苦恼:是去华为拿1万多低薪,还是去互联网拿2万多高薪
Leetcode: Sword finger offer 66 Build product array [application of pre and post infix]
TypeScript基础知识全集
初中学历,从不到3K,到月薪30K+,不设限的人生有多精彩
When SQL server2019 is installed, the next step cannot be performed. How to solve this problem?
RT thread studio learning summary
RT thread studio learning (VII) using multiple serial ports
【数据聚类】本专栏中涉及数据集、可视化及注意事项
【图像去噪】基于高斯滤波、均值滤波、中值滤波、双边滤波四种滤波实现椒盐噪声图像去噪附matlab代码
公众号也能带货?
[image denoising] image denoising based on partial differential equation (PDE) with matlab code
VSCode常用插件
Talk about vscode configuration settings JSON knows why (with a large number of configurations)
Summary from November 29 to December 5
Throw away the ugly toast. The movable toast is more interesting