Announcement

Collapse
No announcement yet.

MTIMER issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Kurt Schultz
    replied
    It's been a long time since I've done that kind of code, but...


    Don't you need to equate the value returned by the MTIMER fn
    into a variable, then run the routine, then equate the value
    returned by the MTIMER fn into a second variable, then subtract
    one variable from the other IOT get the elapsed microtime?

    Also (to state the obvious), variable type needs to be
    appropriate for the type of value returned by the MTIMER fn.

    I conceed that it may be different in rev. 3.5


    Kurt Schultz
    [email protected]

    Leave a comment:


  • Alex Ciurea
    replied
    Originally posted by Jerry Fielden:
    Does your MySub happen to play sound? My 3.0 book says PLAY and
    SOUND happen to use the same timer chip and would reset MTIMER
    to 0.

    If thats not it, try

    MTIMER
    CALL MYSUB
    Tim! = MTIMER
    PRINT USING "####";Tim!

    Similar example also in the book.

    It seems that the problem is caused by the SOUND.
    A man, as long as he lives, he learns !!!

    My PB is 3.5 and I use it under WIN98 and DOS 6.22.

    The accuracy of Mtimer is 2 microsecs, but after 54 milisecs
    "the accuracy drops off sharply". So after 54 milisecs probably
    the accuracy is 3-4-5 or more microsecs.

    Thanks alot guys for your help and time.

    Leave a comment:


  • Michael Mattias
    replied
    The microtimer offers excellent resolution, being accurate to ¦
    approximately 2 microseconds. However, the accuracy drops off sharply ¦
    after approximately 54 milliseconds. ..
    .. sayeth PB/DOS help file. I must have read the '54' and missed the '2' part.

    Makes my point better, even. Who cares if it's 10,000 microseconds?

    MCM


    Leave a comment:


  • Emil Menzel
    replied
    Michael:

    In my experience as well as according to the PB manual,
    MTIMER accuracy is 2 MICROSEC, NOT 54 MILLISEC. (TIMER is
    only accurate to 54 millisec, of course.)

    There are some circumstances that affect MTIMER's accuracy, as
    also noted in the manual. One thing not mentioned is running
    under Windows, rather than under pure DOS. For more info on
    the effects of Windows on timing, see earlier posts on this
    forum.



    ------------------

    Leave a comment:


  • Michael Mattias
    replied
    MTIMER is accurate only to 54 miliseconds (1/18th second)

    Therefore..

    1. If you need a timing, run the sub many times, and divide total time (TIMER) by number of iterations.

    2. If the sub only executes a couple of times in your program, you don't need an MTIMER timing. LIke, who cares if its 54 or 100 or even 1000 milliseconds? (You may want a TIMER timing).

    MCM

    Leave a comment:


  • Jerry Fielden
    replied
    Does your MySub happen to play sound? My 3.0 book says PLAY and
    SOUND happen to use the same timer chip and would reset MTIMER
    to 0.

    If thats not it, try

    MTIMER
    CALL MYSUB
    Tim! = MTIMER
    PRINT USING "####";Tim!

    Similar example also in the book.

    ------------------

    Leave a comment:


  • Mel Bishop
    replied
    What version of PB / OS are you using? I use MTIMER frequently
    and have never had any problems with it. Your example looks
    okay to me.


    ------------------

    Leave a comment:


  • Alex Ciurea
    started a topic MTIMER issue

    MTIMER issue

    Hello,
    I'm new to PB and I want to learn.

    first of all, I want to know where I could find
    a more detailed help for PB/DOS with example codes.

    The one provided with PB35 doesn't help me alot,
    because I can't find too much examples.


    then, I have this situation:

    ...my code here...

    mtimer
    call mysub
    print mtimer

    ...my code continues here...

    I want to know how much time it takes to run the sub.
    All I get is the value 0 (zero).

    What am I doing wrong?
    Thanks for your time and help.
    Alex Ciurea
Working...
X