|
楼主 |
发表于 2021-7-14 20:02:34
|
显示全部楼层
本帖最后由 chenlongsheng 于 2021-7-14 20:03 编辑
- #include "reg52.h"
-
- typedef unsigned int u16;
- typedef unsigned char u8; //对数据类型进行声明定义
- u8 code smgduan[16]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
- 0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};// 显 示
- void delay(u16 d)
- {
- u16 b,c;
- for(b=0;b<d;b++)
- for(c=0;c<255;c++);
- }
-
- void main()
- { u16 e;
- while(1)
- {
- for(e=0;e<16;e++)
- {P2=~smgduan[e];
- delay(500); //显示一会儿
- P2=0XFF; //消隐
- }
- }
- }
复制代码
|
|