标题:HT46串口通信
取消只看楼主
yangjinze
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2011-10-2
结帖率:50%
 问题点数:0 回复次数:1 
HT46串口通信
#include......

#pragma vector uart_isp @ 0x10;
unsigned int data;

void delay(unsigned int time)//延时函数,省略内容
{......
}

void uart_init()//初始化函数
{
_urc1=0x80;
_urc2=0xe4;
_brg=51;
_euri=1;//开串口中断
_emi=1;//开总中断
}

void uart_send(unsigned int data)//发送函数
{
unsigned int i;
_txen=1;
i=_usr;
_txr_rxr=data;
while(~_tidle);
}
void uart_isp()//接收函数
{
a[0]=a1];
a[1]=a[2];
data=_txr_rxr;
while(~_ridle);

}
void main()
{
uart_init();
while(1)
{
uart_send(w[0]);
uart_send(w[1]);
uart_send(w[2]);
delay(..)//延时

}
盛群单片机HT46的串口通信,目的是发送三个自己从键盘输入的字符给单片机,然后单片机发送一样的字符到电脑;
为什么实现不了,求正确例程与解释
搜索更多相关主题的帖子: 通信 延时 include 
2012-01-06 19:24
yangjinze
Rank: 1
等 级:新手上路
帖 子:13
专家分:0
注 册:2011-10-2
得分:0 
求助无果,靠自己慢慢来了
2012-01-08 19:47



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-359274-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.159100 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved