当前位置:网站首页>[51 single chip microcomputer traffic light simulation]
[51 single chip microcomputer traffic light simulation]
2022-04-23 13:02:00 【ZLP~】
Traffic light design and simulation
Topic quantity : 1 Full marks : 100 branch The creator : Wang Jianing By the time :2022-04-24 11:54
One . Short answer ( common 1 topic ,100.0 branch )
1
See the example of traffic lights in Chapter 6 of the book , Design and simulate , Count down the original program 20 Seconds to countdown 15 second . requirement Proteus Draw the circuit diagram to reflect the student number and name , And record the simulation effect .
Fill in the answer
#include "reg51.h"
sbit in1 = P2^1;
sbit in2 = P2^2;
sbit in3 = P2^3;
sbit in4 = P2^4;
sbit in5 = P2^5;
sbit in6 = P2^6;
typedef unsigned char u8;
u8 a[]={
0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
void delay(int ms)
{
int i,j;
for(i=ms;i>0;i--)
for(j=110;j>0;j--);
}
void display(int d)
{
int f = d;
while(f>=0)
{
if(f<10)
{
P3=a[f];
P1=a[0];
f=f-1;
delay(1000);
}
if(f>=10)
{
P3=a[f%10];
P1=a[f/10];
f=f-1;
delay(1000);
}
}
}
void one()
{
in1=0;
in2=1;
in3=0;
in4=1;
in5=0;
in6=0;
}
void two()
{
in1=0;
in2=1;
delay(800);
in2=0;
delay(800);
in3=0;
in4=1;
in5=0;
in6=0;
}
void three()
{
in1=0;
in2=0;
in3=1;
in4=1;
in5=0;
in6=0;
}
void four()
{
in1=1;
in2=0;
in3=0;
in4=0;
in5=1;
in6=0;
}
void five()
{
in1=1;
in2=0;
in3=0;
in4=0;
in5=1;
delay(800);
in5=0;
delay(800);
in6=0;
}
void six()
{
in1=1;
in2=0;
in3=0;
in4=0;
in6=1;
delay(800);
in6=0;
delay(800);
in5=0;
}
int main()
{
int i=0;
in1=0;
in2=0;
in3=0;
in4=0;
in5=0;
in6=0;
while(1)
{
one();
display(20);
two();
display(3);
three();
display(2);
four();
display(20);
five();
display(3);
six();
display(2);
}
}

traffic lights - Proteus 8 Mapping
Hand in your homework and remember the function name
版权声明
本文为[ZLP~]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230613177201.html
边栏推荐
- No idle servers? Import OVF image to quickly experience smartx super fusion community version
- Sort out several uses of network IP agent
- The project file '' has been renamed or is no longer in the solution, and the source control provider associated with the solution could not be found - two engineering problems
- 产品开发都应该知道的8个网站,增强工作体验
- melt reshape decast 长数据短数据 长短转化 数据清洗 行列转化
- Read the data in Presto through sparksql and save it to Clickhouse
- Go language mapping operation
- Translation of multi modal visual tracking: review and empirical comparison
- ZigBee CC2530 minimum system and register configuration (1)
- Proteus 8.10 installation problem (personal test is stable and does not flash back!)
猜你喜欢

【蓝桥杯】4月17日省赛刷题训练(前3道题)

Install nngraph

51 single chip microcomputer stepping motor control system based on LabVIEW upper computer (upper computer code + lower computer source code + ad schematic + 51 complete development environment)

There is no need to crack the markdown editing tool typora

软件测试周刊(第68期):解决棘手问题的最上乘方法是:静观其变,顺水推舟。

ZigBee CC2530 minimum system and register configuration (1)

Softbank vision fund entered the Web3 security industry and led a new round of investment of US $60 million in certik

8086 of x86 architecture

Free and open source intelligent charging pile SaaS cloud platform of Internet of things

世界读书日:我想推荐这几本书
随机推荐
SQL exercise question 1
How to click an object to play an animation
No idle servers? Import OVF image to quickly experience smartx super fusion community version
Record some NPM related problems (messy records)
SSL certificate refund instructions
Hanlp word splitter (via spark)
Recommended website for drawing result map
4. DRF permission & access frequency & filtering & sorting
(1) Openjuterpyrab comparison scheme
Jupiter notebook installation
Async void caused the program to crash
leetcode-791. 自定义字符串排序
STM32 tracking based on open MV
MySQL —— 16、索引的数据结构
Navicat远程连接数据库 出现 1130- Host xxx is not allowed to connect to this MySQL server错误
世界读书日:我想推荐这几本书
Go language: passing slices between functions
98. Error s.e.errormvcautoconfiguration $staticview reported by freemaker framework: cannot render error page for request
mysql支持ip访问
Unable to create servlet under SRC subfile of idea