Guidance
指路人
g.yi.org
software / RapidQ / Examples / Devices / RS232 Serial Port / comport / ReadMe.txt

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
COMPORT Component
Version 0.9
December 13, 2001
by Pete Kleinschmidt - petek1827@yahoo.com

This COMPORT Component implements some of the functionality of the missing
QCOMPORT Component.  It uses
the WIN32 API and does not require any additional dlls. Simply add the line
   $INCLUDE "COMPORT.CMP"
to the top of your project and go.

Please note that the COMPORT Component was developed for a small in-house
application.  As
a result it has not been extensively tested.  It currently seems to work
well on my system (Win98SE)
but I cannot guarantee that it will work for others. Use at your own risk.

There are three files included in this package.

   COMPORT.CMP   This is the file that implements the COMPORT Component
   PORTAPP.BAS   This is a small application that demonstrates using the
COMPORT Component
   README.TXT   Your reading it.

Properties

Field         Type      R/W      Default
---------------------------------------------------------
Handle         LONG      R     
Port         STRING      RW      "COM1"
BaudRate      DWORD      RW      9600
DataBits      BYTE      RW      8
Parity         BYTE      RW      0 (NOPARITY)
StopBits      BYTE      RW      1
ReadBufSize      DWORD      RW      1024
WriteBufSize      DWORD      RW      1024
BytesNotRead      DWORD      R      0
BytesNotWritten   DWORD      R      0
Connected      BYTE      R      0 (FALSE)

Methods

Name         Type                  Description
-----------------------------------------------------------------------------------------------------
Open         SUB                  Opens Communication Port
Close         SUB                  Closes Communication Port
WriteString      SUB WriteString(Str$, Wait AS Dword)   Writes a string to a
Communications Port
                           Wait time is in milliseconds
ReadString      FUNCTION (Str$, Wait AS Dword)      Returns a string
representation of data
                           read from a Communications Port
                           Wait time is in milliseconds

Events

Name         Type                  Occurs when
----------------------------------------------------------------------------------------------------
OnOpen         SUB                  Com Port is successfully opened
OnClose      SUB                  Com Port is successfully closed
OnWriteString   SUB                  Data successfully written to Com Port
OnReadString      SUB                  Data successfully read from Com Port
OnComError      SUB(ErrorMessage AS String)         An error occurs


Before you begin trying to work with this component I recommend that you
make sure you can
communicate with your target device using a terminal program.  Make sure you
understand what
settings your device requires and what commands it expects.  There are
probably dozens of these
programs at your favorite shareware site.

This component currently does not have the ability change flow control
settings (Hardware, Xon/Xoff, etc).
When a port is opened it should default to whatever flow control settings
were last used to open
the port or to the default settings.  Implementing it should not be
difficult if you have a good handle on how
flow control works.  It should only involve changing some of the Device
Control Block (DCB) settings
the same way I currently change Baud, Parity, etc.  Deciding which ones and
in what order would be
the tricky part.  The following docs may help you out.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/hardware/commun_2pf7.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwbgen/html/msdn_serial.asp

Please Do not email me asking for help on how to use this component.  Post
your questions
to the discussion board.  I really wish I had the time to help you, but I
don't.  Bug reports
are welcome.
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2024-3-29  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:52:41