12f675_fuse_about_to_blow!


Results 1 to 40 of 929

Threaded View

  1. #33
    Join Date
    Feb 2010
    Location
    I live in the UK
    Posts
    562


    Did you find this post helpful? Yes | No

    Default

    Calculate checksum by adding 2 data bytes together
    Code:
    CheckSum = DAT_IN1 + DAT_IN2
    So the CheckSum = (%10101011 * 2 BYTES) if SW1 ( GPIO.3) was pressed.

    or (%10101101 * 2 BYTES) if SW2 (GPIO.4) was pressed.

    Plus we should have the already have a calculated CHK_SUM that was sent.

    So:

    Code:
    CHK_SUM   VAR BYTE  ' Holds checksum received
    And:

    Code:
    CheckSum  VAR BYTE  ' Computed checksum of all bytes received
    Therefore:

    Code:
    IF CheckSum != CHK_SUM THEN MAIN ' Failed checksum, return
    If Checksum (!) is not = CHK_SUM then go back to MAIN the checksum has failed.

    The same with:

    IF (DAT_IN1) != (DAT_IN2) THEN MAIN ' Failed data comparison, return
    The DAT_IN BYTES must also be equal, if not then back to MAIN:

    If however everything matches then continue to MATCH..........

    How does this look?

    Dave
    Last edited by LEDave; - 22nd November 2010 at 18:59.

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