当前位置:网站首页>[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
边栏推荐
- STM32 tracking based on open MV
- (个人)最近项目开发后存在的系统漏洞整理
- Introducing vant components on demand
- Packet capturing and sorting -- TCP protocol [8]
- Design of body fat detection system based on 51 single chip microcomputer (51 + OLED + hx711 + US100)
- Important knowledge of transport layer (interview, retest, final)
- Idea的src子文件下无法创建servlet
- [untitled] make a 0-99 counter, P1 7 connected to key, P2 connected to nixie tube section, common anode nixie tube, P3 0,P3. 1. Connect the nixie tube bit code. Each time you press the key, the nixie
- decast id.var measure. Var data splitting and merging
- Process virtual address space partition
猜你喜欢

Custom nail robot alarm

SSL certificate refund instructions

Redis deployment of cloud native kubesphere

Teach you to quickly develop a werewolf killing wechat applet (with source code)

进程虚拟地址空间区域划分

CVPR 2022 & ntire 2022 | the first transformer for hyperspectral image reconstruction
![[untitled] make a 0-99 counter, P1 7 connected to key, P2 connected to nixie tube section, common anode nixie tube, P3 0,P3. 1. Connect the nixie tube bit code. Each time you press the key, the nixie](/img/d1/b0ec21419db0cd3641f5fae8458c50.png)
[untitled] make a 0-99 counter, P1 7 connected to key, P2 connected to nixie tube section, common anode nixie tube, P3 0,P3. 1. Connect the nixie tube bit code. Each time you press the key, the nixie

有趣的IDEA插件推荐,给你的开发工作增添色彩

jmeter操作redis

If you were a golang interviewer, what questions would you ask?
随机推荐
SSM framework series - JUnit unit test optimization day2-3
HQL find the maximum value in a range
R语言中dcast 和 melt的使用 简单易懂
Redis deployment of cloud native kubesphere
8086 of x86 architecture
「玩转Lighthouse」轻量应用服务器自建DNS解析服务器
Mysql8 installation
Ad20 supplementary note 3 - shortcut key + continuous update
STM32 project transplantation: transplantation between chip projects of different models: Ze to C8
4.22学习记录(你一天只做了水题是吗)
Golang realizes regular matching: the password contains at least one digit, letter and special character, and the length is 8-16
unity常见的问题(一)
Object. The disorder of key value array after keys
Navicat远程连接数据库 出现 1130- Host xxx is not allowed to connect to this MySQL server错误
Use source insight to view and edit source code
STD:: shared of smart pointer_ ptr、std::unique_ ptr
21 天学习MongoDB笔记
【蓝桥杯】4月17日省赛刷题训练(前3道题)
云原生KubeSphere部署Redis
The use of dcast and melt in R language is simple and easy to understand