当前位置:网站首页>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?
边栏推荐
- Detailed explanation of document operation
- 2022 robocom world robot developer competition - undergraduate group (provincial competition) CAIP full version solution
- 25. From disk to file
- Calculate the M-day moving average price of two stocks
- 4279. 笛卡尔树
- DS graph - minimum spanning tree
- Which securities company is good at opening an account with flush? Excuse me, is it safe to open an account with mobile phone or stock?
- Automatic derivation of pytorch
- Android SQLite database practice
- Analysis of some difficulties in VAE (variational self encoder)
猜你喜欢

Outlook tutorial, how to create tasks and to DOS in outlook?

26.文件使用磁盘的代码实现

Overall testing framework for performance testing
![[quantitative test]](/img/df/f2d8b252169213af340f3e535bddef.png)
[quantitative test]

(零九)Flask有手就行——Cookie和Session

Force button 31. Next arrangement -- double finger needling

报错【项目报错】
![[machine learning basics] - another perspective to explain SVM](/img/da/3c379d225f9866ed1d3ca853920bd5.png)
[machine learning basics] - another perspective to explain SVM
![[fluent -- layout] flow layout (flow and wrap)](/img/01/c588f75313580063cf32cc01677600.jpg)
[fluent -- layout] flow layout (flow and wrap)
![[USENIX atc'22] an efficient distributed training framework whale that supports the super large-scale model of heterogeneous GPU clusters](/img/dc/be4dc55cdf3085a7b9e58ed6d6a16e.png)
[USENIX atc'22] an efficient distributed training framework whale that supports the super large-scale model of heterogeneous GPU clusters
随机推荐
循环结构practice
Vector introduction and underlying principle
What is a firewall? What role can firewalls play?
Research on stability of time-delay systems based on Lambert function
Android section 13 detailed explanation of 03sqlite database
JSON file editor
Performance test - Preparation of test plan
ZABBIX administrator forgot login password
[fluent -- layout] flow layout (flow and wrap)
在哪家证券公司开户最好最安全 如何开户炒股票
Leetcode 1288. delete the covered interval (yes, solved)
2022 RoboCom 世界机器人开发者大赛-本科组(省赛)---第一题 不要浪费金币 (已完结)
Detailed explanation of document operation
24.原生磁盘的使用
2022 robocom world robot developer competition - undergraduate group (provincial competition) -- question 2: intelligent medication assistant (finished)
遭受DDoS时,高防IP和高防CDN的选择
你不能只会flex居中布局,精制动画讲解所有flex布局方式!通俗易懂纯干货教程!...
25.从生磁盘到文件
zabbix管理员忘记登录密码
Which securities company is the best and safest to open an account? How to open an account and speculate in stocks