Creating Checksum in PBP


Results 1 to 9 of 9

Threaded View

  1. #3
    Join Date
    Feb 2005
    Location
    Bellevue
    Posts
    125


    Did you find this post helpful? Yes | No

    Exclamation RE: Checksum

    What I am most interested in is (even if I did a big loop to read all the data into an array) How would I create the checksum?

    Seems I'd have to read the data character by character - compute the checksum of the character, then add it to the total until I am done?

    sum = var byte ' my checksum handler
    NMEA_sum = var byte ' my final checksum
    myarray = byte(34)

    If I have several variables, why not just read them each in turn:

    For i = 1 to (number of characters in myarray)
    sum=myarray(i)
    - do the checksum routine, which I can't seem to translate to PBP
    *** In VB: it looks like this
    sum = sum Xor Asc(Mid$(sSentence, i, 1))
    Next i

    *** My attempt at PBP: looks like this
    NMEA_sum = (sum ^(character(i))
    Next i

    *** then the VB:

    NMEA_Checksum = Right$("0" & Hex$(sum), 2)

    *** my attempd in PBP: No idea --

    NMEA_sum=$sum (?????)

    THEN:

    NMEA_sum is the answer - a summed up value from all the characters in myarray(i)

    Of course this does not work..

    Help!
    Last edited by Tom Gonser; - 1st March 2005 at 14:38. Reason: clarity

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 12:55
  2. Checksum
    By retepsnikrep in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th October 2009, 04:09
  3. Calculate Byte Value Checksum in PBP Pro
    By Pedro Pinto in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 8th July 2009, 22:50
  4. Replies: 1
    Last Post: - 10th May 2006, 15:17
  5. Checksum problem!
    By atomski in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd November 2004, 07:21

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