#include<reg52.h>
typedef unsigned char uint8;
typedef unsigned int uint16;
uint8 code smgdu[]={0x3f,0x06,0x5b,0x4f,0x66,
0x6d,0x7d,0x07,0x7f,0x6f};
sbit smgen=P2^3;
sbit rs=P3^6;
void delay(uint16 k)
{
uint16 i,j;
for(i=0;i<k;i++)
{
for(j=0;j<121;j++)
{;}
}
}
void main()
{
uint8 x=30;
uint16 y=55;
uint16 z;
rs=0;
z=x*y;
while(1)
{
smgen=1;
P1=smgdu[z/1000];
P2=0x30;
delay(1);
// smgen=1;
P1=smgdu[z%1000/100];
P2=0x20;
delay(1);
// smgen=1;
P1=smgdu[z%100/10];
P2=0x10;
delay(1);
// smgen=1;
P1=smgdu[z%10];
P2=0x00;
delay(1);
}
}
结果1110;
smgen=1;
P1=smgdu[z/1000];
P2=0x30;
delay(1);
smgen=1;
P1=smgdu[z%1000/100];
P2=0x20;
delay(1);
// smgen=1;
P1=smgdu[z%100/10];
P2=0x10;
delay(1);
// smgen=1;
P1=smgdu[z%10];
P2=0x00;
delay(1);
结果1668
while(1)
{
smgen=1;
P1=smgdu[z/1000];
P2=0x30;
delay(1);
smgen=1;
P1=smgdu[z%1000/100];
P2=0x20;
delay(1);
smgen=1;
P1=smgdu[z%100/10];
P2=0x10;
delay(1);
// smgen=1;
P1=smgdu[z%10];
P2=0x00;
delay(1);
结果1658
void main()
{
uint8 x=30;
uint16 y=55;
uint16 z;
rs=0;
z=x*y;
while(1)
{
smgen=1;
P1=smgdu[z/1000];
P2=0x30;
delay(1);
smgen=1;
P1=smgdu[z%1000/100];
P2=0x20;
delay(1);
smgen=1;
P1=smgdu[z%100/10];
P2=0x10;
delay(1);
smgen=1;
P1=smgdu[z%10];
P2=0x00;
delay(1);
}
}
结果正解1650
这个数码管的全能太重要了
打赏帖 | |
---|---|
嵌入式LinuxC语言程序调试和宏使用技巧被打赏50分 | |
让代码中包含最新的编译时间信息被打赏50分 | |
rtthread硬件加密--2crc加密分析被打赏10分 | |
【分享开发笔记,赚取电动螺丝刀】mcxa156使用低功耗定时器适配硬件RTC框架被打赏26分 | |
【STM32F769】AI之与本地deepseek对接被打赏50分 | |
Buck电路工作在CCM模式下电感电流的计算公式是什么?被打赏5分 | |
buck电路工作原理被打赏5分 | |
基于MSPM0L1306的MODBUS-RTU协议通讯实验被打赏100分 | |
我想要一部加热台+多合一调试工具被打赏18分 | |
每周了解几个硬件知识+485硬件知识分享被打赏10分 |