wopois 发表于 2007-8-6 14:55
不定........
zhaodan 发表于 2007-8-6 17:37
顶一下!!
bskycn 发表于 2007-8-6 19:22
新手报道,这厢有礼拉.[em13][em13]
anle82 发表于 2007-8-6 20:45
<P>最近在做一个红外通讯程序想利用2个手持器发送字符串和接收字符串并返回发送状态,我写了一个实现字符收发,但不知道到字符串如何写,请大家指点下<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>
紫石 发表于 2007-8-7 20:47
<P>嗯 </P>
张强斌 发表于 2007-8-8 02:45
顶
hanyiask 发表于 2007-8-8 09:32
回复:(静夜思)入境随俗:《编程论坛生存手册》
不支持又能怎么办呢[em13]
anle82 发表于 2007-8-8 14:28
如何给字符数组清零?
ldc_juson 发表于 2007-8-8 21:32
回复:(静夜思)入境随俗:《编程论坛生存手册》
<P>收到。。。。</P>
yaona 发表于 2007-8-9 11:14
回复:(静夜思)入境随俗:《编程论坛生存手册》
实用!学习
scz518 发表于 2007-8-9 21:20
OK
cuiyq001 发表于 2007-8-9 23:34
<P>都说了不让你们灌水,不要用“顶”、“支持”等字,还好这里不是技术区!呵呵。。我觉得楼主说的很对,我们会好好遵守纪律,好好学习,天天想上!</P>
山越散人 发表于 2007-8-10 13:04
<P>谢谢各位楼主了 </P>
a5878387 发表于 2007-8-10 15:23
呵呵 我支持
lgp88864237 发表于 2007-8-10 17:17
小弟出来夹道,大家多多关照,谢谢
fuzz 发表于 2007-8-11 12:33
清楚了,我会严格遵守论坛规矩的
wuzechang 发表于 2007-8-11 13:10
<P>新生报告 强烈支持</P>
孤行的浪子 发表于 2007-8-12 20:10
我刚开始学这个 以后请大家都关照!!
bb968 发表于 2007-8-13 08:59
新手报到<BR>学习一下,和编程一下,论坛也要有规则的。
gosling 发表于 2007-8-13 09:49
支持
页:
1
2
3
4
5
[6]
7
8
9
10
11
12
13
14
15