当前位置:网站首页>Pattern water flow lamp 1: check the table and display the LED lamp
Pattern water flow lamp 1: check the table and display the LED lamp
2022-07-24 15:29:00 【Electronic engineer Growth Diary】
To study the LED After the lamp moves left and right , The following implements a variety of patterns of running water lamps .
Hardware circuit design
combination 51 Knowledge of the smallest system of single chip microcomputer , utilize AD19 Draw the minimum system circuit ( Power supply part is not included ).
This design needs to realize 8 individual LED Light on and off .LED( Light-emitting diode ) Positive connection +5V Power Supply , The negative pole is connected to the single chip microcomputer P1 mouth , In this way, as long as the SCM P1 The diode can be turned on when the output level of the port is high or low , Realization LED Light on and off .
Simulation circuit design
Simulation circuit diagram and AD The schematic drawing method is consistent , However, it should be noted that the capacitance value in the simulated minimum system reset circuit is 0.1uf, Resistance value 100Ω, And AD There are differences in the schematic diagram .
Programming
The program uses Keil5 Design ,8 position LED Realize the program of pattern flow lamp :
/*-----------------------------------------------
name :IO Port high and low level control
Content : By looking up the table 1 A value of bytes is then assigned to P1 port
------------------------------------------------*/
#include<reg52.h> // Include header file , In general, there is no need to change , The header file contains the definition of special function registers
/*------------------------------------------------
Look up table
------------------------------------------------*/
unsigned char code table[]=
{
0x7f,0xbf,0xdf,0xef,
0xf7,0xfb,0xfd,0xfe,
0xff,0xff,0x00,0x00,
0x55,0x55,0xaa,0xaa
};
/*------------------------------------------------
Function declaration
------------------------------------------------*/
void Delay(unsigned int t); // Function declaration
/*------------------------------------------------
The main function
------------------------------------------------*/
void main (void)
{
unsigned char i; // Define an unsigned character local variable i Value range 0~255
while (1) // Main circulation
{
for(i=0;i<16;i++) // Join in for loop , indicate for Loop program loop in braces
// perform 16 Time , Indicates that there are 16 Elements
{
P1=table[i];
Delay(30000);
}
// Add other programs that need to work all the time in the main loop
}
}
/*------------------------------------------------
The time delay function , Contains input parameters unsigned int t, No return value
unsigned int Is to define unsigned integer variables , The range of values is
0~65535
------------------------------------------------*/
void Delay(unsigned int t)
{
while(--t);
}Simulation Implementation
In order to intuitively feel the effect of this design , Here use protues8.7 The simulation realizes the pattern water lamp , See the video for details .
http://mpvideo.qpic.cn/0bf2ean7kaa3jeagkaceyzpuwigd6uqbx5ia.f10002.mp4?
边栏推荐
- Citic securities account opening process, is it safe to open an account on your mobile phone
- 25. From disk to file
- 华为无线设备配置WPA2-802.1X-AES安全策略
- 中信证券账户开通流程,手机上开户安全吗
- VAE(变分自编码器)的一些难点分析
- Android section 13 detailed explanation of 03sqlite database
- JMeter - call the interface for uploading files or pictures
- (09) flask is OK if it has hands - cookies and sessions
- DS binary tree - parent and child nodes of binary tree
- 2022 RoboCom 世界机器人开发者大赛-本科组(省赛)-- 第五题 树与二分图 (已完结)
猜你喜欢

25. From disk to file

2022 robocom world robot developer competition - undergraduate group (provincial competition) -- fifth question tree and bipartite diagram (completed)

27.目录与文件系统

Simple encapsulation of wechat applet wx.request

What is a firewall? What role can firewalls play?

2022 RoboCom 世界机器人开发者大赛-本科组(省赛)RC-u4 攻略分队 (已完结)

Android SQLite database practice

【AdaptiveAvgPool3d】pytorch教程

24.原生磁盘的使用

基于Lambert函数的时滞系统稳定性研究
随机推荐
pip 安装报错 error in anyjson setup command: use_2to3 is invalid.
Huffman tree (optimal binary tree)
kubernetes多网卡方案之Multus_CNI部署和基本使用
DS diagram - the shortest path of the diagram (excluding the code framework)
[tkinter beautification] window out of system style (common to three systems)
AG. DS binary tree -- hierarchical traversal
[tkinter美化] 脱离系统样式的窗口(三系统通用)
Applet tab
JS native - array sorting to find out the characters with the largest number of strings
在哪家证券公司开户最好最安全 如何开户炒股票
【OpenCV 例程300篇】238. OpenCV 中的 Harris 角点检测
【USENIX ATC'22】支持异构GPU集群的超大规模模型的高效的分布式训练框架Whale
Which brokerage has the lowest commission? I want to open an account. Is it safe to open an account on my mobile phone
How to deal with being attacked? Advanced anti DDoS IP protection strategy
基于Lambert函数的时滞系统稳定性研究
Still using listview? Use animatedlist to make list elements move
[bug solution] error in installing pycocotools in win10
Problems needing attention in mobile terminal testing
How do novices buy stocks for the first time? Which securities company is the best and safest to open an account
25. From disk to file