Compare Data


Closed Thread
Results 1 to 10 of 10

Thread: Compare Data

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default

    Sorry but i dont have exactly explain my Problem,I know how this work but my problem is how to make a routine that check for example if I receive this $OK:CALL, then is the call ok and so on.

    How to verify Long strings?

    I send this $WP+CALL=12345... and then from gsm module receive $OK:CALL.

    Thanks Skimask

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Pesticida View Post
    Sorry but i dont have exactly explain my Problem,I know how this work but my problem is how to make a routine that check for example if I receive this $OK:CALL, then is the call ok and so on.
    How to verify Long strings?
    I send this $WP+CALL=12345... and then from gsm module receive $OK:CALL.
    Thanks Skimask
    Yes, I know...I get it...
    Ok, if you know you start out with a NULL string, and you know what messages you are supposed to be receiving, and you know each of these messages may or may not be a different length, it shouldn't be much of a problem to look at the string, starting from the end (whether it's used or not) and working your way back to the start, looking for the character/characters which may or may not identify the string you are looking for...

  3. #3


    Did you find this post helpful? Yes | No

    Default

    You mean i must do for example something like this:

    Mystring var byte [24] ' maximal 24 bytes
    String_Lenght var byte


    But I must count how Long is my string from start $ to End Line feed.
    For Example Ihave this $OK:CALL

    String_Lenght for this example is 9 with Line feed

    if Mystring[String_Lenght-2] = 76 then Character2 'L
    Character2:
    if Mystring[String_Lenght-3] = 76 then Character3 'L
    Character3:
    if Mystring[String_Lenght-4] = 65 then Character4 'A
    Character4:
    if Mystring[String_Lenght-5] = 67 then Character3 'C

    and so on

    but I think this is not the good way ,this is to complicated for several strings!

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Pesticida View Post
    You mean i must do for example something like this:
    Mystring var byte [24] ' maximal 24 bytes
    String_Lenght var byte
    But I must count how Long is my string from start $ to End Line feed.
    For Example Ihave this $OK:CALL
    String_Lenght for this example is 9 with Line feed
    if Mystring[String_Lenght-2] = 76 then Character2 'L
    Character2:
    if Mystring[String_Lenght-3] = 76 then Character3 'L
    Character3:
    if Mystring[String_Lenght-4] = 65 then Character4 'A
    Character4:
    if Mystring[String_Lenght-5] = 67 then Character3 'C

    and so on

    but I think this is not the good way ,this is to complicated for several strings!
    There is no String_Length function, you have to count backwards from the end to find the length of the string manually.
    One easy-ish way I can think of...
    You have X number of possible messages to be returned.
    Add up the character values of each possible character in that message.
    When a complete message is received and you have added up the individual characters, the message either may or may not match a number already in a table you have preconstructed for that purpose.
    Example:
    Message received is 'OK' + LF
    ASCII value's are O = 79, K = 75, LF = 10, therefore the message is 79+75+10 = 164.
    After you've added them all up you get 164. Go to a Select Case..... Case 164 .... blah blah blah... and there you go.
    Problem is...here's another message...
    Message received is 'AY' + LF
    A = 65, Y = 89, LF = 10, message = 65+89+10 = 164...the code would see the same message, so you'd have to actually go 'inside' the received message to figure out which one it is...
    Or you could just use a number of LOOKUP statements to figure it out.

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Thank You Skimask this is a Perfect Solution, while I have just 10 Answers what I need.

    I will try your example.

    Regards Pesti

Similar Threads

  1. Using Nokia LCD
    By BobP in forum mel PIC BASIC Pro
    Replies: 300
    Last Post: - 3rd May 2018, 04:47
  2. Nokia 3310 display text
    By chai98a in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 26th August 2007, 03:39
  3. Big characters on HD44780 4x20
    By erpalma in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 7th January 2007, 02:21
  4. LCD + bar graph
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 5th October 2005, 14:50
  5. Sinus calculating !
    By Don Mario in forum mel PIC BASIC Pro
    Replies: 29
    Last Post: - 28th November 2004, 23:56

Members who have read this thread : 0

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