170
MIDI Implementation
●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.
❍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 ccH and the data or size is dd ee ffH.
aa + bb + cc + dd + ee + ff = sum
sum / 128 = quotient ... remainder
128 - remainder = checksum
<Example 1> Setting REVERB TYPE of PERFORMANCE COMMON to ROOM 3 (DT1)
According to the “Parameter Address Map” (p. 165), the start address of Temporary
Performance is 01 00 00 00H, the offset address of PERFORMANCE COMMON is 00 00H,
and the address of REVERB TYPE is 00 14H. Therefore the address of CHORUS TYPE of
PERFORMANCE COMMON is;
01 00 00 00H
00 00H
+) 00 14H
01 00 00 14H
ROOM 3 has the value of 02H.
So the system exclusive message should be sent is;
F0 41 10 00 3C 12 01 00 00 14 02 ?? F7
(1) (2) (3) (4) (5) address data checksum (6)
(1) Exclusive Status (2) ID (Roland) (3) Device ID (17)
(4) Model ID (RS-5/9) (5) Command ID (DT1) (6) End of Exclusive
Then calculate the checksum.
01H + 00H + 00H + 14H + 02H = 1 + 0 + 0 + 20 + 2 = 23 (sum)
23 (sum) / 128 = 0 (quotient) ... 23 (remainder)
checksum = 128 - 23 (remainder) = 105 = 69H
This means that F0 41 10 00 3C 12 01 00 00 14 02 69 F7 is the message should be sent.
<Example 2> Getting the data (RQ1) of Performance Part 3 in USER:03
According to the “Parameter Address Map” (p. 165), the start address of USER:03 is 04 02 00
00H, and the offset address of Performance Part 3 is 12 00H.
Therefore the start address of Performance Part 3 in USER:03 is;
04 02 00 00H
+) 12 00H
04 02 12 00H
As the size of Performance Part is 00 00 00 21H, the system exclusive message should be sent is;
F0 41 10 00 3C 11 04 02 12 00 00 00 00 21 ?? F7
(1) (2) (3) (4) (5) address data checksum (6)
(1) Exclusive Status (2) ID (Roland) (3) Device ID (17)
(4) Model ID (RS-5/9) (5) Command ID (RQ1) (6) End of Exclusive
Then calculate the checksum.
04H + 02H + 12H + 00H + 00H + 00H + 00H + 21H = 4 + 2 + 18 + 0 + 0 + 0 + 0 + 33 = 57 (sum)
57 (sum) / 128 = 0 (quotient) ... 57 (remainder)
checksum = 128 - 57 (remainder) = 71 = 47H
This means that F0 41 10 00 3C 11 04 02 12 00 00 00 00 21 47 F7 is the message should be sent.
<Example 3> Getting Temporary Performance data (RQ1)
According to the “Parameter Address Map” (p. 165), the start address of Temporary
Performance is assigned as following:
01 00 00 00H Temporary Performance Common
01 00 10 00H Temporary Performance Part 1
:
01 00 1F 00H Temporary Performance Part 16
As the data size of Performance Part is 00 00 00 21H, summation of the size and the start
address of Part 16 at Temporary Performance will be;
01 00 1F 00H
+) 00 00 00 21H
01 00 1F 21H
And the size that have to be got should be;
01 00 1F 21H
-) 01 00 00 00H
00 00 1F 21H
Therefore the system exclusive message should be sent is;
F0 41 10 00 3C 11 01 00 00 00 00 00 1F 21 ?? F7
(1) (2) (3) (4) (5) address data checksum (6)
(1) Exclusive Status (2) ID (Roland) (3) Device ID (17)
(4) Model ID (RS-5/9) (5) Command ID (RQ1) (6) End of Exclusive
Then calculate the checksum.
01H + 00H + 00H + 00H + 00H + 00H + 1FH + 21H = 1 + 0 + 0 + 0 + 0 + 0 + 31 + 33 = 65 (sum)
65 (sum) / 128 = 0 (quotient) ... 65 (remainder)
checksum = 128 - 65 (remainder) = 63 = 3FH
This means that F0 41 10 00 3C 11 01 00 00 00 00 00 1F 21 3F F7 is the message should be
sent.
<Example 4> When Producing the Combined Temporary Performance Data and All
Temporary Tone and Drum Set Data (RQ1)
* The data produced is the same as that when transmitting Bulk Dump:Temporary in
Utility mode.
According to the “Parameter Address Map” (p. 165), the start address of the
above all parameters is assigned as following:
01 00 00 00H Temporary Performance Common
02 00 00 00H Temporary Tone (Part 1)
02 01 00 00H Temporary Tone (Part 2)
::
02 0F 00 00H Temporary Tone (Part 16)
03 00 00 00H Temporary DrumSet 1
03 01 00 00H Temporary DrumSet 2
As the data size of Drum Set is 00 00 05 00H, summation of the size and the start address of
Temporary DrumSet 2 will be;
03 01 00 00H
+) 00 00 05 00H
03 01 05 00H
And the size that have to be got should be;
03 01 05 00H
-) 01 00 00 00H
02 01 05 00H
Therefore the system exclusive message should be sent is;
F0 41 10 00 3C 11 01 00 00 00 02 01 05 00 ?? F7
(1) (2) (3) (4) (5) address data checksum (6)
(1) Exclusive Status (2) ID (Roland) (3) Device ID (17)
(4) Model ID (RS-5/9) (5) Command ID (RQ1) (6) End of Exclusive
Then calculate the checksum.
01H + 00H + 00H + 00H + 02H + 01H + 05H + 00H = 1 + 0 + 0 + 0 + 2 + 1 + 5 + 0 = 9 (sum)
9 (sum) / 128 = 0 (quotient) ... 9 (remainder)
checksum = 128 - 9 (remainder) = 119 = 77H
This means that F0 41 10 00 3C 11 01 00 00 00 02 01 05 00 77 F7 is the message should be sent.