哪位大哥能帮忙编个STC10L的串口程序。 要求用方式1波特率为9600;串口发送的什么,接收的就是发送的数据

我用的晶振是12M的,要求就是PC用SSCOM32通过串口发送譬如c0 00 01 c0字符串时,STC10L04XE就返回c0 00 01 c0字符串给PC

百度文库 里 有 很多 单片机 的 文档 资料 源码

推荐 去 看看
温馨提示:内容为网友见解,仅供参考
第1个回答  2010-12-18
让德国人
第2个回答  2010-12-27
#include <STC10.h>
#include <intrins.h>
#include <stdio.h>
#define uchar unsigned char
#define uint unsigned int
uchar show;
void System_Init()
{
TMOD=0x20;
TH1=0xD9;//波特率9600//
TL1=0xD9;
SCON=0x50;
AUXR=0x40;//1T模式//
ET1=0;
TR1=1;
EA=1;
ES=1;
PS=1;
}
void main()
{
System_Init();
while(1)
{
//SBUF=0x41;
//while(!TI);
//TI=0;
if(RI==1)
{
show=SBUF;
P1=show;
RI=0;
SBUF=show;
while(!TI);
TI=0;
}
}
}本回答被提问者采纳
相似回答
大家正在搜