Home AMX User Forum NetLinx Studio

Checksum how to do it.

Hello,

Iam trying to send a file to a dmx player, but i have problem to find out how the checksum works.
In the manuel they see that i have to do a xor with the address and the data bytes.
But i dont know how to do this.

I can send data to the player a capture with a rs232 spy and that works fine, but i don't see how the checksum is bild.

To start i send a $FD, $00, $00, $28, the $28 is the checksum i captured.
Then i send the last 2 bytes with a hextoi :
0000:f0
0001:02
0002:14
0003:00
0004:00
0005:00
0006:01
0007:1f
0008:00
0009:80
000a:1c
000b:00
000c:00
000d:4e
000e:65
000f:77
0010:20
0011:73
0012:63
0013:65
0014:6e
0015:65
0016:20
0017:31
0018:20
0019:20
001a:20
001b:20
001c:1c
001d:00
001e:00
001f:00
0020:14
0021:00
0022:01
0023:00
0024:00
0025:ff
0026:00
0027:00

This is working,

But when i put a other file into the amx it don't and i see that the checksum is changed.

This is what into the manual is:
0xFD(Block transfer header)

address low(0x00 ... 0xFF)

address high(0x00 ... 0xFF)

data byte(0x00 ... 0xFF)

checksum(0xDF xor address low xor address high
xor data byte)


Is there someone that can tell me how this checksum is working.
thanks

Comments

  • jimmywjimmyw Posts: 112
    Volatile CHAR address[2]
    Volatile CHAR command
    Volatile CHAR checksum
    Volatile CHAR theCommand[5]

    address = "$00,$00"

    command = "$28"

    checksum = "$DF^address[1]^address[2]^command"

    theCommand = "$FD,address,command,checksum"
    Send_string theDev, theCommand


    ^ == Bitwise XOR

    unneccesary steps added for readability
Sign In or Register to comment.