| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 564 人关注过本帖
标题:[求助]用2个红外手持器发送字符串和接收字符串并返回发送状态
只看楼主 加入收藏
anle82
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2007-8-6
收藏
 问题点数:0 回复次数:0 
[求助]用2个红外手持器发送字符串和接收字符串并返回发送状态

大家好!我写了个收发字符但不能实现字符串发送该如何在这个程序里修改:?

#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <dos.h>
#include <time.h>
#include <io.h>
#include <fcntl.h>
#include <process.h>
#include <stdio.h>
#include <infrared.h>
#include <htlcd.h>
#include <htxlcd.h>
#include <commplus.h>
#include <htproces.h>
#include <barcode.h>
#include <htosex.h>

main()
{
unsigned char ascch, auxb, auxstat,workmode,commport,send,akey,str[7];

unsigned int baudrate,inRx,i;



printf("打开红外电源:\r\n");
IRPowerCtrl(_IRPowON); //红外电源控制 122
SetIRMFreq(38000); //设制红外调制频率 38k 122
getch();
printf("打开红外输出:\r\n");
SetIROutput(0);

do {
} while (!kbhit()); //kbhit()用来检测键盘是否有按键,有则返回-1,没有则返回0
printf("设置红外输出:\r\n");
SetIROutput(2);
do {
} while (!kbhit());
getch();

GetCommMode(&workmode, &commport, &baudrate); //取当前通讯串口、通讯方式和波特率 107
SetCommMode(3, 1, 1200); //设置通讯串口、通讯方式和波特率 107
EnableRx(0);

printf("请输入一些字符串并发送: \r\n");

send = 0;

do {
if (kbhit())
{
akey=getch();
if (akey !=auxb){
if (!send)
send = 1;

PutAuxByte(akey);
printf("%c\r\n",akey);

}
}
if (ExistAuxBGot(&auxb,&auxstat))
{ if (send)
printf("\r\n");
send = 0;
printf("%c\n",auxb);

}

} while (akey !=27);
IRPowerCtrl(_IRPowOFF); //红外电源控制 122
SetIRMFreq(0); //设制红外调制频率 0 122
DisableRx(); //禁止串行口接收任何数据
SetCommMode(workmode, commport, baudrate);
return 0;
}

这段代码怎么改?

搜索更多相关主题的帖子: 字符 红外 状态 
2007-08-06 20:28
快速回复:[求助]用2个红外手持器发送字符串和接收字符串并返回发送状态
数据加载中...
 
   



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

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