From: Stefan Brröring on
>
> Without changing system timing, MSDOS won't give you 1ms resolution
> only 1/18.5 Hz. Not sure about all forms of Windows and system clock
> resolution.
>
>

Yes, if you use the standard timer of MSDOS. But you can use an com1:
read interrupt. To get 1ms resolution, all you need is a clock. I think,
you could use com2: tx interrupt to increment a counter which could be
used as a timer which is faster than 1/18,5 Hz.

Stefan
From: Paul Keinanen on
On Mon, 21 Jun 2010 13:41:10 +0100, Paul Carpenter
<paul(a)pcserviceselectronics.co.uk> wrote:

>In article <4c1f3dc4$0$3314$8e6e7893(a)newsreader.ewetel.de>,
>stefan___(a)broering.de says...

>> With MSDOS or Windows, you can use every baudrate that is a
>> factor/divider of 115200.
>
>Without changing system timing, MSDOS won't give you 1ms resolution
>only 1/18.5 Hz. Not sure about all forms of Windows and system clock
>resolution.

Why bother with the MSDOS clock ?

On most Pentium and later processors contained the 64 bit Time Stamp
Counter register, which was incremented every clock cycle. You may
have to find out what the actual CPU clock frequency was, but that
should not be too hard.

Check availability of this counter and the availability of the RDTSC
(ReaD Time Stamp Counter) instruction using the CPUID instruction.

From: Vladimir Vassilevsky on


Paul Keinanen wrote:


>>>With MSDOS or Windows, you can use every baudrate that is a
>>>factor/divider of 115200.
>>
>>Without changing system timing, MSDOS won't give you 1ms resolution
>>only 1/18.5 Hz. Not sure about all forms of Windows and system clock
>>resolution.
>
>
> Why bother with the MSDOS clock ?
>
> On most Pentium and later processors contained the 64 bit Time Stamp
> Counter register, which was incremented every clock cycle. You may
> have to find out what the actual CPU clock frequency was, but that
> should not be too hard.
>
> Check availability of this counter and the availability of the RDTSC
> (ReaD Time Stamp Counter) instruction using the CPUID instruction.

Any PC since beginning till our days has 8253 (or compatible), clocked
from 14.318MHz/12 ~ 1.193MHz. It can be used for the accurate time
measurement. Leave channel#0 at the division ration of 65536 as it is,
set channel#2 to 65535, don't touch channel#1 as it was used for memory
refresh in the old times. You can measure time intervals up to an hour
with the resolution of one tick of 1.193MHz. It works for any version of
DOS up to Windows XP. Vista and Win7 won't let you into the ports.



Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com



From: Grant Edwards on
On 2010-07-05, Paul Keinanen <keinanen(a)sci.fi> wrote:
> On Mon, 21 Jun 2010 13:41:10 +0100, Paul Carpenter
><paul(a)pcserviceselectronics.co.uk> wrote:
>
>>In article <4c1f3dc4$0$3314$8e6e7893(a)newsreader.ewetel.de>,
>>stefan___(a)broering.de says...
>
>>> With MSDOS or Windows, you can use every baudrate that is a
>>> factor/divider of 115200.
>>
>>Without changing system timing, MSDOS won't give you 1ms resolution
>>only 1/18.5 Hz. Not sure about all forms of Windows and system clock
>>resolution.
>
> Why bother with the MSDOS clock ?
>
> On most Pentium and later processors contained the 64 bit Time Stamp
> Counter register, which was incremented every clock cycle. You may
> have to find out what the actual CPU clock frequency was, but that
> should not be too hard.
>
> Check availability of this counter and the availability of the RDTSC
> (ReaD Time Stamp Counter) instruction using the CPUID instruction.

Be warned: if you have a dual/multi-core machine, MS Windows does _not_
keep the TSC values of the cores synchronized. You have to lock to a
single core the code that's reading the TSC if you want to get useful
data.

--
Grant

From: Stefan Brröring on
>> Why bother with the MSDOS clock ?
>>
>> On most Pentium and later processors contained the 64 bit Time Stamp
>> Counter register, which was incremented every clock cycle. You may
>> have to find out what the actual CPU clock frequency was, but that
>> should not be too hard.
>>
>> Check availability of this counter and the availability of the RDTSC
>> (ReaD Time Stamp Counter) instruction using the CPUID instruction.
>
> Any PC since beginning till our days has 8253 (or compatible), clocked
> from 14.318MHz/12 ~ 1.193MHz. It can be used for the accurate time
> measurement. Leave channel#0 at the division ration of 65536 as it is,
> set channel#2 to 65535, don't touch channel#1 as it was used for memory
> refresh in the old times. You can measure time intervals up to an hour
> with the resolution of one tick of 1.193MHz. It works for any version of
> DOS up to Windows XP. Vista and Win7 won't let you into the ports.
>

Sounds good. I am not so familiar with this type of programming on a pc.
Its also a long time since i read technical documents about this. The
trick with the com-tx int which was used as a timer, was about 25 years
ago mentioned in an article in a german computer magazine (MC or C�t).
There was also a description of the hardware components of a pc. I
think, it was in May 1985 or so.

I only used the articles to write programs for the com-port under
turbo-pascal at that times. Nowadays, i do microcontroller programming
and a bit Delphi.

Best regards

Stefan