![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-09-15 05:05 |
47,812 topics / 349,917 posts / today 0 new / 48,268 members |
| DOS开发编程 & 发展交流 (开发室) » Question about DOS serial communication |
| Printable Version 1,077 / 2 |
| Floor1 van150 | Posted 2003-11-12 00:00 |
| 初级用户 Posts 2 Credits 108 | |
|
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 |
|
| Floor2 sunny1979 | Posted 2003-11-13 00:00 |
| 初级用户 Posts 86 Credits 376 | |
|
Could you be a bit more detailed?
|
|
| Floor3 van150 | Posted 2003-11-14 00:00 |
| 初级用户 Posts 2 Credits 108 | |
|
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. |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |