2021-07-03 51单片机1.高低4位交替8次,2.从0到255,3.1+2+3+4...

缘由求老哥帮做一下单片机题。_嵌入式-CSDN问答

#include "REG52.h"
bit k=1;
void main()
{
	unsigned char Xd=0,ss=15,cs=0;
	unsigned int ys=64000;
	while(1)
	{
		P1=ss;
		if(++ys==0&&cs<8)
        {
            k=~k;
            ++cs;
            ss=(k?15:240);
            ys=64000;
        }
	}
}
#include "REG52.h"
bit k=1;
void main()
{
	unsigned char Xd=0,ss=0,cs=0;
	unsigned int ys=64000;
	while(1)
	{
		P1=ss;
		if(++ys==0)
        {
            ++ss;
            ys=64000;
        }
	}
}
#include "REG52.h"
bit k=1;
void main()
{
	unsigned char Xd=0,ss=1,cs=0;
	unsigned int ys=64000;
	while(1)
	{
		P1=ss;
		if(++ys==0)
        {
            ss+=cs++;
            ys=64000;
        }
	}
}

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-02 11:18:01       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-02 11:18:01       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-02 11:18:01       82 阅读
  4. Python语言-面向对象

    2024-01-02 11:18:01       91 阅读

热门阅读

  1. AtCoder Beginner Contest 297(A-E)

    2024-01-02 11:18:01       71 阅读
  2. oracle 独立事务的含义和用法

    2024-01-02 11:18:01       55 阅读
  3. 基于SpringBoot的家具商城设计与实现

    2024-01-02 11:18:01       59 阅读
  4. 排序算法——快速排序

    2024-01-02 11:18:01       66 阅读