900 micro-seconds delay

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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.
 
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
 
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.
 
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.
 
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.
 
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.
 
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.
 
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.
 
Let's be clear on some things here:
1) Windows CE supports Hard Real-Time systems. No OS, in and of itself,
guarantees a complete system is real-time. The OS can only provide the
support needed to implement one - the rest is up to the device OEM.
2) The .NET Compact Framework (CF) does NOT support the creation of
Real-Time applications. You can implement time critical code in C/C++ and
use P/Invoke and other mechanisms to communicate with the CF based code as
needed.

No context information was provided for this problem beyond the need for a
900uS delay. If more was provided someone here might have a simple
pre-existing solution to the problem being solved.
 
Back
Top