simple reading from com ports 
Author Message
 simple reading from com ports

Hi!

I wish to write a program to 'listen' for data from the Comm Port 2.

I hope I don't have to get involved with interrupts etc.

If the data is ASCII , is it really as simple as this?  

PROGRAM ListenCommPort;
{without buffers}

VAR   storeFile, commport2 : Text;
      dataString           : String;

BEGIN
   Assign(commport2,'COMM2'); Reset(commPort2);
   Assign(storeFile,'d:\temp\dump.txt'); ReWrite(storeFile);

   REPEAT
      Readln(commport2,dataString);
      Writeln(storeFile,dataString);
   UNTIL dataString = 'END';

END.

Regards,

John

John Matthews




Wed, 18 Jun 1902 08:00:00 GMT  
 simple reading from com ports

: I wish to write a program to 'listen' for data from the Comm Port 2.
:
: I hope I don't have to get involved with interrupts etc.

        If it is async (no sync mechanism) it depends
on how fast the data may be sent.

: If the data is ASCII , is it really as simple as this?  

        Terminal programs (they work without modems too),
use a circular buffer and sends handshaking code to delay
and start transmission depending on how full the buffer
is.

        An example in Turbo Pascal can be found in the
terminal program PIBTERM by Phil Burns, there is a TP3
version and a TP 4 version.

        Early on, a way was needed to transfer data
to and from different platforms that commications
software was no available for, and since most machines
had a version of BASIC on them, short programs were
used that used time delay instead of XON and XOFF,
but the data had to be converted to 7 bit Hex data
to avoid the 0..27 control codes.

        I have both the Phil Burns source code
packages, but I can't find one of four Zips from
the TP4 package, but I'm sure  I have it.
        It does use asm to manage the circular
buffer, which TP code then reads from.   Sending
is done directly with only the code to wait until
an XON is received.
        The TP4 version is extensive with host mode,
ansi music code, and lots of other stuff.

Ken Fischer

---



Wed, 18 Jun 1902 08:00:00 GMT  
 simple reading from com ports

Quote:

> Hi!

> I wish to write a program to 'listen' for data from the Comm Port 2.

> I hope I don't have to get involved with interrupts etc.
> [snip!]

Your best bet is to look for an already written serial communications library
that has high level calls to do everything you need (shouldn't be easy to find
-- check the pc stuff in ftp://garbo.uwasa.fi/pc/ or
ftp://ftp.simtel.net/pub/simtelnet/msdos/turbopas/).  To put it simply,
standard file I/O just won't cut it (not to mention the fact that the device
name is "COM2" or "COM2:").

Quote:
> Regards,

> John

> John Matthews



--
Scott Earnest            | SPAM protection in effect. Remove  |





Wed, 18 Jun 1902 08:00:00 GMT  
 simple reading from com ports

John Matthews schrieb in Nachricht ...

Quote:
>I wish to write a program to 'listen' for data from the Comm Port 2.
>I hope I don't have to get involved with interrupts etc.
>If the data is ASCII , is it really as simple as this?

Even is the programm is very simple you might want to look into a FOSSIL
driver API.
The driver will handle all to I/O and you just have to interface with the
driver.
You can't handle Serial I/O in a Windows or multi tasking system at hardly
*any* speed
without interrupts or without the program sometimes dropping charaters.

At FOSSIL is not very modern, but it is effective.

try it,
Stefan



Wed, 18 Jun 1902 08:00:00 GMT  
 simple reading from com ports

Quote:
> Even is the programm is very simple you might want to look into a
> FOSSIL driver API.

my simple TPascal FOSSIL interface is in `tpserio2.zip', probably
available at:

  <http://simtel.coast.net/Coast/msdos/turbopas.html>
--



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Com Port Routies

2. Problems with com ports and windows 2000

3. Access to COM-Port

4. com port already in use broblem

5. Accessing COM ports under Win NT with BP 7.0

6. Accessing com-port

7. Com Port Access

8. Simplying serial com port selection

9. Com-port

10. Com Port Routines

11. HELP- Writing to com ports!

12. COM-Port

 

 
Powered by phpBB® Forum Software