
昨天完成的!
流水灯的代码:
#include<reg51.h>
void delay(unsigned int cnt) //延时
{
while(cnt--);
}
main()
{
P1=0xfe;
while(1)
{
delay(30000);
P1=P1<<1;
P1=P1|0x01;
if(P1==0x7f)
{
delay(30000);
P1=0xfe;
}
}
}
先上代码,暂时不知道怎么上传视频。
#include<reg51.h> //双色点阵显示心形
unsigned char const dofly[]={0x00,0x6C,0x92,0x82,0x44,0x28,0x10,0x00};
unsigned char code seg[]={0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe};
void delay(unsigned int cnt)
{
while(--cnt);
}
main()
{
unsigned char i;
while(1)
{
P0=dofly[i];
P2=seg[i];
delay(300);
i++;
if(8==i)
i=0;
}
}
#include<reg51.h> //数码管显示
unsigned char const dofly[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
// 显示值 01234567
unsigned char code seg[]={0,1,2,3,4,5,6,7};
void delay(unsigned int cnt)
{
while(--cnt);
}
main()
{
unsigned char i;
while(1)
{
P0=dofly[i];
P2=seg[i];
delay(200);
i++;
if(8==i)
i=0;
}
}
我要赚赏金打赏帖 |
|
|---|---|
| PCF8574功能模块及其使用被打赏¥20元 | |
| 传感器LSM6DSO及LIS3MDL的功能检测被打赏¥18元 | |
| LPS25HB气压传感器及其检测被打赏¥18元 | |
| HTS221温湿度传感器及其检测被打赏¥18元 | |
| 【S32K3XX】HSE FW 版本更新被打赏¥21元 | |
| 基于ArduinoUNO开发板的AT24C02读写测试被打赏¥16元 | |
| TCS3472S传感器及其色彩检测被打赏¥19元 | |
| 【S32DS】S32K3 RTD7.0.1 HSE 组件配置报错问题解决被打赏¥27元 | |
| 【S32K3XX】MCME 启动 CORE1被打赏¥23元 | |
| AG32VH407下温度大气压传感器及其检测被打赏¥20元 | |