O (p. 20), Lhow to calculate the checksum – Roland MIDI Implementation SH-01 User Manual

Page 20

Advertising
background image

20

MIDI Implementation

n

Example of an Exclusive Message and Calculating a

Checksum

Roland Exclusive messages (RQ1, DT1) are transmitted with a checksum at the end
(before F7) to make sure that the message was correctly received. The value of the
checksum is determined by the address and data (or size) of the transmitted Exclusive
message.

l

How to calculate the checksum

(hexadecimal numbers are indicated by “H”)
The checksum is a value derived by adding the address, size, and checksum itself and
inverting the lower 7 bits.
Here’s an example of how the checksum is calculated. We will assume that in the
Exclusive message we are transmitting, the address is aa bb cc ddH and the data or
size is ee ffH.

aa + bb + cc + dd + ee + ff = sum
sum ÷ 128 = quotient ... remainder
128 - remainder = checksum

<Example 1> Setting OSC Wave of Temporary Patch to SUPER-SAW (DT1)
According to the “Parameter Address Map” (p. 8), the start address of Temporary Patch
is 10 00 00 00H, the offset address of Tone 1 is 01 00H, and the address of OSC Wave is
00 00H. Therefore the address is;

10 00 00 00H
01 00H
+) 00 00H
10 00 01 00H

SUPER-SAW has the value of 06H.
So the system exclusive message should be sent is;

F0

41

10

00 00 41

12

10 00 01 00

06

??

F7

(1)

(2)

(3)

(4)

(5)

address

data

checksum

(6)

(1) Exclusive Status, (2) ID (Roland), (3) Device ID (17),
(4) Model ID (SH-01), (5) Command ID (DT1), (6) End of Exclusive

Then calculate the checksum.
10H + 00H + 01H + 00H + 06H = 16 + 0 + 1 + 0 + 6 = 23 (sum)
23 (sum) ÷ 128 = 0 (quotient) ... 23 (remainder)
checksum = 128 - 23 (remainder) = 105 = 69H

This means that F0 41 10 00 00 41 12 10 00 01 00 06 69 F7 is the message should be
sent.

<Example 2> Getting the data (RQ1) of REVERB in USER PATCH:A-2
According to the "Parameter Address Map" (p. 8), the start address of USER PATCH:A-2 is
20 01 00 00H, and the offset address of REVERB is 00 0A 00H.
Therefore the start address of REVERB in USER PATCH:A-2 is;

20 01 00 00H
+) 00 0A 00H
20 01 0A 00H

As the size of REVERB is 00 00 00 51H, the system exclusive message should be sent is;

F0

41

10

00 00 41

11

20 01 0A 00

00 00 00 51

??

F7

(1)

(2)

(3)

(4)

(5)

address

data

checksum

(6)

(1) Exclusive Status, 2) ID (Roland), (3) Device ID (17),
(4) Model ID (SH-01), (5) Command ID (RQ1), (6) End of Exclusive

Then calculate the checksum.
20H + 01H + 0AH + 00H + 00H + 00H + 00H + 51H = 32 + 1 + 10 + 0 + 0 + 0 + 0 + 81
= 124 (sum)
124 (sum) ÷ 128 = 0 (quotient) ... 124 (remainder)
checksum = 128 - 124 (remainder) = 4 = 04H

This means that F0 41 10 00 00 41 11 20 01 0A 00 00 00 00 51 04 F7 is the message
should be sent.

<Example 3> Getting Temporary Patch data (RQ1)

According to the “Parameter Address Map” (p. 8), the start address of Temporary Patch
is assigned as following:

10 00 00 00

Temporary Patch

The offset address of Patch is also assigned as follows:

00 00 00

Patch Common

00 01 00

Patch Tone 1

00 02 00

Patch Tone 2

00 03 00

Patch Tone 3

00 04 00

Patch Distortion

00 06 00

Patch Flanger

00 08 00

Patch Delay

00 0A 00

Patch Reverb

00 0C 00

Patch Arpeggio Common

00 0D 00

Patch Arpeggio Pattern (Note 1)

00 0E 00

Patch Arpeggio Pattern (Note 2)

:

00 1C 00

Patch Arpeggio Pattern (Note 16)

Advertising