home *** CD-ROM | disk | FTP | other *** search
- Program T301Demo ;
-
- {$I T301_ASY.INC }
-
- {=============================================================================
- The following program is a VERY dumb glass CRT example program on how to use
- the asynchronos routines. I hope this routine is of some help.
- =============================================================================}
-
- label quit ;
-
- var
-
- Port,
- Baud,
- Data_Bits,
- Stop_Bits :Integer ;
-
- Parity :char ;
-
- ser_char,
- key_char :char ;
- at_str :string[17] ;
-
-
- begin
- ClrScr ;
- Writeln ('Welcome to a demonstration of NewAsync, Version 2.00') ;
- Writeln ('This Program is written explicitly for Turbo Pascal 3.01') ;
- Writeln ('(Some of us just have not upgraded yet.)') ;
- Writeln ;
- Writeln ('This program is Copyrighted by Gene Harris, 1986,1987,1988.') ;
- Writeln ('If problems are found, notify me at CompuServe 72067,321') ;
- Writeln ;
- Writeln ('Please note, no error checking is performed on input,') ;
- Writeln ('so do not monkey around too much and expect it to work.') ;
- Writeln ;
- Write ('Please enter the baud rate (300, 1200, 2400 or 9600): ') ;
- Readln (Baud) ;
- Write ('Please enter COM port number: ') ;
- Readln (Port) ;
- Write ('Enter Data bits (6, 7 or 8): ') ;
- Readln (Data_Bits) ;
- Write ('Enter Stop Bits (1 or 2): ') ;
- Readln (Stop_Bits) ;
- Write ('Enter Parity Character ((N)one (E)ven or (O)dd ): ') ;
- Readln (Parity) ;
- AUXINPTR := ofs(Readchar) ; { Assign aux input device driver }
- AUXOUTPTR := ofs(Writechar) ; { Assign aux output device driver }
- { Open the communications port. }
-
- InitComPort (Port, 256, 256) ;
- SetCOM (Baud,Data_Bits,Stop_Bits,Parity) ;
- UseCTS ;
- if OpenError then goto quit ;
- writeln ('Port Opened') ;
- Writeln ('Please enter a command to your modem and hit return.') ;
- Writeln ('When you have completed your testing, press the <ESC> key.') ;
- Writeln ;
- key_char := #32 ;
- repeat
- if keypressed then begin { Correct procedure for reading the }
- read (kbd, key_char) ; { keyboard and sending a character }
- if key_char <> #27 then begin
- write( aux, key_char) ;
- ikp := ikp + 1 ;
- end ;
- end ;
- if RS232ChrAvailable then begin { Correct procedure to read the RS232 }
- read(aux, ser_char) ; { communications port. }
- write (ser_char)
- end ;
- if LSRstat <> 0 then begin { Check LSRstat byte for overflow. }
- writeln('Line Status Error: ',LSRstat) ;
- LSRstat := 0 ;
- end ;
- until key_char = #27 ;
- quit :
- CloseCom ;
- writeln('Program Completed Communications Port Closed') ;
- { writeln (i0:6,i2:6,i4:6,i6:6,ir:6,iw:6, ikp:6) ; }
- end.