home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / PASCAL / T301AS.ZIP / T301DEMO.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1989-01-04  |  2.8 KB  |  82 lines

  1. Program T301Demo ;
  2.  
  3. {$I T301_ASY.INC }
  4.  
  5. {=============================================================================
  6.   The following program is a VERY dumb glass CRT example program on how to use
  7.   the asynchronos routines.  I hope this routine is of some help.
  8.  =============================================================================}
  9.  
  10. label quit ;
  11.  
  12. var
  13.   
  14.   Port,
  15.   Baud,
  16.   Data_Bits,
  17.   Stop_Bits      :Integer ;
  18.  
  19.   Parity         :char ;
  20.  
  21.   ser_char,
  22.   key_char       :char ;
  23.   at_str         :string[17] ;
  24.  
  25.  
  26. begin
  27.   ClrScr ;
  28.   Writeln ('Welcome to a demonstration of NewAsync, Version 2.00') ;
  29.   Writeln ('This Program is written explicitly for Turbo Pascal 3.01') ;
  30.   Writeln ('(Some of us just have not upgraded yet.)') ;
  31.   Writeln ;
  32.   Writeln ('This program is Copyrighted by Gene Harris, 1986,1987,1988.') ;
  33.   Writeln ('If problems are found, notify me at CompuServe 72067,321') ;
  34.   Writeln ;
  35.   Writeln ('Please note, no error checking is performed on input,') ;
  36.   Writeln ('so do not monkey around too much and expect it to work.') ;
  37.   Writeln ;
  38.   Write ('Please enter the baud rate (300, 1200, 2400 or 9600): ') ;
  39.   Readln (Baud) ;
  40.   Write ('Please enter COM port number: ') ;
  41.   Readln (Port) ;
  42.   Write ('Enter Data bits (6, 7 or 8): ') ;
  43.   Readln (Data_Bits) ;
  44.   Write ('Enter Stop Bits (1 or 2): ') ;
  45.   Readln (Stop_Bits) ;
  46.   Write ('Enter Parity Character ((N)one (E)ven or (O)dd ): ') ;
  47.   Readln (Parity) ;
  48.   AUXINPTR := ofs(Readchar) ;           { Assign aux input device driver      }
  49.   AUXOUTPTR := ofs(Writechar) ;         { Assign aux output device driver     }
  50.                                         { Open the communications port.       }
  51.  
  52.   InitComPort (Port, 256, 256) ;
  53.   SetCOM (Baud,Data_Bits,Stop_Bits,Parity) ;
  54.   UseCTS ;
  55.   if OpenError then goto quit ;
  56.   writeln ('Port Opened') ;
  57.   Writeln ('Please enter a command to your modem and hit return.') ;
  58.   Writeln ('When you have completed your testing, press the <ESC> key.') ;
  59.   Writeln ;
  60.   key_char := #32 ;
  61.   repeat
  62.     if keypressed then begin            { Correct procedure for reading the   }
  63.       read (kbd, key_char) ;            { keyboard and sending a character    }
  64.       if key_char <> #27 then begin
  65.          write( aux, key_char) ;
  66.          ikp := ikp + 1 ;
  67.       end ;
  68.     end ;
  69.     if RS232ChrAvailable then begin     { Correct procedure to read the RS232 }
  70.          read(aux, ser_char) ;          { communications port.                }
  71.          write (ser_char)
  72.     end ;
  73.     if LSRstat <> 0 then begin          { Check LSRstat byte for overflow.    }
  74.        writeln('Line Status Error: ',LSRstat) ;
  75.        LSRstat := 0 ;
  76.     end ;
  77.   until key_char = #27 ;
  78. quit :
  79.   CloseCom ;
  80.      writeln('Program Completed Communications Port Closed') ;
  81. {     writeln (i0:6,i2:6,i4:6,i6:6,ir:6,iw:6, ikp:6) ; }
  82.  end.