Jump to content

Recommended Posts

Posted

HI ,i ve planed to build a controller for a old jd 990 ..i find this:

For example the following SysEx message turns off Tone 1 on the temporary patch on a JV-1080/JV-2080/XP-50 or XP-80. The checksum 6D is calculated as follows (all numbers are in Hex NOT decimal):

F0 41 10 6A 12 03 00 10 00 00 6D F7

            ^^ ^^^^^^^^^^^^^^ ^^ ^^

            |        |        |  |

            |        |        |  +-- End of SysEx message marker

            |        |        +-- Checksum

            |        +-- Data portion of message

            +-- Command ID (12 = DT1 - Data Set)

(1) Add the data part of the message

03 + 00 + 10 + 00 + 00 = 13 (X)

(2) Divide (X) by 0x80 (128 in decimal) and save the reminder which is (Y)

13 / 80 = 0 with remainder of 13 =(Y)

(3) Subtract (Y) from 0x80 (128) to give us the checksum

80 - 13 = 6D (checksum)

i don't understand the (2)..;some  informations please...best regards and happy new years..

Posted

13h = 19d

19d / 128 d = 0,148...

As you can't easily represent floating point values in a hexadecimal system, you use the concept of a remainder.

-->  0 x 128d (a)

--> 19 x 1d (b)

==> total is (a)+(b)

Posted

Yes, if you want to send SysEx messages, you have to understand what you are doing  :). Look here for a more in-depth explanation of the concept. Also, you will need to understand the manufacturer's (Roland) implementation of that concept.

It's complex, but it's not magic. With MIDIbox you are on the right platform for doing this!

Best regards, ilmenator

Posted

Google modulus

seems like this pseudocode should do it:

void gen_chksum_and_send(void) {
unsigned char Y = 0;
unsigned char X = 0; // I assume it's meant to be overloaded

for (i=0; i < sysex_byte_count; i++){
X += sysex_buffer[i];
}

X %= 0x80; //There's the modulus
Y = 0x80 - X;

sysex_buffer[sysex_byte_count] = Y;

sysex_buffer_send();
}

Don't go trying to do that frequently on the PIC though, a modulus is a divide operation so it's slow.

Posted

There is a good explanation of the checksum at the end of This Page.

The add and mask concept is easier to implement in PIC than any divide type function.

I'd start with a dummy value of zero, then do a loop until the end of the sysex data, adding the next value and masking with 128 (AND 0x7F ) , to keep the numbers in the frame. You don't need to worry about carry values, because the nominal overflow is going to be masked off anyway.

Note 0x7F = 0b01111111:  the AND function effectively means "keep all the bits except the highest".

Here is a sysex calculator on this page which will allow you to check figures during testing

Hope this helps

Posted

1. Convert the hex values to decimal.

2. Add the values together, but if the answer to any sum exceeds 127 then subtract 128.

3. Subtract the final answer from 128.

4. Convert the resulting value back to hex and use as the checksum.

Much nicer method! Thanks Mike!

Remember the checksum is only calculated from the address [6] and the data [7]

This new (new to me anyway) info means that the above code will certainly not work.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...