当前位置:网站首页>[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
边栏推荐
- Remote sensing image classification and recognition system based on convolutional neural network
- 数据库中的日期时间类型
- Translation of multi modal visual tracking: review and empirical comparison
- 21 days learning mongodb notes
- 进程虚拟地址空间区域划分
- Record Alibaba cloud server mining program processing
- 4.22学习记录(你一天只做了水题是吗)
- Temperature and humidity monitoring + timing alarm system based on 51 single chip microcomputer (C51 source code)
- 7_Addmodule和基因加和法add 得到的细胞类型打分在空间上空转对比
- Go language: passing slices between functions
猜你喜欢
Design of body fat detection system based on 51 single chip microcomputer (51 + OLED + hx711 + US100)
内核错误: No rule to make target ‘debian/canonical-certs.pem‘, needed by ‘certs/x509_certificate_list‘
Customize the shortcut options in El date picker, and dynamically set the disabled date
ZigBee CC2530 minimum system and register configuration (1)
8 websites that should be known for product development to enhance work experience
Important knowledge of transport layer (interview, retest, final)
CGC: contractual graph clustering for community detection and tracking
PC starts multiple wechat at one time
The El table horizontal scroll bar is fixed at the bottom of the visual window
CVPR 2022 & ntire 2022 | the first transformer for hyperspectral image reconstruction
随机推荐
At instruction of nbiot
7_Addmodule和基因加和法add 得到的细胞类型打分在空间上空转对比
Metalama简介4.使用Fabric操作项目或命名空间
[csnote] ER diagram
Custom nail robot alarm
About the 'enum' enumeration type and structure.
CVPR 2022 & ntire 2022 | the first transformer for hyperspectral image reconstruction
Software testing weekly (issue 68): the best way to solve difficult problems is to wait and see the changes and push the boat with the current.
SSM framework series - data source configuration day2-1
async void 導致程序崩潰
unity常见的问题(一)
MySQL supports IP access
Customize the shortcut options in El date picker, and dynamically set the disabled date
ZigBee CC2530 minimum system and register configuration (1)
Wonderful review | the sixth issue of "source" - open source economy and industrial investment
Melt reshape decast long data short data length conversion data cleaning row column conversion
31. Next arrangement
Remote access to raspberry pie at home (Part 1)
async void 导致程序崩溃
拥抱机器视觉新蓝海,冀为好望开启数字经济发展新“冀”遇