找回密码
 注册会员
更新自动建库工具PCB Footprint Expert 2024.04 Pro / Library Expert 破解版

请大家帮我看看这个单片机接受串口发送的文字代码的程序对不对,

[复制链接]
admin 发表于 2012-9-2 09:37:26 | 显示全部楼层 |阅读模式

本文包含原理图、PCB、源代码、封装库、中英文PDF等资源

您需要 登录 才可以下载或查看,没有账号?注册会员

×
程序用在摇摇棒上,我用VB写了发送汉子代码的界面,可是摇摇棒上不能显示。。 估计是不能接收 请高手帮我看看是哪里不对
我用的晶振是12M的 波特率好像有问题 还有就是单片机一次接受一个代码 可是VB写的界面一次发送几百个代码 应该怎么弄啊?
串口初始化
TMOD=0x62;//用了INT0,INT1,T1
TL1=0xFF;
TH1=0xFF;
IE=0x9F;
TCON=0x45;
SCON=0x05;
TH0=-6;
TL0=-6;
TR0=1;
PCON=0x80;
串口中断程序
void RIE(void) interrupt 4
{
RI=0;

if(m==1)
{
if(count1==32)
count=0;
if(count1<=15)
one11[count1]=SBUF;
if(count1>15)
one12[count1]=SBUF;
count1++;
}

if(m==2)
{
if(count2==64)
count2=0;
if(count2<=15)
one11[count2]=SBUF;
if(count2>15&&count2<=31)
one12[count2]=SBUF;
if(count2>31&&count2<=47)
two11[count2]=SBUF;
if(count2>47&&count2<=63)
two12[count2]=SBUF;
count2++;
}

if(m==3)
{
if(count3==96)
count3=0;
if(count3<=15)
one11[count3]=SBUF;
if(count3>15&&count<=31)
one12[count3]=SBUF;
if(count3>31&&count3<=47)
two11[count3]=SBUF;
if(count3>47&&count3<=63)
two12[count3]=SBUF;
if(count3>63&&count3<=79)
three11[count3]=SBUF;
if(count3>79&&count3<=95)
three12[count3]=SBUF;
count3++;
}
if(m==4)
{
if(count4==128)
count4=0;
if(count4<=15)
one11[count4]=SBUF;
if(count4>15&&count4<=31)
one12[count4]=SBUF;
if(count4>31&&count4<=47)
two11[count4]=SBUF;
if(count4>47&&count4<=63)
two12[count4]=SBUF;
if(count4>63&&count4<=79)
three11[count4]=SBUF;
if(count4>79&&count4<=95)
three12[count4]=SBUF;
if(count4>95&&count4<=111)
four11[count4]=SBUF;
if(count4>111&&count4<=127)
four12[count4]=SBUF;
count4++;
}

if(m==5)
{
if(count5==160)
count5=0;
if(count5<=15)
one11[count5]=SBUF;
if(count5>15&&count5<=31)
one12[count5]=SBUF;
if(count5>31&&count5<=47)
two11[count5]=SBUF;
if(count5>47&&count5<=63)
two12[count5]=SBUF;
if(count5>63&&count5<=79)
three11[count5]=SBUF;
if(count5>79&&count5<=95)
three12[count5]=SBUF;
if(count5>95&&count5<=111)
four11[count5]=SBUF;
if(count5>111&&count5<=127)
four12[count5]=SBUF;
if(count5>127&&count5<=143)
five11[count5]=SBUF;
if(count5>143&&count5<=159)
five12[count5]=SBUF;
count5++;
}
*滑块验证:
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

QQ|手机版|MCU资讯论坛 ( 京ICP备18035221号-2 )|网站地图

GMT+8, 2024-11-24 14:20 , Processed in 0.056183 second(s), 11 queries , Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表