Reply by July 6, 20102010-07-06
>> 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
Reply by Grant Edwards July 6, 20102010-07-06
On 2010-07-05, Paul Keinanen <keinanen@sci.fi> wrote:
> On Mon, 21 Jun 2010 13:41:10 +0100, Paul Carpenter ><paul@pcserviceselectronics.co.uk> wrote: > >>In article <4c1f3dc4$0$3314$8e6e7893@newsreader.ewetel.de>, >>stefan___@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
Reply by Vladimir Vassilevsky July 5, 20102010-07-05

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
Reply by Paul Keinanen July 5, 20102010-07-05
On Mon, 21 Jun 2010 13:41:10 +0100, Paul Carpenter
<paul@pcserviceselectronics.co.uk> wrote:

>In article <4c1f3dc4$0$3314$8e6e7893@newsreader.ewetel.de>, >stefan___@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.
Reply by July 5, 20102010-07-05
> > 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
Reply by Jon Kirwan June 26, 20102010-06-26
On Fri, 25 Jun 2010 22:15:39 -0700, Fred <fuque@hotmail.com>
wrote:

>Last time on comp.arch.embedded, Jon Kirwan <jonk@infinitefactors.org> >said: > >>On Thu, 24 Jun 2010 21:27:15 -0700, Fred <fuque@hotmail.com> >>wrote: >> >>>Last time on comp.arch.embedded, Jon Kirwan <jonk@infinitefactors.org> >>>said: >>> >>>>>If possible I'd like it to run at a non-standard baud rate (62,500 baud). >>>> >>>>I'm not sure an IBM PC uart can run at that rate. >>> >>>It could if you're willing to change the crystal on the UART card... >> >>Yeah. I think that has been mentioned in this thread >>about... 20 times already? > >I only saw one other mention; somehow I missed the other 19.
I believe I saw several different people mention the possibility and more still accepting the point and referring to it.
>>And have you actually done this on a modern PC? > >Not on a PC motherboard, but I have done it on an expansion card.
The comment of mine that you quoted was "I'm not sure an IBM PC uart can run at that rate." Note that I wasn't discussing expansion cards.
>>In any case, I haven't looked recently, but few PCs these >>days seem to sport RS-232 or RS-485 ports. > >Just the other day I bought a 2-port RS-232 PCI expansion card. Cost >me $17 at a local retail store, but you can get the same card online >for ~$12.
I wasn't discussing expansion cards.
>>It's been a long time since I looked, but unless I heard >>directly from someone who has achieved this with a new PC >>system, I'd be skeptical of a claim about it being easy to >>do. >> >>Maybe someone has and can fill us in about it. > >The card I just bought has a normal-looking, through-hole-mounted >crystal on it. Even a software guy like me could swap it out.
I wasn't discussing expansion cards. Jon
Reply by Fred June 26, 20102010-06-26
Last time on comp.arch.embedded, Jon Kirwan <jonk@infinitefactors.org>
said:

>On Thu, 24 Jun 2010 21:27:15 -0700, Fred <fuque@hotmail.com> >wrote: > >>Last time on comp.arch.embedded, Jon Kirwan <jonk@infinitefactors.org> >>said: >> >>>>If possible I'd like it to run at a non-standard baud rate (62,500 baud). >>> >>>I'm not sure an IBM PC uart can run at that rate. >> >>It could if you're willing to change the crystal on the UART card... > >Yeah. I think that has been mentioned in this thread >about... 20 times already?
I only saw one other mention; somehow I missed the other 19.
>And have you actually done this on a modern PC?
Not on a PC motherboard, but I have done it on an expansion card.
>In any case, I haven't looked recently, but few PCs these >days seem to sport RS-232 or RS-485 ports.
Just the other day I bought a 2-port RS-232 PCI expansion card. Cost me $17 at a local retail store, but you can get the same card online for ~$12.
>It's been a long time since I looked, but unless I heard >directly from someone who has achieved this with a new PC >system, I'd be skeptical of a claim about it being easy to >do. > >Maybe someone has and can fill us in about it.
The card I just bought has a normal-looking, through-hole-mounted crystal on it. Even a software guy like me could swap it out.
Reply by Jon Kirwan June 25, 20102010-06-25
On Thu, 24 Jun 2010 21:27:15 -0700, Fred <fuque@hotmail.com>
wrote:

>Last time on comp.arch.embedded, Jon Kirwan <jonk@infinitefactors.org> >said: > >>>If possible I'd like it to run at a non-standard baud rate (62,500 baud). >> >>I'm not sure an IBM PC uart can run at that rate. > >It could if you're willing to change the crystal on the UART card...
Yeah. I think that has been mentioned in this thread about... 20 times already? And have you actually done this on a modern PC? In any case, I haven't looked recently, but few PCs these days seem to sport RS-232 or RS-485 ports. For those that may, high integration on the board may not make it it so easy. I believe the ones old enough to actually have a south bridge probably use a super I/O chip or have it integrated into the south bridge along with the APIC and perhaps have some divider used to get the "pc standard" rates created. It all has to look like an ISA dohicky or old software won't work right. PCI boards also exist and they have drivers that are probably Windows-standard, too, but then that is a whole other thing to worry about and I'm not sure how the WinOldAp or NTVDM emulates the old chips into the DOS boxes. It's been a long time since I looked, but unless I heard directly from someone who has achieved this with a new PC system, I'd be skeptical of a claim about it being easy to do. Maybe someone has and can fill us in about it. Jon
Reply by Fred June 25, 20102010-06-25
Last time on comp.arch.embedded, Jon Kirwan <jonk@infinitefactors.org>
said:

>>If possible I'd like it to run at a non-standard baud rate (62,500 baud). > >I'm not sure an IBM PC uart can run at that rate.
It could if you're willing to change the crystal on the UART card...
Reply by Jon Kirwan June 24, 20102010-06-24
On Thu, 24 Jun 2010 15:35:04 +0200, David Brown
<david@westcontrol.removethisbit.com> wrote:

>On 24/06/2010 13:11, Jon Kirwan wrote: >> On Thu, 24 Jun 2010 11:07:50 +0200, David Brown >> <david@westcontrol.removethisbit.com> wrote: >> >>> <snip> >>> Finding a source for the documentation, and buying it (assuming these >>> manuals were priced similarly to a lot of other comparable technical >>> information) would take a lot of effort and money. >> >> It wasn't hard. I'm not certain anymore, but I believe I >> first heard about the information either in a magazine or >> through the materials received when purchasing. I do >> remember getting a price and part number to order from IBM, >> by phone, and then simply writing a check and mailing it off. >> It wasn't a lot of money, either. Especially considering >> that the IBM PC/AT, 6MHz and 20Mb hard drive, was priced at >> $5495, memory serving. If you could find a way to peal that >> much out of your wallet, the manuals weren't even on the >> radar scope. > >I guess it is this more than anything else that puts ISA out of the >range of hobbyists to my mind - you don't mess around with putting >home-made cards into a $5500 computer unless you are happy to risk >damaging it, or you are /very/ confident of your abilities. Either way, >you are not a hobbyist.
Oh, cripes. I have nearly destroyed a _new_ $2,000 piece of equipment back around that time merely because I hadn't realized that the ground plug on one properly designed piece of test equipment I was using might cause a hot-side short to the IBM Model 85 electronic typewriter which didn't have such a plug and was plugged in reverse-wise. Nicely destroyed a power supply board, which I had to repair. There is no question I was barely a hobbyist, if that, at the time. And yes, I was willing to take risks with my money because I wanted to learn, too. I did what I knew to do to avoid throwing money in the dumpster or killing myself, but I'm quite certain I didn't do as much as those smarter than me did. I made plenty of mistakes as I went. And I have had zero formal training here, by the way. Even to this day. I don't know why you want to imagine I'm something I know I'm not. But there it is.
>Hobbyists who wanted to connect a card to a PC gave them an RS-232 >interface or a parallel port connection - just like these days they give >them a USB connection or an Ethernet port (or possibly a RS-232 connection).
I used those, too. For example, in the above typewriter case I was scoping out the reed relay signals so that I could figure out how to turn it into a printer. I then designed and programmed by own 8031 board, with EPROM, and rat-nest wired the thing across the reed relays and brought out a ribbon cable to the tiny proto box I had. There, I used 1488 and 1489 level shifters with the 80C31 and a serial port to the PC for use as a printer. Worked first time (after fixing that power supply board in the electronic typewriter that I'd wrecked.) But this was almost around the same time when I also did my first proto board that plugged directly into that $5500 PC/AT. And I was barely any smarter at that point and nearly as likely to destroy something there, too. You learn by screwing up and then reinforce the stuff you did learn well, by succeeding. And I'm still a hobbyist. Jon