为什么下面串口通信没SCON TI 等设置,但是能仿真成功呢
时间:10-02
整理:3721RD
点击:
#include <reg52.h>
#define uchar unsigned char
sbit ST_CP=P3^2;
uchar code bmp[108]={ //字模表
0x01,0x00,0x11,0x00,0x11,0x00,0x11,0x00,0x1F,0xF8,0x21,0x00,0x41,0x00,0x01,0x00,0x01,0x00,0xFF,0xFE
,
0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,/*"牛",0*/
0x01,0x00,0x01,0x00,0x11,0xF8,0x11,0x00,0x11,0x00,0x11,0x00,0xFF,0xFE,0x01,0x00,0x01,0x00,0x11,0x08
,
0x11,0x10,0x21,0x20,0x40,0xC0,0x03,0x00,0x1C,0x00,0xE0,0x00,/*"步",1*/0x00,0x00,0x00,0x00,
0x01,0x00,0x01,0x00,0x7F,0xFC,0x01,0x00,0x3F,0xF8,0x01,0x00,0xFF,0xFE,0x00,0x00,0x1F,0xF0,0x10,0x10
,
0x1F,0xF0,0x10,0x10,0x1F,0xF0,0x10,0x10,0x10,0x50,0x10,0x20/*"青",2*/, 0x00,0x00,0x00,0x00
};
void delay(uchar ms) // 延时毫秒@12M,ms最大值255
{
uchar i;
while(ms--)
for(i=0;i<110;i++);
}
void main()
{uchar base,col,p;
while(1)
{
for(base=0;base<=76;base=base+2) //控制移动效果。偶数 32*(8-1)=224;
{
p=34;
while(p--)
for(col=0;col<16;col++) // 显示一个汉字
{
SBUF=bmp[base+col*2];
delay(1);
SBUF=bmp[base+col*2+1];
delay(1);
P1=col;
ST_CP=0; //CP上升沿
ST_CP=1; //移位寄存器的数据进入数据存储寄存
器 delay(1); //延时显示
}
}
}
}
为什么下面串口通信没SCON TI 等设置,但是能仿真成功呢,串口通信可以默认哪种方式,还是?请哪位大神帮忙看看,不胜感激
#define uchar unsigned char
sbit ST_CP=P3^2;
uchar code bmp[108]={ //字模表
0x01,0x00,0x11,0x00,0x11,0x00,0x11,0x00,0x1F,0xF8,0x21,0x00,0x41,0x00,0x01,0x00,0x01,0x00,0xFF,0xFE
,
0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x00,0x00,0x00,0x00,/*"牛",0*/
0x01,0x00,0x01,0x00,0x11,0xF8,0x11,0x00,0x11,0x00,0x11,0x00,0xFF,0xFE,0x01,0x00,0x01,0x00,0x11,0x08
,
0x11,0x10,0x21,0x20,0x40,0xC0,0x03,0x00,0x1C,0x00,0xE0,0x00,/*"步",1*/0x00,0x00,0x00,0x00,
0x01,0x00,0x01,0x00,0x7F,0xFC,0x01,0x00,0x3F,0xF8,0x01,0x00,0xFF,0xFE,0x00,0x00,0x1F,0xF0,0x10,0x10
,
0x1F,0xF0,0x10,0x10,0x1F,0xF0,0x10,0x10,0x10,0x50,0x10,0x20/*"青",2*/, 0x00,0x00,0x00,0x00
};
void delay(uchar ms) // 延时毫秒@12M,ms最大值255
{
uchar i;
while(ms--)
for(i=0;i<110;i++);
}
void main()
{uchar base,col,p;
while(1)
{
for(base=0;base<=76;base=base+2) //控制移动效果。偶数 32*(8-1)=224;
{
p=34;
while(p--)
for(col=0;col<16;col++) // 显示一个汉字
{
SBUF=bmp[base+col*2];
delay(1);
SBUF=bmp[base+col*2+1];
delay(1);
P1=col;
ST_CP=0; //CP上升沿
ST_CP=1; //移位寄存器的数据进入数据存储寄存
器 delay(1); //延时显示
}
}
}
}
为什么下面串口通信没SCON TI 等设置,但是能仿真成功呢,串口通信可以默认哪种方式,还是?请哪位大神帮忙看看,不胜感激
这就是我为什么不喜欢仿真的原因之一了,就像Keil一样,它的仿真调试也是这样,只要是往寄存器SBUF写入数据,模拟的串行窗口就能看到输出,而与串口配置无关,这与实际情况完全不同。估计你的仿真软件也是如此,因为计算机不会深入仿真,它只能做辅助而不是完全信任。
就是说 程序不是很全的时候, 仿真可以,但是到实物上是行不通的 是这个意思吧
好吧 改天买块板子 去 哈哈