Can't WAIT


Closed Thread
Results 1 to 6 of 6

Thread: Can't WAIT

  1. #1
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    219

    Default Can't WAIT

    Hi Guys,
    I’m using PBP 2.60 & MPLAB doing some RS485 between two PIC’s. The WAIT function of HSERIN will not work. If I follow HSERIN with str it immediately high lite STR and compiles fine. When I type wait, it does not high lite and if I compile I get an ERROR… EXPECTED “]”.There is no problem with the bracket. Without the wait function it compiles fine. If I type waitstr, nothing high lites and I get the same error. The BOOK says HSERIN should support this WAIT function. What have I missed?

    Wayne

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


    Did you find this post helpful? Yes | No

    Default Re: Can't WAIT

    Highlighting is done by MPLAB for a version of basic other than pbp.
    Just because it doesn't highlight doesn't mean anything.

    Since both WAIT and WAITSTR work fine in HSEROUT, you will need to post your code that does not compile.
    DT

  3. #3
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Re: Can't WAIT

    Hi Darrel,
    The program compiles fine with this statement:
    HSERIN [STR Ser_data\8\”$”]

    but does not compile with:
    HSERIN [waitstr Ser_data\8\”$”]

    I’ve almost decided I have some damaged code in PBP and may need to reload.
    This function is on the master. I need for the slave to respond after it has received and carried out a command from the master. The master is stopping on this HSERIN command and I think it is timing out because the slave is sending the “all done” after command is carried out but the master doesn’t seem to see it.
    I am using your Interrupts on the slave but I’m not sure how to implement this on the master as it must move to the next program line after HSERIN. If I wait for the slave’s response in a wait loop on the master, then catch the interrupt on the master, the master would go back to the wait loop on INT_RETURN. Is there any way to pop the stack, set INT bits, and do a GOTO out of the INTERRUPT? I’m at a loss here.
    Thanks,
    Wayne

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


    Did you find this post helpful? Yes | No

    Default Re: Can't WAIT

    Without the \"$", it will compile.
    You only specify the length to match. There is no optional terminating character.

    But, I think maybe there's some confusion about what WAITSTR does ...
    It waits until it receives a string of text that matches the contents of the specified array.

    If you want it to wait for "all done", you first have to load the array with the text.

    ARRAYWRITE Ser_data,["all done"]
    HSERIN [waitstr Ser_data\8]


    If you want the "$" in there too, you just add it to the string ...

    ARRAYWRITE Ser_data,["all done$"]
    HSERIN [waitstr Ser_data\9]


    If it never receives "all done$", it will never exit the command unless you add a timeout.
    DT

  5. #5
    Join Date
    Jan 2009
    Location
    Alabama,USA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Re: Can't WAIT

    Yep! It compiled. You are right (as always) I didn't understand exactly how the WAITSTR functions. I get it now. I'll test this out tomorrow. Thanks Darrel,

    Wayne

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


    Did you find this post helpful? Yes | No

    Default Re: Can't WAIT

    And I'll add that WAITSTR allows you to change the string to match at Run-Time.

    If you will always be waiting for "all done", use WAIT("all done") instead.
    DT

Similar Threads

  1. HSERIN with a WAIT
    By mel4853 in forum Serial
    Replies: 2
    Last Post: - 28th January 2013, 22:54
  2. wait for a string
    By sahin5002 in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 2nd April 2009, 23:27
  3. HSERIN WAIT parameter
    By tishri in forum mel PIC BASIC
    Replies: 2
    Last Post: - 9th December 2008, 10:23
  4. Serin2 multi wait?
    By cburtis in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th November 2007, 19:08
  5. Pic16f84 and wait byte
    By irmus in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 4th November 2004, 23:49

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