当前位置:网站首页>Simple operation of running water lamp (keil5)
Simple operation of running water lamp (keil5)
2022-07-05 07:18:00 【After reading thousands of books, you can pick them up and put 】
Make the running water light turn on at first and then turn off three times ( Full flash three times ), Then light it in turn , Then go out in turn .
#include <STC15F2K60S2.H>
#define close P2=0x1f&(P2|0xe0);// Close the latch (y4,y5,y6,y7)
/***************************************************/
void initsystem(unsigned char i)
{
switch(i)
{
case 4:
P2=0X8f&(P2|0xe0);// open y4 Latch
break;
case 5:
P2=0xbf&(P2|0xe0);// open y5 Latch
break;
case 6:
P2=0xdf&(P2|0xe0);// open y6 Latch
break;
case 7:
P2=0xff&(P2|0xe0);// open y7 Latch
break;
}
}
/***********************************************/
void led_control(unsigned char n,unsigned char q)// Control lights (p0 End , Latch )
{
initsystem(q);
P0 = n;
}
/*******************************************/
void Delay (unsigned int t)// Time delay
{
while(t--);
while(t--);
}
/********************************************/
void LED_Running ()// Running lights
{
unsigned char i;
for (i=0;i<3;i++)// All lights are on and off 3 Time
{
led_control(0x00,4);
Delay (60000);
led_control(0xff,4);
Delay (60000);
}
for(i=1;i<8;i++)// The lights come on in turn
{
led_control(0xff<<i,4);
Delay(60000);
}
for(i=1;i<8;i++)// The lights go out in turn
{
led_control(~(0xff<<i),4);
Delay(60000);
}
}
/**********************************************/
void main()// The main function
{
led_control(1,4);close;// initialization
led_control(0x00,5);close;// initialization
while(1)
{
LED_Running ();
}
}
边栏推荐
- 睿智的目标检测59——Pytorch Focal loss详解与在YoloV4当中的实现
- arcgis_ spatialjoin
- Qu'est - ce que l'hydroxyde de sodium?
- I can't stand the common annotations of idea anymore
- Reading literature sorting 20220104
- Mathematical analysis_ Notes_ Chapter 8: multiple integral
- PostMessage communication
- [software testing] 04 -- software testing and software development
- [vscode] prohibit the pylance plug-in from automatically adding import
- 现在有html文件,和用vs制作的mvc(连接了数据库),怎么两个相连?
猜你喜欢
Chapter 2: try to implement a simple bean container
SD_CMD_SEND_SHIFT_REGISTER
Three body goal management notes
Using GEE plug-in in QGIS
Ethtool principle introduction and troubleshooting ideas for network card packet loss (with ethtool source code download)
PHY drive commissioning --- mdio/mdc interface Clause 22 and 45 (I)
Concurrent programming - how to interrupt / stop a running thread?
Negative number storage and type conversion in programs
M2dgr slam data set of multi-source and multi scene ground robot
Ros2 - common command line (IV)
随机推荐
R language learning notes 1
Lexin interview process
Ros2 - common command line (IV)
2022.06.27_ One question per day
乐鑫面试流程
Batch convert txt to excel format
[software testing] 03 -- overview of software testing
Install deeptools in CONDA mode
[vscode] search using regular expressions
GPIO port bit based on Cortex-M3 and M4 with operation macro definition (can be used for bus input and output, STM32, aducm4050, etc.)
Pytorch has been installed in anaconda, and pycharm normally runs code, but vs code displays no module named 'torch‘
Docker installs MySQL and uses Navicat to connect
Powermanagerservice (I) - initialization
[framework] multi learner
[software testing] 06 -- basic process of software testing
Course learning accumulation ppt
第 2 章:小试牛刀,实现一个简单的Bean容器
【Node】npm、yarn、pnpm 区别
Concurrent programming - deadlock troubleshooting and handling
Use of Pai platform