home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / os / msdos / programm / 8888 < prev    next >
Encoding:
Text File  |  1992-08-30  |  2.3 KB  |  89 lines

  1. Path: sparky!uunet!dove!enh.nist.gov!tjb
  2. From: tjb@enh.nist.gov
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: com port problem
  5. Message-ID: <30AUG92.18554467@enh.nist.gov>
  6. Date: 30 Aug 92 22:55:44 GMT
  7. Sender: news@dove.nist.gov
  8. Organization: NIST
  9. Lines: 78
  10.  
  11. Hi,
  12. I have an Xt and a 386,
  13. the XT is connected to a printer and a modem
  14. the 386's COM2 is connected to the XT's COM1 through a null-modem
  15. cable.
  16. i want to be able to use the printer&modem from the 386
  17. i can use the printer using a network program, but it's not compatible
  18. with a lot of stuff, and takes up LOTS of memory.
  19. i wanted to use the modem by writing a small C program that
  20. makes the XT transfer COM1 to COM2 and COM2 to COM1
  21. so that COM2(direct link to XT) on the 386 will function as a modem
  22.  
  23.   386               XT
  24.  ---------      --------------
  25.   COM2  ->   COM1  ->  COM2  ->  modem
  26.     COM2  <-   COM1  <-  COM2  <-  modem
  27.  
  28.  
  29. my program so far is:
  30. ---------------------------------------------------------
  31. #include <conio.h>
  32. #include <dos.h>
  33.  
  34. #define COM1 0x3f8
  35. #define COM2 0x2f8
  36. #define COM1S 0x3fd
  37. #define COM2S 0x2fd
  38.  
  39. main()
  40. {
  41.         int com1,com1s,com2,com2s;
  42.  
  43.         while( !kbhit() )
  44.         {
  45.                 com1s = inportb( COM1S );
  46.                 if( com1s & 1)
  47.                 {
  48.                         com1 = inportb( COM1 );
  49.                         outportb( COM2, com1 );
  50.                         printf("got %d from com1\n",com1);
  51.                 }
  52.                 com2s = inportb( COM2S );
  53.                 if( com2s & 1 )
  54.                 {
  55.                         com2 = inportb( COM2 );
  56.                         outportb( COM1, com2 );
  57.                         printf("got %d from com2\n",com2);
  58.                 }
  59.         }
  60. }
  61.  
  62. -----------------------------------------------------------
  63. i usually get something like
  64. com1:a
  65. com2:a
  66. com1:t
  67. com2:t
  68. com1:<return>
  69. com2:<return>
  70. com2:10
  71. com1:f
  72. com2:f
  73. com1:<return>
  74. com2:<return>
  75.  
  76. it seems i have some communication with the modem( it only
  77. gives a line feed after commands beggining with 'at') but
  78. i don't get an OK and i can't dial.
  79. i tried calling first and then activating the program. it seemed to have
  80. sent my keystrokes, but pretty limited( missing return, ctrl-break )
  81. and i didn't get any reasonable things FROM the modem.
  82.  
  83. does anyone know how to make it work??
  84. Thanks,sOmri Barak
  85. Internet: barak@bguee.bgu.ac.il
  86. Bitnet  : barak@bguee
  87.  
  88.  
  89.