登录  | 立即注册

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

扫一扫,访问微社区

QQ登录

只需一步,快速开始

开启左侧

[寒假笔记] 单片机流水灯-C语言for语句练习

[复制链接]
发表于 2022-1-19 00:44:01 | 显示全部楼层 |阅读模式
学习笔记
学习科目: 单片机流水灯-C语言for语句练习
学习安排: 单片机流水灯-C语言for语句练习
开始时间: 2022-01-18
结束时间:
流水灯
#include <STC12C5A60S2.H>
#include <INTRINS.H>
void Delay1ms(unsigned int xms)        //@12.000MHz
{
        unsigned char i, j;
        while(xms){
        _nop_();
        _nop_();
        i = 12;
        j = 168;
        do
        {
                while (--j);
        } while (--i);
        xms--;
                }
}

sbit A0 = P2^0;
sbit A1 = P2^1;
sbit A2 = P2^2;
sbit ENLED = P1^1;
void mian()
{
         ENLED = 0;
   A0 = 0;
   A1 = 1;
   A2 = 1;
        while(1)
        {
                P0=0xFE;
                Delay1ms(500);
                P0=0xFD;
                Delay1ms(500);
                P0=0xFB;Delay1ms(500);
                P0=0xF7;
                Delay1ms(500);
                P0=0xEF;
                Delay1ms(500);
                P0=0xDF;
                Delay1ms(500);
                P0=0xBF;
                Delay1ms(500);
                P0=0x7E;
                Delay1ms(500);
        }
}
华氏度转为摄氏度 QQ截图20220118220940.png

好懒~~不想说~~~
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

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