China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-07-02 14:57
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » Question about DOS serial communication View 974 Replies 2
Original Poster Posted 2003-11-12 00:00 ·  中国 河南 郑州 联通
初级用户
Credits 108
Posts 2
Joined 2003-11-12 00:00
22-year member
UID 12730
Gender Male
Status Offline
Experts, I'd like to ask: does DOS have any configuration requirements for writing COM serial port (RS232) communication? How do you configure it?
I wrote it with TC++3.0 but still can't get it to work. Could you give me some pointers?
Using #include
_bios_serialcom(_COM_INIT, comport, _COM_CHR8|_COM_STOP1|_COM_NOPARITY|_COM_2400); function
Floor 2 Posted 2003-11-13 00:00 ·  中国 陕西 西安 电信
初级用户
★★
忍者
Credits 376
Posts 86
Joined 2003-10-16 00:00
22-year member
UID 11361
Gender Male
Status Offline
Could you be a bit more detailed?
以C语言软件开发为主:http://sunny1979.icpcn.com
Floor 3 Posted 2003-11-14 00:00 ·  中国 河南 郑州 联通
初级用户
Credits 108
Posts 2
Joined 2003-11-12 00:00
22-year member
UID 12730
Gender Male
Status Offline
The sample program is as follows:
#include
#include
#include

void main(){

unsigned comport=0;
unsigned status;
status=_bios_serialcom(_COM_INIT, comport, _COM_CHR8|_COM_STOP1|_COM_NOPARITY|_COM_2400);
cout<<(status&0x100);

cout<<"input type:";
char keychar;
unsigned char sif=0xa0,sis=0xa1,a,b,c;
cout<<sif<<sis;
do{
keychar =getch();

if (keychar==113)
return;

switch(keychar){
case 121:
_bios_serialcom(_COM_SEND, comport, sis);
case 49:
a=1;b=1;c=0;break;
case 50:
a=2;b=1;c=5;break;
case 51:
a=3;b=2;c=0;break;
case 52:
a=4;b=3;c=0;break;
case 53:
a=5;b=5;c=5;break;
default: ;
}

_bios_serialcom(_COM_SEND, comport, sif);
_bios_serialcom(_COM_SEND, comport, a); cout<<a;
_bios_serialcom(_COM_SEND, comport, b); cout<<b;
_bios_serialcom(_COM_SEND, comport, c); cout<<c; cout<<endl;
} while(1);

}
Compiled with turbo c++3.0 r
But the COM device can't receive the signal. Is it that I still need some driver or something?
What I mainly want to understand is how to implement simple COM serial data sending and receiving under DOS. Please help.
Forum Jump: