Hserin parsing string...again?


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612

    Default Re: Hserin parsing string...again?

    Remember that it's all just numbers, if you want to check if a byte contains 'I' either of these will work
    Code:
    IF myByte = 73 THEN....
    If myByte = "I" THEN....
    IF myByte = $49 THEN....
    IF myByte = %00110001 THEN...
    They all do the same thing - they compare the content of myByte with the decimal value 73, which is the ASCII code for the letter 'I'.

    Instead of using AND you might try something like:
    Code:
    IF Buffer[0] = "I" THEN
      IF Buffer[1] = "N" THEN
        IF Buffer[2] = "V" THEN
          IF Buffer[3] = "A" THEN
            GOTO Freeze
          ENDIF
        ENDIF
      ENDIF
    ENDIF
    There's nothing wrong with the AND approach but I think using multiple IF statements will produce smaller code.

    /Henrik.

  2. #2
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231

    Default Re: Hserin parsing string...again?

    Thanks Henrik,

    I just needed a sanity check. Too many hours and poor results.

    I'll have a look at it when I get back to the shop. Maybe something obvious after some sleep and a fresh look.

    Bo

  3. #3
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231

    Default Re: Hserin parsing string...again?

    Dave, (and, of course, anyone else that care to respond)
    I'm a bit confused about checking the data with a pointer. Do you mind explaining more?

    I understand setting up a ring buffer similar to DT's serial LCD program. What I'm not sure is if I need to keep it cleaned out or something similar. If I just keep stepping the pointer around the loop, what happens when you fill the buffer? Does it just overwrite the previous data and keep circling the ring? After looking at that program for a long time, I finally believe that is what happens.

    Still trying to work towards for that "Neo" moment when the Matrix just starts to come into focus....

    Bo

  4. #4
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231

    Default Re: Hserin parsing string...again?

    Dave, (and, of course, anyone else that care to respond)
    I'm a bit confused about checking the data with a pointer. Do you mind explaining more?

    I understand setting up a ring buffer similar to DT's serial LCD program. What I'm not sure is if I need to keep it cleaned out or something similar. If I just keep stepping the pointer around the loop, what happens when you fill the buffer? Does it just overwrite the previous data and keep circling the ring? After looking at that program for a long time, I finally believe that is what happens.

    Still trying to work towards for that "Neo" moment when the Matrix just starts to come into focus....

    Bo

Similar Threads

  1. HSERIN for variable length string
    By Pic2008 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 19th February 2010, 05:58
  2. parsing string from hserin
    By xxxxxx in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 2nd April 2009, 18:42
  3. Visual Basic 6 & Access 2000
    By Demon in forum Off Topic
    Replies: 33
    Last Post: - 7th September 2006, 04:39
  4. String Parsing
    By eoasap in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th February 2006, 17:20
  5. serial string parsing
    By billybobbins in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 8th September 2004, 21:34

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts