Article View: borland.public.cppbuilder.nativeapi
Article #8801Re: Comm Port
From: McKool
Date: Thu, 16 Sep 2004 12:20
Date: Thu, 16 Sep 2004 12:20
65 lines
3188 bytes
3188 bytes
Bob Gonder wrote: > Is this what you need to happen? > 25 ms low, > 25ms high, > then commands at 10400 baud? Yes, exact that timing and it must to be so: Baud: 360 -> 25 ml low, 25 ml hight (total of 50 ml) Baud: 10472 -> init byte (maximal at milli 51). > Huh? > There is no 360 setting. Docs say 300 or 600. 360 is not an standard setting but you can use whichever baudrate, when the baud is between the aalowed range. > The duration of a character at 360 baud would be 1/36 second. The > duration of the 8 zero bits would be 1/45 second. > But, you are looking for a zero duration of 1/40 second (25 ms) > OTOH, if you set Parity to Even instead of None, then you would get a > Zero-Time of 1/40 second. > But, that makes it hard to get 25 ms of high. So far as I know (just what i tried this week ;-) ) the speed to sent a byte is the number of bytes over the speed of the port, so 1 byte / 360 baud which is 0,025 seg (25ml). The osciloscope tell me that the calculation is ok. with 360 b i sent a 0x0 and i get 25 ml of pulse. > Don't open the port with FILE_FLAG_OVERLAPPED. > Use WriteFile() with lpOverlapped = NULL. The behavior is bettter... now i can see that a time to write a byte is 2.8 ml. Now i have to play a little with multitreathing or multimedia timer. Thanks it was very helpfully. > Try this sequence: > > CreateFile(); > SetBaud(10400); > SetThreadPriority(Higher) > starttime=GetTime(); > SetCommBreak(); > while( (GetTime()-starttime) < 25ms ); > ClearCommBreak(); > SetThreadPriority(Normal) > /*Now for 25ms high.*/ > WriteFile( 26 times 0xff ) /* (10400/10)/40 == 26 */ > WriteFile(Commands) So comes many fast picks ... not only one. I try to make now someting like : - configure port Synchronic at 360 bauds - Save Start Time. - Write 0x0 - Save Stop time - calculate the difference between times - wait 25 ml - the calculate Time differences - Send byte for Start communication It shall work.. Thanks again Keneth
Technical Details
Message-ID:
<41498410@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.zanker.org!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4145a779$1@newsgroups.borland.com> <88fbk0d602p65ajvc5lk89tc2bc5qv93dg@4ax.com> <41469b86$1@newsgroups.borland.com> <4146b149$1@newsgroups.borland.com> <jf9ek095ohfqfgl304ncsf62mhc340nu88@4ax.com> <41483adc@newsgroups.borland.com> <414844ac$1@newsgroups.borland.com> <iq3hk010j18jjg2bl6lhvhtedq351sb9g1@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> <41469b86$1@newsgroups.borland.com> <4146b149$1@newsgroups.borland.com> <jf9ek095ohfqfgl304ncsf62mhc340nu88@4ax.com> <41483adc@newsgroups.borland.com> <414844ac$1@newsgroups.borland.com> <iq3hk010j18jjg2bl6lhvhtedq351sb9g1@4ax.com> Subject: Re: Comm Port Date: Thu, 16 Sep 2004 14:20:10 +0200 Lines: 67 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: <41498410@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1095336976 213.157.13.214 (16 Sep 2004 05:16:16 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news.zanker.org!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail