Article View: borland.public.cppbuilder.nativeapi
Article #8870Re: Comm Port
From: McKool
Date: Tue, 14 Sep 2004 07:23
Date: Tue, 14 Sep 2004 07:23
67 lines
4114 bytes
4114 bytes
I use the normal Configuration, but when you configure the Port in a normal
way (8,N,1) are not in total 9 bits instead of 10? i need to have a low
signal in the port for 25 ml, so 9bits / 360 bauds = 0,025 => 25 ml is it
not?
I'm using Widnows but which blocking calls do you refer? I'm use
"TransmitCommChar"... it is a boolean function and I supposed that it
returns only when the byte is sent (so when everything is Ok).
My problem is that ai have to be precise in the time when i write the two
bytes because the divice read the low and hight signals in the port in order
to get active and i have to pulse 25 ml low and then hight oder 25 ml with a
error margin of 1 ml.
25 ml low| 25 ml Hight | hier start my real communication.
--------- --------------
| | |
| | |
|---------- | |50 ml
Because of that I try to send a 0x0 using 360 baud, but after the 25 ml low
i have to change to the communication baud which is 10472 and send the start
byte... this start byte shall arrive to the device between the ml 49 and ml
51. The 25 ml are OK, but when i change the configuration and sent the
start byte i lose time, and i can not calculate it....
Can i maybe at 10472 in someway make the same low-hight behavior?
"Bob Gonder" <notbg@notmindspring.invalid> schrieb im Newsbeitrag
news:88fbk0d602p65ajvc5lk89tc2bc5qv93dg@4ax.com...
> 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:
<41469b86$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4145a779$1@newsgroups.borland.com> <88fbk0d602p65ajvc5lk89tc2bc5qv93dg@4ax.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: "McKool" <kenethw@peak-system.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <4145a779$1@newsgroups.borland.com> <88fbk0d602p65ajvc5lk89tc2bc5qv93dg@4ax.com> Subject: Re: Comm Port Date: Tue, 14 Sep 2004 09:23:25 +0200 Lines: 69 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 213.157.13.214 Message-ID: <41469b86$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1095146374 213.157.13.214 (14 Sep 2004 00:19:34 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!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