当前位置:网站首页>[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
边栏推荐
- 云原生KubeSphere部署Mysql
- Custom nail robot alarm
- 31. 下一个排列
- PC starts multiple wechat at one time
- Servlet监听器&过滤器介绍
- Important knowledge of transport layer (interview, retest, final)
- 21 天学习MongoDB笔记
- Pytorch: a pit about the implementation of gradreverselayer
- 如何实现点击一下物体播放一次动画
- Recommended website for drawing result map
猜你喜欢

CGC: contractual graph clustering for community detection and tracking

Sort out several uses of network IP agent

If you were a golang interviewer, what questions would you ask?

XinChaCha Trust SSL Organization Validated

安装nngraph

Synchronously update the newly added and edited data to the list

教你快速开发一个 狼人杀微信小程序(附源码)

The accuracy and speed are perfectly balanced, and the latest image segmentation SOTA model is released!!!

World Book Day: I'd like to recommend these books

Idea的src子文件下无法创建servlet
随机推荐
ZigBee CC2530 minimum system and register configuration (1)
Read the data in Presto through sparksql and save it to Clickhouse
CVPR 2022 & ntire 2022 | the first transformer for hyperspectral image reconstruction
Connect orcale
Remote sensing image classification and recognition system based on convolutional neural network
Install nngraph
Start mqbroker CMD failure resolution
STM32 control stepper motor (ULN2003 + 28byj)
XinChaCha Trust SSL Organization Validated
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)
Timing role in the project
Melt reshape decast long data short data length conversion data cleaning row column conversion
SSM framework series - annotation development day2-2
8 websites that should be known for product development to enhance work experience
4. DRF permission & access frequency & filtering & sorting
JMeter operation redis
SSM框架系列——Junit单元测试优化day2-3
安装nngraph
The El table horizontal scroll bar is fixed at the bottom of the visual window
HQL statement tuning