📄 readme.txt
字号:
SETUP
---------------
BCB Version 3.0 Installion -
Install New Package "Serial", or install component separately as part of a package of your choosing.
The ComThread and TAdvancedCom Components will be installed in the "Extras" tab on the component palette.
Use of the component is simple, the demo program demonstrates 90% of it's features.
Basically, you need to do two things to get the component connected to your serial port:
1) Assign a response function to it's "OnPacketReceived" event handler.
2) Call "TComThread::ComInit()" somewhere in your code.
You don't need to call "TComThread::ComClose()" at program termination (it will be called automatically), but the function is provided if you need or desire to release the port during execution of your program.
NEW FEATURES:
---------------
(---1---)
TAdvancedCom Component added to package:
new properties:
DTRControl (enable, disable, handshake options)
RTSControl (disable, enable, handshake, toggle options)
Dtr - read and set current dtr state (boolean)
Rts - read and set current rts state (boolean)
new events:
void __fastcall TForm1::AdvancedCom1StatusChanged(TObject *Sender,
bool ctsOn, bool dsrOn, bool ringOn, bool rlsdOn)
{
// reports status of cts, dsr, ring, and rlsd flags.
}
(---2---)
a new event function which is called when one of the
TComThread returns a "packet" of characters in the "OnPacketReceived" event response function.
The size of the packet is set by the PacketSize property.
Comm read timeouts are also implemented, based on the Timeout property, as follows:
- ReadIntervalTimeout = Timeout/10 + 1; -- time allowed between characters
- ReadTotalTimeoutMultiplier = Timeout/10 + 1; -- extra time allowed for each char ( ie multiplied times PacketSize)
- ReadTotalTimeoutConstant = Timeout; -- additional constant time before
so for example, with a packetsize of 80 characters, and a timeout value of 100 (milliseconds), the values would be:
ReadIntervalTimeout == 11
ReadTotalTimeoutMultiplier == 11
ReadTotalTimeoutConstant == 100
total timeout == 100 + (80 * 11) == 980
however, if an invterval of 11 milliseconds passed between receipt of 2 chars, an even would be triggered returning the amount of char's read so far (if any)
no event is triggered on timeout if the buffer is empty.
(---3---)
TComThread uses asynchronous "overlapped" reading and writing, which greatly improves performance.
I have as yet to test it at speeds greater than 19200, but as soon as i find a null modem cable ...
This should theoretically also be all that's needed to make it function perfectly well under WindowsNT, but I have no NT test environment, so if you're using that OS, support is necessarily fairly limited.
(---4---)
Write timeout problem fixed.
Null characters (0x00) are now sent and received properly.
A note about transmitting binary data containing null characters:
- to send, call TComThread::Write( char* buf, int len) rather than TComThread::Write( AnsiString buf);
the second version of the Write function calls the first version, using AnsiString's c_str() function, so calling this
when you want to transmit binary data containing the NULL character will result in truncation of your data at the first
NULL.
- receiving works the same in this version as it did in previous versions: you receive an AnsiString containing your
incoming data. I have modified the code internally so that data containing NULL characters is now copied correctly to
the incoming buffer. Be wary however, as many functions treat AnsiString as a NULL terminated string, even though
strictly speaking it is not. For instance : if you use the AnsiString::c_str() function to look at the buffer, you will
only see up to the first NULL character. Following is a short example of how to copy an AnsiString containing NULL
characters into a character buffer:
void AnsiStringCopy( AnsiString &s, char *buf) // assumes "buf" has been allocated by caller
{
for( int i=0; i<s.Length(); i++)
buf[i]=s[i+1];
}
(---5---)
Component updated for BCB version 3.0
KNOWN PROBLEMS:
---------------
No known bugs or problems. component has been tested at all baud rates, on Win95 and
WinNT 4.0.
No warranty is offered, neither expressed or implied. Use this software at your own risk.
CONTACT ME:
---------------
source is available for $25 U.S.
email : giles@protogene.com
mail : giles biddison
201 W. California #1407
Sunnyvale, CA 94086
daytime phone : (650)842-7106 (9am - 5pm PST)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -