Searching \ for '[OT] Re: Real time in Windows' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/timers.htm?key=real+time
Search entire site for: 'Re: Real time in Windows'.

Exact match. Not showing close matches.
PICList Thread
'[OT] Re: Real time in Windows'
1999\10\29@110651 by Chris Eddy

flavicon
face
part 0 2496 bytes
x-html> Luis;

It is actually easier than one would think.  Simply install the 'Linux' program and windows suddenly behaves very well.  No more blue screens, no more crashed programs, no more sudden crawling operating system.&nbs p; I suggest it for a patch for all Windows systems.

Chris Eddy
Pioneer Microsystems, inc.

Luis Otávio Médici wrote:

 Hi, I am brazilian electrical engineer and I was beginning to program the PIC. I was trying to developer a PIC inside´s Data Acquisicion Card . The assembly code is ok, otherwise the sw in Delphi that receive, show and store the data wasn´t working like its should. The system monitored is fast and needs of Real Time treatment and make a Real Time Sw in Windows is very difficult. Anybody has some tips about Windows Real Time Programming? Are there specifical APIs ? Book or Web Sites ? Thank you,&nb sp;A good site about microcontroller technology is www.microcontroller.com ---------------------------------------------------------------------- ---------------------
      &nbs p;                    Luis Otávio Médici            ICQ: 12869917
      &nbs p;                lmedici@asatnet.com.br
      &nbs p;    São Bernardo do Campo -SP /   Brasil
---------------------------------------- ---------------------------------------------------

1999\10\29@112935 by Anderson, Roger

picon face
I get the Linux Bits( http://www.linuxdot.org <http://www.linuxdot.org> )
newsletter and it seems
Linux users have just as many problems as windows users
trying to make their systems stable and usable.

roger

Roger H. Anderson
Engineer III
Bioengineering
The University of Iowa
54 Medical Research Facility
Iowa City, IA  52242-1183
(319) 384-8339

{Original Message removed}

1999\10\29@125934 by Dan Creagan

flavicon
face
Linux has hoards of bugs for many of the user developed programs. However,
almost every crash I've had (very few system crashes like M$) was related to
shareware or freeware stuff.  The environment itself is pretty stable.  I
had one installation running for about three years and it never locked up
once.  The hard drive and video card failed in the end and I replaced it
with a newer setup.  That system was a server that handled from 10 to 30+
people all the time. I could also run X at the console and not load up the
system while others were on it.

Once you get into X, the software is a bit rough around the edges - usually
caused by poor ports of software that was running on another Unix flavor.
You do end up respecting the system though... the problems you get are
usually easy to identify .. you might not be able to do anything about it ..
but you feel better about the whole thing 8).

The biggest drawback to Linux? It requires you to think and learn about the
operating system.  That also seems to be its biggest calling ... it allows
you to tune the innards as much as you want.  It isn't for the masses ...
yet.

The recent move by the big folks (IBM, Sun, Oracle, etc) to embrace Linux
should bring a bit more stability to the system. But it will also drag the
attendent corporate mind set about how you should do things.  Good with the
bad.

Dan


I get the Linux Bits( http://www.linuxdot.org <http://www.linuxdot.org> )
newsletter and it seems
Linux users have just as many problems as windows users
trying to make their systems stable and usable.

roger

Roger H. Anderson



Luis;

It is actually easier than one would think.  Simply install the 'Linux'
program and windows suddenly behaves very well.  No more blue screens, no
more crashed programs, no more sudden crawling operating system.  I suggest
it for a patch for all Windows systems.


Chris Eddy
Pioneer Microsystems, inc.


Luis Ot‡vio MŽdici wrote:


Hi, I am brazilian electrical engineer and I was beginning to program the
PIC. I was trying to developer a PIC inside«s Data Acquisicion Card . The
assembly code is ok, otherwise the sw in Delphi that receive, show and store
the data wasn«t working like its should. The system monitored is fast and
needs of Real Time treatment and make a Real Time Sw in Windows is very
difficult. Anybody has some tips about Windows Real Time Programming? Are
there specifical APIs ? Book or Web Sites ? Thank you, A good site about
microcontroller technology is http://www.microcontroller.com
<http://www.microcontroller.com>


'[OT] Re: Real time in Windows'
1999\11\01@115813 by Martin McCormick
flavicon
face
       I think one is going to have some trouble measuring real time
accurately for any period under a second in any sophisticated
operating system, be it any of the Windows flavors, DOS, or Linux.

       The tricky thing about exact timing on a modern computer is
that interrupts are constantly being serviced from many different
systems such that a finely-accurate timing routine may be put on hold
for a millisecond hear and another there every time the disk drive
needs servicing or the operating system must tend to another user.

       It would be like having a watch that stops cold at random
periods during the day without warning.  It will still have a dial or
display that gives some time value, but can we trust it?

       PIC's and other embedded systems are the best places to
deal with time-sensitive actions because one can write the software
with this in mind.  You can't hope to be able to do that nearly as
easily on a larger computer without running the risks of creating
unforeseen problems.

Martin McCormick

1999\11\01@130221 by hris Fanning
flavicon
face
>         I think one is going to have some trouble measuring real time
> accurately for any period under a second in any sophisticated
> operating system, be it any of the Windows flavors, DOS, or Linux.
>
>         The tricky thing about exact timing on a modern computer is
> that interrupts are constantly being serviced from many different
> systems such that a finely-accurate timing routine may be put on hold
> for a millisecond hear and another there every time the disk drive
> needs servicing or the operating system must tend to another user.

What do most of you consider real-time?  I have lab software that has
a typical latency of < 1ms under Windows [NT,95,98].  I only measure
milliseconds so it may be substantially less.  Occasionally there's
a 1.x to 2.x ms latency spike.

Is this real-time enough for most of you?  If so there's a few things
that you can do to make performance more predictable.  One is to make
sure you have no devices that will disable interrupts for a long time.
Careful selection of hardware with good drivers helps a lot.  It's
largely irrelevant now, but make sure you have a bus mastering hard
drive and no other programmed IO devices.  Disable networking support
under Win95 (maybe 98 too).  The last thing is that you absolutely
cannot poll.

I'm using National Instruments aquisition boards and callbacks.  Works
very well for me.

If 1ms latency isn't enough or occasional higher delays aren't
acceptable then a more dedicated solution is definitely in order.

How good is PIC AD?  I'm used to working with these National Inst.
boards with no missing codes with great accuracy and precision.  Is
the AD on PICs up to serious work?

Chris

1999\11\01@131659 by Anne Ogborn

flavicon
face
windows 95 & 98 in particular are notorious for
miserable interrupt latency performance.  I'm
on some sound mailing lists, and there's a constant
stream of complaints.

1999\11\01@131707 by Wagner Lipnharski

picon face
Some people think that a PC (ISA/PCI) board, crowded with components,
including RTC's and processors, would do the same as a ADC chip in a
small board connected to the PC parallel port... now you understand why
you need an independent real time measurement circuit with buffers and
all.  In this case, the PC act just as the equipment's front panel and
storage system.  Of course, to measure the time observing paint dry, any
PC with those zillions of Windows interrupts can do, but to observe a
high freq jitter noise around 2ns, you will need something more
expensive...
Wagner.

Chris Fanning wrote:
{Quote hidden}

1999\11\01@175933 by Des Bromilow

flavicon
face
My thesis was based on writing a virtual instruments package under win 3.x/95.
I could get the 55ms interupt operable, but anything faster than that is impossible under the normal PC architecture.
My thesis proved the reliability of sensing and control systems under windows, but the speed limit of 55ms was the absolute ceiling (but this is okay for control systems we used)

Does this help?
Des Bromilow
>>> Martin McCormick <spam_OUTmartinTakeThisOuTspamDC.CIS.OKSTATE.EDU> 11/2/99 2:57:18 am >>>
       I think one is going to have some trouble measuring real time
accurately for any period under a second in any sophisticated
operating system, be it any of the Windows flavors, DOS, or Linux.

       The tricky thing about exact timing on a modern computer is
that interrupts are constantly being serviced from many different
systems such that a finely-accurate timing routine may be put on hold
for a millisecond hear and another there every time the disk drive
needs servicing or the operating system must tend to another user.

       It would be like having a watch that stops cold at random
periods during the day without warning.  It will still have a dial or
display that gives some time value, but can we trust it?

       PIC's and other embedded systems are the best places to
deal with time-sensitive actions because one can write the software
with this in mind.  You can't hope to be able to do that nearly as
easily on a larger computer without running the risks of creating
unforeseen problems.

Martin McCormick

1999\11\02@170921 by Martin McCormick

flavicon
face
Des Bromilow writes:
>My thesis was based on writing a virtual instruments package under win =
>3.x/95.
>I could get the 55ms interupt operable, but anything faster than that is =
>impossible under the normal PC architecture.

       This pretty well goes along with what I have found in DOS.

       You can try an experiment to see just how busy things are.
Get a P.C. hardware manual and look at the section on the
timer/counter which makes tones for the speaker.  There are two
control bits, one to turn the path to the speaker on and off and
another to enable the square wave output.  In this case, that bit
should be off so that the speaker pops once when the path is turned on
and once when it is turned off.  If you write a timing loop to cycle
the speaker 500 times per second in a square wave, it should sound
just like the square wave one gets from the normal counter.  On a
P.C., it sounds like a sick buzzer which is about to die.  This is due
to all the little lapses in timing which elongate a cycle here and a
cycle there.  We aren't trying to measure time, but generating timing
and it is obvious that in an interrupt-driven world, it is hard to do
either accurately.  The buzz loop simply accentuates how rough it can
be.

       You can have interrupts and accurate timing, but the
interrupts, themselves, are where one needs to take measurements and
let the foreground activities happen asynchronously.

       I once wrote an experimental routine to pop the speaker every
time the timer ticked and it gave the P.C. a nice little fast ticking
sound like a 16-MM movie projector.  The 55-ms timer tick has one of
the highest priorities on a P.C. so you can literally count on it.

Martin McCormick WB5AGZ  Stillwater, OK
OSU Center for Computing and Information Services Data Communications Group

1999\11\02@175624 by hris Fanning

flavicon
face
> Des Bromilow writes:
> >My thesis was based on writing a virtual instruments package under win =
> >3.x/95.
> >I could get the 55ms interupt operable, but anything faster than that is =
> >impossible under the normal PC architecture.
>
>         This pretty well goes along with what I have found in DOS.

I really don't get this.  From what you guys are saying a serial port
set over 300bps will have problems with lost data...

In around 1990 I wrote a piece of BBS software.  It had a new terminal
protocol and part of it was "music", set a frequency and duration and
it lumped it onto the play queue.  The timing was in 1/200ths of a
second.  All I did was change the system clock to 200Hz and ran the
"music queue" out of the timer interrupt.  (This 200Hz timing is no
coincidence as it perfectly divided into the old timer frequency.)

This was running on 286s at the time.  Even then I could easily bump
the timer frequency up to a few thousand Hz without any serious
consequences.

If you want to do timing on the PC, it's laughable that you can't get
better than 55ms.  Generate an interrupt, from the ISR, read the timer.
You can get pretty good accuracy out of this.  Don't count timer ticks.
That's just silly.  Seriously high accuracy and resolution?  Maybe not,
for that get dedicated hardware.  The National Inst. boards I use in
the lab can quite accurately count intervals with 1/20MHz resolution.

In the earlier post I wrote about sub 1ms latency I was referring to the
amount of time that it takes my software to _get_ the data from the
aquisition boards and _respond_ with output.  This is under _Windows_
with real time updates of the display!  You can get a ridiculous amount
of work done on a PC.  A 133MHz Pentium (recently retired) showed
25% CPU usage.  The 450MHz P3's are almost wasted showing ~5% CPU usage.

No where near enough research was done on the aforementioned paper.

Chris
(Under Windows the <1ms latency could actually be quite a bit better,
but I'm only sampling AD data at 1,000Hz and I'm measuring latency in
AD clocks.)

P.S. Sorry if I seem "excited" but I can't believe what I'm reading.

1999\11\02@181049 by Andy Kunz

flavicon
face
>I really don't get this.  From what you guys are saying a serial port
>set over 300bps will have problems with lost data...

And here I'm doing four 115K ports at a time.  I have to find my errors -
it's working perfectly!  While it drives another port (custom parallel)
driving a 62.5K connection.

55mS is all they can get?  Whew, they must be using VB!

Andy

==================================================================
New Microprocessor support forum mail list - details on our site
------------------------------------------------------------------
.....andyKILLspamspam@spam@rc-hydros.com      http://www.rc-hydros.com     - Race Boats
andyspamKILLspammontanadesign.com  http://www.montanadesign.com - Electronics
==================================================================

1999\11\03@093939 by Martin McCormick

flavicon
face
       Okay, folks, I accidentally may have mislead some of us about
some of the timing issues on a P.C.  I will try to be brief, but clear
things up.

       The real-time clock updates every 55 milliseconds, all right.
When one boots DOS, the timer/counter that generates the interrupt
actually generates it at 55 milliseconds, also.  Then things can get
interesting.  The hardware interrupt ISR has a vector in low memory
along with many other such vectors that lets one put new ISR's in
which reroute the flow through your new ISR and then to what was
originally there.  This is typical ISR protocol anywhere.  One neat
thing that programmers can do is to set the deviser latch in the
timer/counter to some lower value so that the timer ISR rolls over
much more often such as 1,000 times per second.

       Now, if you want the rest of your computer to continue working
properly, that new ISR must call the ISR which is next in line every
55 milliseconds so the new ISR only does this every 55TH call.  The
rest of the time, it just does its thing and then exits with an iret.

       BASICA is reported to step up the timer hardware interrupt to
4 times the 18.2-HZ rate in order to make music routines run more
smoothly.

       All this is real nice, but it can only work if you control
everything that is run on that computer and the order in which it is
installed.

       There are recommended methods for installing custom routines
so that terrible things don't happen, but in the cowboy code world of
Windows, there are no guarantees and the 55-MS ticker is the only sure
timing constant without resorting to more cowboy or hotdog code and
its almost certain consequences.  All it takes for a grand mess is for
your timer modifier to somehow get installed in the wrong place in the
chain (such has happens if you run some other program with a timer
modifier), and your system is hosed.

Martin McCormick

1999\11\03@102526 by - KITS EDUCACIONAIS NACIONAIS

flavicon
face
Yo're correct... in DOS, all works fine...

Miguel Wisintainer


Martin McCormick wrote:
{Quote hidden}

1999\11\03@113204 by wzab

flavicon
picon face
On Wed, Nov 03, 1999 at 08:37:17AM -0600, Martin McCormick wrote:
{Quote hidden}

Hi all!

In the old good times of DOS I've written a small procedure which allowed
to set arbitrary chosen divisor and still calling another ISR's installed
PREVIOUSLY at the with "average" 55ms interval. It was very easy.
The 55ms results from setting the divisor to 0x10000. My ISR kept the 16-bit
counter, and if the divisor was set to "N" it incremented the counter by "N",
and if the counter get overflown, it called the rest of the ISR chain.

Everything worked fine in DOS. The same procedure was even used by Win3.1
programs, and in the standard mode (who remembers it...) worked perfectly
with interrupt rates up to ~1kHz (!). The things became more difficult in the
"enhanced" mode, wher the timer interrupts got "virtualized".
To make it work correctly in the Win3.1 in "enhanced" mode, one should write
the own VxD.

My knowledge ends at the Win3.1, but probably things look out similar
in the Win95/98/2000.
In the VTD device there was a special service for VxDs:
VTD_Begin_Min_Int_Period, which accepted the one parameter, minimum accuracy for
system timing (AFAIR in cycles of clock signal driving the system timer).
It could provide perfect control over the interrupt rate, but it was easy to
run into troubles. Let's assume that we set the interrupt period to 10ms, to
trigger the A/D converter and sample the signal with 100Hz rate. If another
process set the Min_Int_Period to 9ms, the interrupts will be generated every
9 ms, and our sampling timing will be completely disturbed.

That's why I say, if you need the really real time processing, you may stay
with DOS (see http://www.freedos.org for a free replacement) or you need
a real RTOS (see RT-Linux for a free option).

--
                       Wojciech Zabolotny
                       http://www.ise.pw.edu.pl/~wzab

http://www.freedos.org  Free DOS for free people!

1999\11\04@024312 by ruben

flavicon
face
About TMR0 in a PC...

I have made some routines I use for DOS programs that read the
fractions of the 55ms timer directly from the 8254 timer chip. The
timer is in mode 3 which then counts down with 2 for every clock
input (1.190 MHz). It counts down to 0 two times for every 55ms
interrupt. The first time the output of the counter is high and the
second time it is low. (This is to get a 50% duty cycle square wave
at the output.) The output bit can be read from the status byte in
the chip. The count sequence looks like this:

   s   msb  lsb    countvalue (fraction of 55ms timer)
  ========================================================
   1   0x00 0x00   0x0000  TMR0 interrupt here
   1   0xff 0xfe   0x0001
   1   0xff 0xfc   0x0002
           .....
   1   0x00 0x04   0x7ffe
   1   0x00 0x02   0x7fff
   0   0x00 0x00   0x8000
   0   0xff 0xfe   0x8001
       0   0xff 0xfc   0x8002
           .....
   0   0x00 0x04   0xfffe
   0   0x00 0x02   0xffff
   1   0x00 0x00   0x0000  TMR0 interrupt here

s is bit 7 in the statusbyte which also is the output.

With this I can make looped timedelays much shorter than the 55ms
timer (maybe not that accurate but never shorter than I expect) and I
can measure events on inputs (like characters received in the serial
port). This works on all machines I have tested but only if it runs
DOS (pure DOS not a DOS window) and never in W95.

The problem is that when I read the s bit from DOS in W95 it is always
0 so I can't tell if I am at 0x0000-0x7ffff or 0x8000-0xffff.
The timer is still in mode 3 because I can sample the counter together
with the value from biostime(0,0L); and see that it counts down with
even numbers twice between every TMR0 interrupt.

Can anybody explain this to me and perhaps tell me if there is a fix
for it?

Perhaps a bit [OT] but I have use for these routines for a lot of my
PIC projects.

{Quote hidden}

==============================
Ruben Jvnsson
AB Liros Elektronik
Box 9124, 200 39 Malmv, Sweden
TEL INT +4640142078
FAX INT +4640947388
.....rubenKILLspamspam.....2.sbbs.se
==============================

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...