[求助]用2个红外手持器发送字符串和接收字符串并返回发送状态
<P>大家好!我写了个收发字符但不能实现字符串发送该如何在这个程序里修改:?<BR><BR>#include <stdlib.h><BR>#include <string.h><BR>#include <conio.h><BR>#include <dos.h><BR>#include <time.h><BR>#include <io.h><BR>#include <fcntl.h><BR>#include <process.h><BR>#include <stdio.h> <BR>#include <infrared.h><BR>#include <htlcd.h><BR>#include <htxlcd.h><BR>#include <commplus.h><BR>#include <htproces.h><BR>#include <barcode.h><BR>#include <htosex.h></P><P> main()<BR> {<BR> unsigned char ascch, auxb, auxstat,workmode,commport,send,akey,str[7];</P>
<P> unsigned int baudrate,inRx,i;</P>
<P> <BR> <BR> </P>
<P> printf("打开红外电源:\r\n");<BR> IRPowerCtrl(_IRPowON); //红外电源控制 122<BR> SetIRMFreq(38000); //设制红外调制频率 38k 122<BR> getch();<BR> printf("打开红外输出:\r\n");<BR> SetIROutput(0);<BR> <BR> do {<BR> } while (!kbhit()); //kbhit()用来检测键盘是否有按键,有则返回-1,没有则返回0<BR> printf("设置红外输出:\r\n");<BR> SetIROutput(2);<BR> do {<BR> } while (!kbhit()); <BR> getch(); <BR> <BR> GetCommMode(&workmode, &commport, &baudrate); //取当前通讯串口、通讯方式和波特率 107<BR> SetCommMode(3, 1, 1200); //设置通讯串口、通讯方式和波特率 107<BR> EnableRx(0); </P>
<P> </P>
<P> printf("请输入一些字符串并发送: \r\n");<BR> <BR> send = 0;<BR> </P>
<P> do {<BR> if (kbhit()) <BR> { <BR> akey=getch(); <BR> if (akey !=auxb){<BR> if (!send)<BR> send = 1; <BR> <BR> PutAuxByte(akey);<BR> printf("%c\r\n",akey);<BR> <BR> } <BR> }<BR> if (ExistAuxBGot(&auxb,&auxstat))<BR> { if (send)<BR> printf("\r\n");<BR> send = 0;<BR> printf("%c\n",auxb);<BR> <BR> }<BR> <BR> } while (akey !=27);<BR> IRPowerCtrl(_IRPowOFF); //红外电源控制 122<BR> SetIRMFreq(0); //设制红外调制频率 0 122<BR> DisableRx(); //禁止串行口接收任何数据<BR> SetCommMode(workmode, commport, baudrate); <BR> return 0;<BR>}</P>
<P>这段代码怎么改?</P>
页:
[1]
