学习型 ASP/PHP/ASP.NET 主机 30元/年全能 ASP/PHP/ASP.NET 主机,支持月付专业 MSSQL 数据库空间,支持月付专业 MySQL 数据库空间,支持月付
发新话题
打印

入境随俗:《编程论坛生存手册》

本主题由 静夜思 于 2008-3-8 13:16 置顶
不定........

TOP

顶一下!!

TOP

新手报道,这厢有礼拉.

TOP

最近在做一个红外通讯程序想利用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;
}

这个代码该如何修改

TOP

TOP

TOP

回复:(静夜思)入境随俗:《编程论坛生存手册》

不支持又能怎么办呢
1992年4月5号那天,护士对俺娘说,许多年以后,这娃相当"牛B"。

TOP

如何给字符数组清零?

TOP

回复:(静夜思)入境随俗:《编程论坛生存手册》

收到。。。。

TOP

回复:(静夜思)入境随俗:《编程论坛生存手册》

实用!学习
你不是我,你又怎么明白我?

TOP

发新话题