Hserin


Closed Thread
Results 1 to 8 of 8

Thread: Hserin

  1. #1
    Join Date
    Mar 2016
    Posts
    10

    Default Hserin

    Hi.
    I am having a problem trying to receive certain data over one byte using the WAIT ( ) modifier in PBP.
    Here is my problem shown below. These are the characters that I receive from a certain chip when I send a reset to it.


    Sent data:

    HSerout ["AT+RST",13,10]


    Received data (HSERIN):


    2nd boot version : 1.5
    SPI Speed : 40MHz
    SPI Mode : DIO
    SPI Flash Size & Map: 8Mbit(512KB+512KB)
    Ai-Thinker Technology Co. Ltd.
    ready



    The problem is that I only want to display "ready" on my 2X16 display.


    hserin [WAIT("ready"),RX0,RX1,RX2,RX3,RX4]

    hserin [WAIT($79),RX0,RX1,RX2,RX3,RX4]

    hserin [WAIT("r","e","a","d","y"),RX0,RX1,RX2,RX3,RX4]

    hserin [WAIT($72,$65,$61,$64,$79),RX0,RX1,RX2,RX3,RX4]



    I tried all these above variations and none work for me. If I use the "." at the end of "Ltd."
    in the above example it would work because I would get everything after the "." which is "ready"
    Problem is that there are "." before the "Ltd." like at the "1.5" so I get everything after that.

    How does one go about doing this. Do I use "WAITSTR". If yes, I have tried and dont quite understand how to use it.
    Hope this makes sense.

    Help is greatly appreciated.
    Thanks

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


    Did you find this post helpful? Yes | No

    Default Re: Hserin

    hserin [WAIT("Ltd."),skip 2 ,RX0,RX1,RX2,RX3,RX4]
    the skip 2 is for the expected CR,LF {CHR13,CHR10}

    Then rx0--4 should be "ready"
    Warning I'm not a teacher

  3. #3
    Join Date
    Mar 2016
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Hserin

    Thanks Richard!
    This looks good! I'll give it a try.
    Don't know why I did not think of this? Over thinking maybe?
    Thanks again.

  4. #4
    Join Date
    Mar 2016
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Hserin

    Hi Richard.
    I don't quite get somehing with HSERIN. Your first example worked great I got "ready" on my 2X16 display. But after that I cant get
    any other replys to work They just sit there waiting.

    EG.

    I am sending out "AT+CWMODE=1" and my reply is:

    AT+CWMODE=1

    OK

    I would like to start the next command after receiving "OK" so I know the first setting was excepted before I go on to the next.
    But for some reason the PIC never "sees" "OK".


    Test program:


    LCDOut $FE,1,"Setting STA mode"
    LCDOut $FE,$C0,"Please wait....."

    pause 2000

    HSerout ["AT+CWMODE=1",13,10]
    hserin [WAIT("OK") ,RX0,RX1,RX2,RX3,RX4,RX5]

    pause 2000

    LCDOut $FE,1,"Set connection "
    LCDOut $FE,$C0,"Please wait....."

    pause 2000

    HSerout ["AT+CIPMUX=1",13,10]


    I never get to "Set connection ". Just hangs on WAIT("OK").

    I have tried to go back to start of program in case the reply was missed with this

    hserin 100,start, [WAIT("OK") ,RX0,RX1,RX2,RX3,RX4,RX5]

    but it will go around and around for ever.

    I hate to bother you again but I have spent most of the weekend and I just cant get it.
    Any help would be appreciated .

    Thanks

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


    Did you find this post helpful? Yes | No

    Default Re: Hserin

    HSerout ["AT+CWMODE=1",13,10]
    hserin [WAIT("OK") ,RX0,RX1,RX2,RX3,RX4,RX5]
    the device responds

    OK(chr13,chr10) or OK(chr10)

    so
    RX0=13,RX1=10 and then hserin will wait forever trying to fill rx2-5 because no more serial data is forthcoming


    either use a timeout or

    hserin [WAIT("OK") ]
    Warning I'm not a teacher

  6. #6
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: Hserin

    With hserin you can receive one byte at a time into a buffer until you see the return character,
    and then look at the rest of the command you received.

  7. #7
    Join Date
    Mar 2016
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Hserin

    Okay. Will try tomorrow.
    Thanks again for your help.

  8. #8
    Join Date
    Mar 2016
    Posts
    10


    Did you find this post helpful? Yes | No

    Default Re: Hserin

    Thanks for the info! Tomorrow I will try again.

Similar Threads

  1. HSerin
    By GatorGuy in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 14th October 2011, 06:04
  2. Hserin
    By GatorGuy in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 26th February 2010, 13:36
  3. hserin
    By jcleaver in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 21st February 2007, 19:15
  4. Hserin
    By Christopher4187 in forum General
    Replies: 3
    Last Post: - 21st March 2006, 00:09
  5. Hserin
    By MICOCALI in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 22nd May 2005, 10:09

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