# Board index » delphi » Gettime function

## Gettime function

Steve:

Any induction motor runs on AC.  In Australia it is a period
of 20 mSec (50 Hz).  Any time value less than that is meaningless
to the motor.  I suppose you are controlling the motor with
triacs.  An electronic circuit to apply the gate signals can
have its delay set by an external signal.  That signal is the one
that is supplied by your control system.  The fastest reasonable
update time for the speed loop is perhaps 250 mSec.

If the machinery you are trying to operate requires mechanical
action that varies faster than that, an induction motor isn't
likely going to work.  Try a stepper.

Walter.

##### Quote
Steve Franken wrote:

> Hi,
> I'm an Elec Eng student writing some code in Turbo Pascal to control
> an induction motor for my final yr project. The problem I have is that
> the update time of the algorithm is limited by the fact that the
> smallest time unit returned by the GETTIME function in Turbo Pascal is
> 10mS(0.01 sec). I was looking at updating the output to the motor
> faster than that. Anyone have or know of a function that gives a finer
> time resolution? I know that PC's clock only gives 0.01s smallest unit
> but is there another way around it. Any help I'd greatly appreciate.
> Thanx people.
> **********************************************************************************
>  Stephen W Franken
>  4th year Bachelor of Electrical and Computer Engineering
>  Queensland University of Technology, Gardens Point, Brisbane, QLD.
>  Email: s.fran...@student.qut.edu.au
> **********************************************************************************

## Re:Gettime function

Hi,
I'm an Elec Eng student writing some code in Turbo Pascal to control
an induction motor for my final yr project. The problem I have is that
the update time of the algorithm is limited by the fact that the
smallest time unit returned by the GETTIME function in Turbo Pascal is
10mS(0.01 sec). I was looking at updating the output to the motor
faster than that. Anyone have or know of a function that gives a finer
time resolution? I know that PC's clock only gives 0.01s smallest unit
but is there another way around it. Any help I'd greatly appreciate.
Thanx people.
**********************************************************************************
Stephen W Franken
4th year Bachelor of Electrical and Computer Engineering
Queensland University of Technology, Gardens Point, Brisbane, QLD.
Email: s.fran...@student.qut.edu.au
**********************************************************************************

## Re:Gettime function

In article <3519c592.8040...@news.qut.edu.au>,

##### Quote
Steve Franken <s.fran...@student.qut.edu.au> wrote:

:smallest time unit returned by the GETTIME function in Turbo Pascal is
:10mS(0.01 sec). I was looking at updating the output to the motor
:faster than that. Anyone have or know of a function that gives a finer
:time resolution? I know that PC's clock only gives 0.01s smallest unit

I guarantees, but take a look at

10) How is millisecond timing done?

tsfaqp.zip Common Turbo Pascal Questions and Timo's answers

All the best, Timo

....................................................................
Prof. Timo Salmi   Co-moderator of news:comp.archives.msdos.announce
Moderating at ftp:// & http://garbo.uwasa.fi/ archives 193.166.120.5
Department of Accounting and Business Finance  ; University of Vaasa
mailto:t...@uwasa.fi <http://www.uwasa.fi/~ts/>  ; FIN-65101,  Finland

Spam foiling in effect.  My email filter autoresponder will return a
required email password to users not yet in the privileges database.

## Re:Gettime function

##### Quote
s.fran...@student.qut.edu.au (Steve Franken) wrote:

You could "hook" interrupt 8 and do some fancy-footwork to change the
timer 0 counter to get interrupts at intervals less than the normal
54.9mS.

Or, you might be able to user timer 2 and get a resolution of 838nS

##### Quote
>Hi,
>I'm an Elec Eng student writing some code in Turbo Pascal to control
>an induction motor for my final yr project. The problem I have is that
>the update time of the algorithm is limited by the fact that the
>smallest time unit returned by the GETTIME function in Turbo Pascal is
>10mS(0.01 sec). I was looking at updating the output to the motor
>faster than that. Anyone have or know of a function that gives a finer
>time resolution? I know that PC's clock only gives 0.01s smallest unit
>but is there another way around it. Any help I'd greatly appreciate.
>Thanx people.
>**********************************************************************************
> Stephen W Franken
> 4th year Bachelor of Electrical and Computer Engineering
> Queensland University of Technology, Gardens Point, Brisbane, QLD.
> Email: s.fran...@student.qut.edu.au
>**********************************************************************************

Andy Wood
agw...@ibm.net

## Re:Gettime function

JRS:  In article <3519c592.8040...@news.qut.edu.au> of Thu, 26 Mar
1998 03:11:36 in comp.lang.pascal.borland, Steve Franken

##### Quote
<s.fran...@student.qut.edu.au> wrote:
>Hi,
>I'm an Elec Eng student writing some code in Turbo Pascal to control
>an induction motor for my final yr project. The problem I have is that
>the update time of the algorithm is limited by the fact that the
>smallest time unit returned by the GETTIME function in Turbo Pascal is
>10mS(0.01 sec). I was looking at updating the output to the motor
>faster than that. Anyone have or know of a function that gives a finer
>time resolution? I know that PC's clock only gives 0.01s smallest unit
>but is there another way around it. Any help I'd greatly appreciate.

As an engineer, you should by now know that 10mS is ten
millisiemens, tht conductance of a one hundred ohm resistor.

