关于c中的bioscom问题 [英] about bioscom problem in c
本文介绍了关于c中的bioscom问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
i有一个问题,我使用bioscom函数,但它不能正常工作,biosocm的示例代码也不能正常工作,我的comp规范是windows 7 -32位,编译器是turbo c dos box -16 bit。
- 这是代码,问题是这个代码无法访问com端口我的电脑。
hello ,
i have a question that i m using a bioscom function but it is not work properly , sample code of biosocm is also not work properly, my comp spec is windows 7 -32 bit, compiler is turbo c dos box -16 bit.
--here is the code ,and the problem is this that this code can't b able to acess the com port of my pc.
#include<conio.h>
#include <stdio.h>
#define COM1 0
#define DATA_READY 0x100
#define SETTINGS ( 0x80 | 0x02 | 0x00 | 0x00)
int main(void)
{
int in, out, status;
bioscom(0, SETTINGS, COM1); /*initialize the port*/
printf("Data sent to you: ");
while (1)
{
status = bioscom(3, 0, COM1); /*wait until get a data*/
if (status & DATA_READY)
if ((out = bioscom(2, 0, COM1) & 0x7F) != 0) /*input a data*/
putch(out);
if (kbhit())
{
if ((in = getch()) == 27) /* ASCII of Esc*/
break;
bioscom(1, in, COM1); /*output a data*/
}
}
return 0;
}
提前感谢
thanks in advance
推荐答案
参见http://flounder.com/serial.htm [ ^ ]用于在Windows中使用串行I / O的正确方法。
See http://flounder.com/serial.htm[^] for the correct method of using serial I/O in Windows.
这篇关于关于c中的bioscom问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文