Time limit while waiting for input ?


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Mar 2004
    Posts
    92


    Did you find this post helpful? Yes | No

    Default Re: Time limit while waiting for input ?

    Richard, you're awesome ! thanks very much !

    This morning is the first chance I've had to try it without constant interruption. I must have done something a little different because it wouldn't work until I added...
    moveup:
    high blue ; led on
    high up ; motor on
    RUN_COUNT=200 ; set time limit 200*500mS ie 100 sec
    while (limup = 1 ) && ( RUN_COUNT>0) ; do this till time runs out or limit sw trippe
    pause 500
    toggle blue ; flash led
    RUN_COUNT = RUN_COUNT -1
    wend ; all done
    IF limup = 0 OR RUN_COUNT =>0 THEN
    low blue
    low up
    ENDIF
    Not sure why it doesn't work right without the ">0" but in any case, it's working great. Thanks again !!

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,644


    Did you find this post helpful? Yes | No

    Default Re: Time limit while waiting for input ?

    I have some doubts about your modification, perhaps you have some noise entering the system, or the limit switch is "bouncing"

    IF limup = 0 OR RUN_COUNT =>0 THEN
    low blue
    low up
    ENDIF

    firstly operator precedence make this If test dodgy, parentheses ensure correct result
    IF (limup = 0 ) OR (RUN_COUNT =>0) THEN
    secondly
    RUN_COUNT =>0
    since pbp vars are unsigned , this will always be true it can only be 0 or greater
    since the run_count test always tests true the if statement is always true

    thirdly
    the while loop will only exit if limup is 0 or run_count is 0 , the statement is or should be redundant
    Last edited by richard; - 10th July 2017 at 01:01.
    Warning I'm not a teacher

Similar Threads

  1. Upgrade time limit?
    By fowardbias in forum Off Topic
    Replies: 1
    Last Post: - 5th August 2012, 16:34
  2. Limit of PokeCode??
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th June 2012, 20:18
  3. Replies: 0
    Last Post: - 1st December 2010, 22:48
  4. Replies: 11
    Last Post: - 14th May 2010, 10:11
  5. Replies: 4
    Last Post: - 5th October 2007, 10:25

Members who have read this thread : 0

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