As a programmer, be aware that, although GetTime reports
centiseconds, it does not have centisecond resolution; it uses the
value of the longint at Seg0040:\$006C, which is incremented at
18.2Hz - 55ms.  You'd do better to read that more directly.  See
Timo's FAQ; but my http://www.merlyn.demon.co.uk/pas-time.htm may
also help, and get pctim003 as well (link on my WWW site).

--
John Stockton, Surrey, UK.    j...@merlyn.demon.co.uk    Turnpike v1.12    MIME.
Web <URL: http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
Correct 4-line sig separator is as above, a line comprising "-- " (SoRFC1036)
Do not Mail News to me.    Before a reply, quote with ">" or "> " (SoRFC1036)

## Re:Gettime function

##### Quote
Steve Franken wrote in message <3519c592.8040...@news.qut.edu.au>...
>Hi,
>I'm an Elec Eng student writing some code in Turbo Pascal to control
>an induction motor for my final yr project. The problem I have is that
>the update time of the algorithm is limited by the fact that the
>smallest time unit returned by the GETTIME function in Turbo Pascal is
>10mS(0.01 sec). I was looking at updating the output to the motor
>faster than that. Anyone have or know of a function that gives a finer
>time resolution? I know that PC's clock only gives 0.01s smallest unit
>but is there another way around it. Any help I'd greatly appreciate.
>Thanx people.

What kind of resolution are you looking for and what do you mean by
"updating the motor" ? Do you mean you want it run for like 3.125 seconds ?
If so are you turning the motor on, then just sitting in a loop waiting to
turn
if off ? I can definitly help if you will respond.

Bean, th...@igateway.com

## Re:Gettime function

##### Quote
Steve Franken wrote:

> Hi,
> I'm an Elec Eng student writing some code in Turbo Pascal to control
> an induction motor for my final yr project. The problem I have is that
> the update time of the algorithm is limited by the fact that the
> smallest time unit returned by the GETTIME function in Turbo Pascal is
> 10mS(0.01 sec). I was looking at updating the output to the motor
> faster than that. Anyone have or know of a function that gives a finer
> time resolution? I know that PC's clock only gives 0.01s smallest unit
> but is there another way around it. Any help I'd greatly appreciate.
> Thanx people.
> **********************************************************************************
>  Stephen W Franken

What you need is not a primitive PC, which is dedicated for office and
game applications, you need a standalone controller, eg. an Intel 80197
or similar with high degree of realtime functions. It has a builtin UART
for simple communications with the PC for set-values etc. And it has
high resolution timing functions with catch registers and automatic
pulse generation in the microsecond range. And it has a 10-bit A/D
converter (8 channel) for potentiometers and other inputs.

X-assembler and "C" compiler are available.

Anything else is nonsens, much work with little result.

Regards,
Franz Glaser, Austria (w/o cangaroo's)
http://members.eunet.at/meg-glaser

## Re:Gettime function

Well, if you want to get really cute with it, you can use limit switches to
shut
down your motors.  You can hijack an IRQ line, and hook the limit switch up
to a port (say 8 bits will give you 64 different limit switches).  All you
need is a
buffer between the wires and the motherboard.

Sounds like you need to try using Turbo C.  Get out of windows while you are
at it.

-Scott

##### Quote
Steve Franken wrote in message <3519c592.8040...@news.qut.edu.au>...
>Hi,
>I'm an Elec Eng student writing some code in Turbo Pascal to control
>an induction motor for my final yr project. The problem I have is that
>the update time of the algorithm is limited by the fact that the
>smallest time unit returned by the GETTIME function in Turbo Pascal is
>10mS(0.01 sec). I was looking at updating the output to the motor
>faster than that. Anyone have or know of a function that gives a finer
>time resolution? I know that PC's clock only gives 0.01s smallest unit
>but is there another way around it. Any help I'd greatly appreciate.
>Thanx people.
>***************************************************************************
*******
> Stephen W Franken
> 4th year Bachelor of Electrical and Computer Engineering
> Queensland University of Technology, Gardens Point, Brisbane, QLD.
> Email: s.fran...@student.qut.edu.au
>***************************************************************************

*******

## Re:Gettime function

sd> Well, if you want to get really cute with it, you can use limit switch
sd> shut down your motors. You can hijack an IRQ line, and hook the limit
sd> swit to a port (say 8 bits will give you 64 different limit
sd> switches).  All need is a buffer between the wires and the
sd> motherboard.

sd> Sounds like you need to try using Turbo C.  Get out of windows while y
sd> at it.

would it be possible to use clock ticks?  (i'm not sure how many times a
second they are updated at, or for their faster than .01s)

the maverick - m...@microserve.net - http://xf.home.ml.org

... If I had been present at creation, I would have given some useful hints.

~~~ Telegard v3.09.b16/mL

## Re:Gettime function

##### Quote
Steve Franken wrote:

> Hi,
> I'm an Elec Eng student writing some code in Turbo Pascal to control
> an induction motor for my final yr project. The problem I have is that
> the update time of the algorithm is limited by the fact that the
> smallest time unit returned by the GETTIME function in Turbo Pascal is
> 10mS(0.01 sec). I was looking at updating the output to the motor
> faster than that. Anyone have or know of a function that gives a finer
> time resolution? I know that PC's clock only gives 0.01s smallest unit
> but is there another way around it. Any help I'd greatly appreciate.
> Thanx people.
> **********************************************************************************
>  Stephen W Franken

You can reprogram the timer chip for higher interrupt rates (On my old
286
up to 2 KHz). I wrote a TP-unit for this purpose a few years ago. Just
mail
me, if you're interested.

Iwo Mergler
Merg...@tu-harburg.d400.de