PC Review


Reply
Thread Tools Rate Thread

900 micro-seconds delay

 
 
=?Utf-8?B?LmpvaGFubmVz?=
Guest
Posts: n/a
 
      23rd Nov 2004
Hi

I need to have a 900 micro-seconds break at the com1 port, does anyone know
how to do it?

My project is a IrDA remote control using Windows CE.

..johannes
 
Reply With Quote
 
 
 
 
Dick Grier
Guest
Posts: n/a
 
      23rd Nov 2004
Hi,

You can use the Timer control, wait in a loop using Thread.Sleep, use
DateTime to calculate an elapsed time, or a variety of other mechanisms.

If you simply want to block execution for 900 mS, then proceed, you can
simply do this:
Thread.Sleep(900)

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.


 
Reply With Quote
 
Alex Feinman [MVP]
Guest
Posts: n/a
 
      23rd Nov 2004
He says *micro* seconds. I seriosly doubt you can time intervals under 1
msec without relying on CPU clock speed and a direct knowledge of how long a
particular command executes. I don't think even QueryPErformanceCounters
will be fine-grained enough. Most of all, I don't understand what is the
point of waiting 1/10 of the data bit length

--
Alex Feinman
---
Visit http://www.opennetcf.org
"Dick Grier" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> You can use the Timer control, wait in a loop using Thread.Sleep, use
> DateTime to calculate an elapsed time, or a variety of other mechanisms.
>
> If you simply want to block execution for 900 mS, then proceed, you can
> simply do this:
> Thread.Sleep(900)
>
> Dick
>
> --
> Richard Grier (Microsoft Visual Basic MVP)
>
> See www.hardandsoftware.net for contact information.
>
> Author of Visual Basic Programmer's Guide to Serial Communications, 4th
> Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
> www.mabry.com/vbpgser4 to order.
>
>



 
Reply With Quote
 
Paul G. Tobey [eMVP]
Guest
Posts: n/a
 
      23rd Nov 2004
Microseconds is more of a challenge. I don't think that there's any
standard way, other than maybe a calibrated loop, that you can get your
timing that accurate in CE. That is, you'd have to boost your priority to
real-time, run a loop for a large number of times, until you ran through a
number of milliseconds, then, using the elapsed time and the number of loop
cycles to take that long, figure out how long one cycle takes and, from
that, the number of cycles to use 900uS.

Paul T.

"Dick Grier" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> You can use the Timer control, wait in a loop using Thread.Sleep, use
> DateTime to calculate an elapsed time, or a variety of other mechanisms.
>
> If you simply want to block execution for 900 mS, then proceed, you can
> simply do this:
> Thread.Sleep(900)
>
> Dick
>
> --
> Richard Grier (Microsoft Visual Basic MVP)
>
> See www.hardandsoftware.net for contact information.
>
> Author of Visual Basic Programmer's Guide to Serial Communications, 4th
> Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
> www.mabry.com/vbpgser4 to order.
>
>



 
Reply With Quote
 
Steve Maillet \(eMVP\)
Guest
Posts: n/a
 
      24th Nov 2004
You can P/Invoke the StallExecution function in CEDDK.DLL It is either a
hardware timer implementation or a calibrated loop. The implementation is
OEM specific but it causes a Microsecond accurate stall.

--
Steve Maillet
EmbeddedFusion
www.EmbeddedFusion.com
smaillet at EmbeddedFusion dot com


 
Reply With Quote
 
Dick Grier
Guest
Posts: n/a
 
      24th Nov 2004
I misread micro.

So, Sleep (1)

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.


 
Reply With Quote
 
Dick Grier
Guest
Posts: n/a
 
      24th Nov 2004
Challenging is one phrase. Impossible is another. I misread micro for
milli. IMO, microsecond resolution in ANY non-real-time OS is out of the
question. And, Windows CE certainly falls into this category. Since CF
doesn't have any real-time features, I suspect the solution either is simple
or impossible. Of course, if 900 microseconds really means about 900 (say,
plus or minus 200) then it is much easier.

Still, this question was posted in the CF area, so I don't think a
calibrated loop is of much utility (opinion). If Sleep (1) doesn't work,
then it is time to rethink the problem.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.


 
Reply With Quote
 
Dick Grier
Guest
Posts: n/a
 
      24th Nov 2004
Hi Steve,

Do you have an example where this has been shown to work? I'd have guessed
that it would cause the CF to experience some heartburn.

Do you really suspect that he wanted 900 microseconds, or just something
sorta like that?

The reason that I ask is that the standard definition of Break requires that
it be asserted for 23 bit-times, minimum. Thus, I read 900 mS, which
approaches 23 bit-times for 19.2 Kbps.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.


 
Reply With Quote
 
Dick Grier
Guest
Posts: n/a
 
      24th Nov 2004
Whoops, I meant 900 microseconds for 23 bit-times at 19.2 Kbps. If that is
what he is trying to achieve, then a simple Sleep (1) would work fine --
break timing isn't critical.

If this "break" signal is for something really special, then there may be
some other issue. It is hard for me to believe that any serial comms signal
would require very exact timing.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 4th
Edition ISBN 1-890422-28-2 (391 pages) published July 2004. See
www.mabry.com/vbpgser4 to order.


 
Reply With Quote
 
Steve Maillet \(eMVP\)
Guest
Posts: n/a
 
      24th Nov 2004
Actually I suspect he's not doing a standard break but something custom like
playing games with the IR to do consumer IR/ TV remote type stuff.

--
Steve Maillet
EmbeddedFusion
www.EmbeddedFusion.com
smaillet at EmbeddedFusion dot com


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Thread Sleep Problem - Micro Seconds Darth Microsoft C# .NET 6 12th Feb 2007 12:15 PM
There is a delay every six seconds in Outlook. Why? =?Utf-8?B?SnVkeSBLYXk=?= Microsoft Outlook Discussion 6 28th Nov 2006 05:09 AM
There is a delay every six seconds in Outlook. Why? =?Utf-8?B?SnVkeSBLYXk=?= Microsoft Outlook Installation 1 27th Nov 2006 03:23 PM
15 seconds delay before DNS lookup =?Utf-8?B?aG9wZWxlc3M=?= Windows XP Networking 1 23rd Jan 2006 03:41 PM
SFM 5 seconds delay Mike Kluev Microsoft Windows 2000 Macintosh 0 24th May 2005 03:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:40 PM.