当前位置:网站首页>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 ();
}
}
边栏推荐
- 能量守恒和打造能量缺口
- Now there are HTML files and MVC made with vs (connected to the database). How can they be connected?
- 【Node】npm、yarn、pnpm 区别
- Chapter 2: try to implement a simple bean container
- ORACLE CREATE SEQUENCE,ALTER SEQUENCE,DROP SEQUENCE
- U-boot initialization and workflow analysis
- Ros2 - function package (VI)
- Machine learning Seaborn visualization
- Altimeter data knowledge point 2
- [untitled]
猜你喜欢
随机推荐
The SQL implementation has multiple records with the same ID, and the latest one is taken
Machine learning Seaborn visualization
Ethtool principle introduction and troubleshooting ideas for network card packet loss (with ethtool source code download)
The difference between new and malloc
【Node】nvm 版本管理工具
What does soda ash do?
一文揭开,测试外包公司的真实情况
HDU1231 最大连续子序列(分治or动规or双指针)
I can't stand the common annotations of idea anymore
Database SQL practice 3. Find the current salary details of the current leaders of each department and their corresponding department number Dept_ no
Mipi interface, DVP interface and CSI interface of camera
Now there are HTML files and MVC made with vs (connected to the database). How can they be connected?
SOC_SD_CMD_FSM
小米笔试真题一
Literacy Ethernet MII interface types Daquan MII, RMII, smii, gmii, rgmii, sgmii, XGMII, XAUI, rxaui
Concurrent programming - deadlock troubleshooting and handling
乐鑫面试流程
ModuleNotFoundError: No module named ‘picamera‘
能量守恒和打造能量缺口
【软件测试】06 -- 软件测试的基本流程









