"WAIT" modifier with multiple choices - how to?


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891

    Default "WAIT" modifier with multiple choices - how to?

    Hi There,

    I'm wondering if it is possible to "WAIT" for more than only one condition at the time in DEBUGIN/SERIN2.

    I usually write something like this:
    Code:
    START:
    DEBUGIN 1000,START,[WAIT("first")]
    ....
    I'd like to wait for more than the word "first" but also for "second" and "third".

    But how?
    Roger

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default Re: "WAIT" modifier with multiple choices - how to?

    Yes you can. But maybe you can give an example of what you want?

    Ioannis

  3. #3
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default "WAIT" modifier with multiple choices - how to?

    My circuit has a serial data receiver; it "waits" for three different sets of characters (= commands) to perform different actions, one at the time.

    If "READ" is received, it will do this; if "WRITE" is received, it will do that and so for the third command, "COPY".

    Voilą how I imagine it should be working (this is obviously not the actual code, just the idea of what it should be doing):
    Code:
    START:
    DEBUGIN 1000,START,[WAIT("READ" OR "WRITE" OR "COPY")]
    IF "READ" DO...
    IF "WRITE" DO...
    IF "COPY" DO...
    ....
    I need to "wait" for either incoming command but there's where I'm stuck in the DEBUGIN/SERIN2 timeout loop.

    Due to my lack of knowledge, I have to make my circuit currently doing only one thing...frustrating
    Roger

  4. #4
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: "WAIT" modifier with multiple choices - how to?

    My approach would be to just receive whatever comes in, then parse it later.

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,389


    Did you find this post helpful? Yes | No

    Default Re: "WAIT" modifier with multiple choices - how to?

    My approach would be to just receive whatever comes in, then parse it later.
    + 1

    though life would be easier if
    "READ" became "*READ/n" ditto for the others {/n=chr 13


    Code:
    buff var byte[5]
    DEBUGIN 1000,START,[WAIT("*" str buff\5\13]
    then see what you got
    Warning I'm not a teacher

  6. #6
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    891


    Did you find this post helpful? Yes | No

    Default "WAIT" modifier with multiple choices - how to?

    Great! I'll give it a try.

    Thanks a lot
    Roger

Similar Threads

  1. How to do the "SerIN" and "SerOut " for the usb ?
    By vicce67 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 13th March 2015, 02:01
  2. Replies: 0
    Last Post: - 14th November 2013, 03:32
  3. Replies: 3
    Last Post: - 15th October 2012, 08:06
  4. Multiple "AND"'s in select case?
    By polymer52 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 1st January 2010, 19:10
  5. Replies: 1
    Last Post: - 16th February 2005, 20:05

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