登录  | 立即注册

游客您好!登录后享受更多精彩

扫一扫,访问微社区

QQ登录

只需一步,快速开始

开启左侧

[寒假笔记] 寒假笔记1.4流水灯的实现

[复制链接]
发表于 2019-1-29 21:36:03 | 显示全部楼层 |阅读模式
学习笔记
学习科目: C语言
学习安排: 了解for和while语句
开始时间: 2019-01-29
结束时间: 2019-01-29
#include<reg52.h>
sbit LED = P0^0;
sbit P20 = P2^0;
sbit P21= P2^1;
sbit P22 = P2^2;
sbit P23 = P2^3;
sbit ENLED = P1^1;
void main()
{
unsigned int i = 0;
unsigned char cnt = 0;

ENLED = 0;
P23 = 1;
P22 = 1;
P21 = 1;
P20 = 0;

while(1)
{
P0 = ~(0x01 << cnt);
for(i=0; i<35000; i++);
cnt++;
if(cnt >=8)
{
      cnt = 0;
}

}
批注 2019-01-29 213541.jpg
知行合一
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表