#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
这个数码管的全能太重要了
打赏帖 | |
---|---|
汽车电子中巡航控制系统的使用被打赏10分 | |
分享汽车电子中巡航控制系统知识被打赏10分 | |
分享安全气囊系统的检修注意事项被打赏10分 | |
分享电子控制安全气囊计算机知识点被打赏10分 | |
【分享开发笔记,赚取电动螺丝刀】【OZONE】使用方法总结被打赏20分 | |
【分享开发笔记,赚取电动螺丝刀】【S32K314】芯片启动流程分析被打赏40分 | |
【分享开发笔记,赚取电动螺丝刀】【S32K146】S32DS RTD 驱动环境搭建被打赏12分 | |
【分享开发笔记,赚取电动螺丝刀】【IAR】libc标注库time相关库函数使用被打赏23分 | |
LP‑MSPM0L1306开发版试用结果被打赏10分 | |
【分享开发笔记,赚取电动螺丝刀】【LP-MSPM0L1306】适配 RT-Thread Nano被打赏23分 |