Debugin conditional routine


Closed Thread
Results 1 to 4 of 4
  1. #1

    Default Debugin conditional routine

    Hello,

    I have a serial data stream that has 1 of 2 possible preambles.
    %10001000
    %01001000

    I am currently using this command:
    debugin [wait(%01001000), mydata2, mydata3 ]

    The problem is I am stuck in this loop if my preamble is different? I want to be able to fall through for 2 different preambles. Is there a trick command for this? I want to always monitor for serial data.

    Thanks!
    Nick

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: Debugin conditional routine

    You can only have 1 WAIT() at a time.
    But you can do it manually ... nothing "Tricky".

    If the variables for each preamble are the same you could ...
    Code:
    Wait4Preamble:
        debugin [preamble]
        IF (preamble != %10001000) AND (preamble != %01001000 ) THEN Wait4Preamble
        debugin [mydata2, mydata3]
    Or, if the variables are different ...
    Code:
    Wait4Preamble:
        debugin [preamble]
        IF preamble = %10001000 THEN
            debugin [mydata0, mydata1] 
        ELSE
            IF preamble = %01001000 THEN
                debugin [mydata2, mydata3] 
            ELSE
                GOTO Wait4Preamble
            ENDIF
        ENDIF
    DT

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Debugin conditional routine

    Hello DT,

    Thanks for the info. I did think of doing that, for whatever reason I must have over throught it. I was concerned about missing the next byte. It just ocurred to me that the wait state is not all that much different than a manual loop.

    Thanks!
    Nick

  4. #4
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Debugin conditional routine

    That wait state likely is different actually, and happening at a low level.
    It should be fast enough to catch the next byte,
    You would find if you had to check for many possible different values, you'd run out of time.
    How long you have depends on "character pacing", and nothing to do with baud rate.
    Last edited by Art; - 14th May 2013 at 20:02.

Similar Threads

  1. Conditional compilation
    By ro37bis in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th July 2011, 23:02
  2. help with PIC16F628 conditional program
    By joseph in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 5th July 2010, 13:54
  3. Conditional Defines?
    By Kamikaze47 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 21st June 2010, 22:08
  4. Which conditional expression is faster?
    By RussMartin in forum General
    Replies: 4
    Last Post: - 15th February 2009, 19:21
  5. Conditional Compilation
    By milestag in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd March 2006, 20:29

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