home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dove!enh.nist.gov!tjb
- From: tjb@enh.nist.gov
- Newsgroups: comp.os.msdos.programmer
- Subject: com port problem
- Message-ID: <30AUG92.18554467@enh.nist.gov>
- Date: 30 Aug 92 22:55:44 GMT
- Sender: news@dove.nist.gov
- Organization: NIST
- Lines: 78
-
- Hi,
- I have an Xt and a 386,
- the XT is connected to a printer and a modem
- the 386's COM2 is connected to the XT's COM1 through a null-modem
- cable.
- i want to be able to use the printer&modem from the 386
- i can use the printer using a network program, but it's not compatible
- with a lot of stuff, and takes up LOTS of memory.
- i wanted to use the modem by writing a small C program that
- makes the XT transfer COM1 to COM2 and COM2 to COM1
- so that COM2(direct link to XT) on the 386 will function as a modem
-
- 386 XT
- --------- --------------
- COM2 -> COM1 -> COM2 -> modem
- COM2 <- COM1 <- COM2 <- modem
-
-
- my program so far is:
- ---------------------------------------------------------
- #include <conio.h>
- #include <dos.h>
-
- #define COM1 0x3f8
- #define COM2 0x2f8
- #define COM1S 0x3fd
- #define COM2S 0x2fd
-
- main()
- {
- int com1,com1s,com2,com2s;
-
- while( !kbhit() )
- {
- com1s = inportb( COM1S );
- if( com1s & 1)
- {
- com1 = inportb( COM1 );
- outportb( COM2, com1 );
- printf("got %d from com1\n",com1);
- }
- com2s = inportb( COM2S );
- if( com2s & 1 )
- {
- com2 = inportb( COM2 );
- outportb( COM1, com2 );
- printf("got %d from com2\n",com2);
- }
- }
- }
-
- -----------------------------------------------------------
- i usually get something like
- com1:a
- com2:a
- com1:t
- com2:t
- com1:<return>
- com2:<return>
- com2:10
- com1:f
- com2:f
- com1:<return>
- com2:<return>
-
- it seems i have some communication with the modem( it only
- gives a line feed after commands beggining with 'at') but
- i don't get an OK and i can't dial.
- i tried calling first and then activating the program. it seemed to have
- sent my keystrokes, but pretty limited( missing return, ctrl-break )
- and i didn't get any reasonable things FROM the modem.
-
- does anyone know how to make it work??
- Thanks,sOmri Barak
- Internet: barak@bguee.bgu.ac.il
- Bitnet : barak@bguee
-
-
-