当前位置:网站首页>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?
边栏推荐
- 2022 robocom world robot developer competition - undergraduate group (provincial competition) rc-u4 strategy team (completed)
- ReentrantLock 可重入锁
- 【机器学习基础】——另一个视角解释SVM
- 华为无线设备配置WPA2-802.1X-AES安全策略
- How to set packet capturing mobile terminal
- Personal practical experience: Data Modeling "whether account data belongs to dimension or account domain"
- 循环结构practice
- Intelligent operation and maintenance scenario analysis: how to detect abnormal business system status through exception detection
- Here comes the problem! Unplug the network cable for a few seconds and plug it back in. Does the original TCP connection still exist?
- 报错【项目报错】
猜你喜欢

MySQL build master-slave synchronization - build with docker

24.原生磁盘的使用

Nine key measures to maintain server security in Hong Kong

Analysis of some difficulties in VAE (variational self encoder)

C - partial keyword

Huawei wireless device configuration wpa2-802.1x-aes security policy
![[fluent -- layout] flow layout (flow and wrap)](/img/01/c588f75313580063cf32cc01677600.jpg)
[fluent -- layout] flow layout (flow and wrap)

【Flutter -- 布局】流式布局(Flow和Wrap)

27.目录与文件系统

Error: pidfile (celerybeat.pid) already exists when celery starts beat
随机推荐
4279. Cartesian tree
循环结构practice
AG. DS binary tree -- hierarchical traversal
How to set packet capturing mobile terminal
You are only one SQL statement away from the tdengine Developer Conference!
Nine key measures to maintain server security in Hong Kong
DS diagram - the shortest path of the diagram (excluding the code framework)
2022 RoboCom 世界机器人开发者大赛-本科组(省赛)RC-u4 攻略分队 (已完结)
野火stm32霸道,通过固件库实现流水灯
DS inner row heap sort
Multus of kubernetes multi network card scheme_ CNI deployment and basic use
15. Talk about these common multi-threaded interview questions
Operation of MySQL Library
Storage and traversal of Graphs
Analysys analysis "2022 China data security market data monitoring report" was officially launched
Date class and time class definitions (operator overload application)
ZABBIX administrator forgot login password
MySQL function
C. Recover an RBS
各种Normalization的直观理解