当前位置:网站首页>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 ();
}
}
边栏推荐
- [node] differences among NPM, yarn and pnpm
- Machine learning Seaborn visualization
- Xiaomi written test real question 1
- 纯碱是做什么的?
- Matlab在线性代数中的应用(四):相似矩阵及二次型
- Don't confuse the use difference between series / and / *
- Database SQL practice 3. Find the current salary details of the current leaders of each department and their corresponding department number Dept_ no
- Unity UGUI不同的UI面板或者UI之间如何进行坐标匹配和变换
- Use of Pai platform
- Oracle code use
猜你喜欢
逻辑结构与物理结构
Steps and FAQs of connecting windows Navicat to Alibaba cloud server MySQL
iNFTnews | 喝茶送虚拟股票?浅析奈雪的茶“发币”
arcgis_ spatialjoin
SD_CMD_SEND_SHIFT_REGISTER
Mipi interface, DVP interface and CSI interface of camera
DelayQueue延迟队列的使用和场景
PowerManagerService(一)— 初始化
IPage can display data normally, but total is always equal to 0
Three body goal management notes
随机推荐
IPage能正常显示数据,但是total一直等于0
Ros2 - function package (VI)
【软件测试】04 -- 软件测试与软件开发
MySQL setting trigger problem
基于Cortex-M3、M4的GPIO口位带操作宏定义(可总线输入输出,可用于STM32、ADuCM4050等)
Jenkins reported an error. Illegal character: '\ufeff'. Class, interface or enum are required
SD_ CMD_ SEND_ SHIFT_ REGISTER
三体目标管理笔记
U-Boot初始化及工作流程分析
M2dgr slam data set of multi-source and multi scene ground robot
Brief description of inux camera (Mipi interface)
二分查找(折半查找)
Don't confuse the use difference between series / and / *
HDU1232 畅通工程(并查集)
Interpretation of the earliest sketches - image translation work sketchygan
SD_ CMD_ RECEIVE_ SHIFT_ REGISTER
【软件测试】03 -- 软件测试概述
Course learning accumulation ppt
Do you choose pandas or SQL for the top 1 of data analysis in your mind?
[software testing] 03 -- overview of software testing