Simplify This:


Closed Thread
Results 1 to 3 of 3

Thread: Simplify This:

  1. #1
    Join Date
    Aug 2003
    Posts
    985

    Default Simplify This:

    Hi Guys,
    I wanted to make this less time consuming:
    Code:
    lonwork = limit_left
    latwork = limit_top
    
    WHILE lonwork < displon
    lonwork = lonwork + zoom
    xxx++;
    WEND
    
    WHILE latwork > displat
    latwork = latwork - zoom
    yyy++
    WEND
    It's all about incrementing xxx & yyy the correct number of times.
    The first while loop can be replaced with this:
    Code:
    temp var word
    temp = displon - limit_left
    xxx = temp / zoom
    I can't work out the second while loop.
    Any help appreciated.
    Cheers, Art.

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Talking Just read the Holy Bible ...

    Hi, Art

    Did you notice PBP , as well as C, offers the WHILE/WEND commands ...

    supposing your release is not too old ... ( 2.60 for the Day )


    Reducing time for adjusting could show some ... dichotomy algorithm ...

    Just for the end ... shouldn't the ZOOM value be different for the two loops ??? ( Zoomlon and zoomlat ... i.e )

    Alain
    Last edited by Acetronics2; - 29th December 2009 at 13:55.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default

    I have since solved this.

    Did you notice PBP , as well as C, offers the WHILE/WEND commands ...
    In C, I use:

    Code:
    while (lonwork < displon) {lonwork+= zoom; xxx++;}

Similar Threads

  1. Recommendations - Model Train Controller
    By malc-c in forum mel PIC BASIC Pro
    Replies: 101
    Last Post: - 8th March 2007, 08:17
  2. Strangw results when using PWM command
    By malc-c in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 10th July 2006, 12:14
  3. Someone help me to simplify this
    By thrix in forum General
    Replies: 4
    Last Post: - 21st February 2004, 05:01

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts