当前位置:网站首页>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 ();
}
}
边栏推荐
- Binary search (half search)
- SOC_SD_DATA_FSM
- Matlab在线性代数中的应用(四):相似矩阵及二次型
- iNFTnews | 喝茶送虚拟股票?浅析奈雪的茶“发币”
- 【idea】Could not autowire. No beans of xxx type found
- Course learning accumulation ppt
- [software testing] 03 -- overview of software testing
- Netease to B, soft outside, hard in
- [vscode] search using regular expressions
- D2L installation
猜你喜欢
随机推荐
Course learning accumulation ppt
PHY drive commissioning - phy controller drive (II)
Inftnews | drink tea and send virtual stocks? Analysis of Naixue's tea "coin issuance"
DataGrid offline installation of database driver
现在有html文件,和用vs制作的mvc(连接了数据库),怎么两个相连?
IPage can display data normally, but total is always equal to 0
Ethtool principle introduction and troubleshooting ideas for network card packet loss (with ethtool source code download)
Ggplot2 drawing learning notes in R
HDU1231 最大连续子序列(分治or动规or双指针)
The SQL implementation has multiple records with the same ID, and the latest one is taken
氢氧化钠是什么?
【软件测试】03 -- 软件测试概述
[vscode] recommended plug-ins
逻辑结构与物理结构
IPage能正常显示数据,但是total一直等于0
[idea] efficient plug-in save actions to improve your work efficiency
网易To B,柔外刚中
[software testing] 03 -- overview of software testing
1290_FreeRTOS中prvTaskIsTaskSuspended()接口实现分析
U-boot initialization and workflow analysis