Dr John Stockton wrote in message <6UhyJ+UrFYx4E...@merlyn.demon.co.uk>...
>JRS: In article <8a38e8$i0...@supernews.com> of Tue, 7 Mar 2000
>15:46:34 in news:comp.lang.pascal.misc, Richard Webb
><rdw...@nildram.co.uk> wrote:
>>I hope someone can help me!
>>I have designed an ISA card for a PC and I am trying to program it in TP7.
>>(You may remember a post I made a while ago). I've tested the card, and
>>manufactured a final version with a few improvements. I am now writing the
>>final software for it.
>>The problem I have is with using real numbers. I need to put a count into
a
>>register on the card (a byte). I need to get a frequency from the user in
>>kHz. Then divide this number by 8000000 (The 8MHz reference clock on the
>>card) to get the count to put into the register. So the code is something
>>like this:
>>count:=(8000000/frequency);
>>port [$01B0]:=count;
>>of course this will not work, becuase count has to be a real number to be
>>output to a port. The rest of the code I've written makes sure that
>>frequency will divide my 8MHz to generate an integer which will work with
>>the register.
>In this newsgroup, you need to specify the version of Pascal you are
>using. That fragment looks like Turbo/Borland, for which the right
>group is c.l.p.borland.
>You have the choice of Round and Trunc - see the manuals, or the on-line
>help. You should validate the user's request for range, since otherwise
>if the input frequency is too small bad things will happen.
>You should not, of course, be using the standard TP/BP real type
>nowadays, except under special circumstances (which you may have) - see
>my pas-real.htm.
>--
>? John Stockton, Surrey, UK. j...@merlyn.demon.co.uk Turnpike v4.00
MIME. ?
> <URL: http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics &
links;
> <URL: ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip> Timo Salmi's Turbo Pascal
FAQ;
> <URL: http://www.merlyn.demon.co.uk/clpb-faq.txt> Pedt Scragg: c.l.p.b.