🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #8866

Re: Comm Port

#8866
From: Bob Gonder
Date: Mon, 13 Sep 2004 15:42
33 lines
2515 bytes
McKool wrote:

>Hello, I'm sending bytes through the port to a device.  I need to know the 
>times when the information come to the device, i mean, calculate the needed 
>time for a byte to travel from the port to the target.  I configure the port 
>to 360 baud and i send 0x0, then a want to change the baud to 10400 just 
>when i the 0x0 was received and send other byte.  I have to send this two 
>bytes with that configuration in a time between 49 and 51 millis.... So the 
>question is how can calculate the time needed in each configuration to 
>complete a send of a byte in order to calculate my sending times.... shall 
>be a formula for that, but i don't know it....

Depends on your other settings.
These are the things that get sent, and the "bits" they take:
Start	1	always unless running in sync mode, then 0
data	8	setable between 6, 7 and 8 I think
parity	1	setable 0 or 1
stop	1	setable to 1, 1.5  or  2 (0 for sync mode)

"Normal" settings are (8,N,1) for a total of 10 bits.

Each bit at 360 baud takes 1/360 second.
Simple arithmetic from there.

Now, that assumes a DOS box.
If you are using a DOS system, then you can also keep checking the
USART for completion status, then reprogram it for the new baud.

If you are using Windows, then there isn't much telling "when" the
data starts going out, as Win can buffer and send when it pleases.
I think your best bet for Windows app would be to use blocking calls
(functions that don't return until the data has been sent), then just
set baud, send, set baud, send.
Technical Details
Message-ID: <88fbk0d602p65ajvc5lk89tc2bc5qv93dg@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4145a779$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,c3fce443b4c5c053
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Comm Port
Date: Mon, 13 Sep 2004 08:42:25 -0700
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <88fbk0d602p65ajvc5lk89tc2bc5qv93dg@4ax.com>
References: <4145a779$1@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 65.173.66.86
X-Trace: newsgroups.borland.com 1095090145 65.173.66.86 (13 Sep 2004 08:42:25 -0700)
Lines: 35
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail