Arduino Projekten

Fri 29-Mar-24
11:39:08


Mega Midi Panel

Datum: Sat 14 March 2015
Samenvatting: Het Midi Panel met de Arduino Mega.


Dit MidiMega Paneel is de combinatie van 2 RGBMatrix Panelen, een Arduino Mega en Midi. In de Mega is nu ruim genoeg variabelen geheugen (8kb) aanwezig om het totale Midi Paneel te kunnen realiseren ... PLUS wat meer leuke opties.

En dan blijkt het nog steeds waar te zijn, dat het intikken van tekst, na 3½ maanden, na een projekt, inderdaad geen goed idee is.

Het omzetten van een Arduino Uno naar de Arduino Mega is eigenlijk zonder veel problemen gegaan. De voorgaande Arduino Mega-Projecten hebben de nodige omzet-truken opgeleverd, zoals bij de Directe Poort Aansturingen (DDRx en PORTx). De interupt op zich heeft geen problemen opgeleverd.

Door het uitgebreidere geheugen heeft het programma wat extra funkties gekregen. De 4 potmeters op de voorzijde moesten ergens voor gebruikt worden.

Het paneel.

Na een titel-tekst ("MegaMidi Panel.") wordt hierop (primair) de Midi-data getoond. De noten hebben elk wat Led's, het Rytme, het Midi-kanaal, de controlers en al de andere data die door de kabel binnenkomt.

Bij de Arduino-Uno is uitgebreid beschreven welke Midi-Data welke Led's laten oplichten en knipperen.

De 7-segment-displays.

Voorlopig worden hierop nog maar 2 teksten getoond, namelijk "Midi" en "Keys" (zie "Potmeter 2: Mode Pot").

In het programma doet de funktie "void Write_PanelMode(byte Mode)" dit.

De Led's (8x3).

Hierop wordt de Midi-data binair getoond. Er zijn drie rijen met elk 8 rode Led's. Midi gaat ook in groepjes van maximaal 3 bytes. Bij een beetje Midi-muziek knipperen deze Led's in een behoorlijk tempo mee met de Midi-Data.

Potmeter 1: Het Midi-kanaal

Deze bepaalt naar welk Midi-kanaal er wordt "geluisterd". net als op het Uno-paneel. Er zijn 16 kanalen beschikbaar. Wordt deze potmeters helemaal rechtsom gedraaid, dan staat het paneel in Omni-mode, oftewel elke Midi-data (maakt niet uit voor welk kanaal deze is bedoeld) wordt op het paneel neergezet.

Potmeter 2: Mode-Pot

Tot nu toe kent het mega-paneel 2 standen, namelijk "Midi" en "Keys". Deze tekst wordt op de 7-segment-displays getoond (zie foto's).

- "Midi" geeft het paneel alles weer zoals op de Arduino-Uno was. Alle Midi-noten worden op de bovenste 8 rijen Led's getoond, van links boven naar rechts onder.

- "Keys" laat de bovenste 8 rijen Led's veranderen in een soort van Piano-keyboard patroon, inclusief versprongen "zwarte" toetsen (die rood oplichten) en paarse "witte" toetsen (die wit oplichten). Dit leek mij toen een leuk idee om erin te bouwen. Het bereikt op het scherm is maar 5 oktaven.

Potmeter 3: -geen-funktie-

Deze potmeter heeft nog geen funktie. De drang om de Arsid te bouwen is groter. :)

Potmeter 4: Noot-verschuiving

Deze laat (in de stand "Keys") de Midi-noten, die op de "toetsen" van het paneel worden getoond, opschuiven. Met 5 oktaven op het paneel zijn zo toch alle 8½ oktaven van Midi (het totale bereik is 128-noten) te tonen.

Uitbreidingen?

Op dit moment is niet bekend waarmee EN waneer het programma voor het Mega Paneel wordt uitgebreid. Zoals eerder is geschreven, de drang om de ArSid te bouwen is groter.


Broncode: [1: Mega Midi Panel]

1: De broncode van Mega Midi Panel

(Sat 14 March 2015) Het Midi Panel met de Arduino Mega.

Deze broncode heeft 1735 regels met programma-code.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
//     ---------------------------------------------------------
//     |  Mega Midi Panel on RGBMatrix                         |
//     |  Arduino Mega                                         |
//     ---------------------------------------------------------

//--------[ Needed Include Files ] -------------------------------------------
// Include the beautiful Font
#include "{drive}\{directory}\cbmfont.c"
// Include 7-segment Font
#include "{drive}\{directory}\segment7.c"
// Next line is needed for PROGMEM and pgm_read_byte_near-function
#include <avr/pgmspace.h>

//=========================================================
// Some Pot-vars
const byte ChannelPot   = A0; // Potmeter 1
const byte ModePot      = A1; // Potmeter 2
const byte Pot3         = A2; // Potmeter 3
const byte KeyShift     = A3; // Potmeter 4
byte       PickChannel  =  0; // The Midi Channel to listen to
byte       PanelMode    =  0; // The Mode of the Panel. 0=Midi; 1=Keys
byte       PanelModeSet =  0; // Var for remembering the Panel Mode Initialisation
int        KeyShiftVal  =  0; // Value (+/-) for KeyShift
// Activity Vars
byte       Old_Activity      =  0;
byte       Activity_Count    =  0;
word       Activity_TimeOut  =  0;
const byte ActivityX         = 60;
const byte ActivityY         = 15;
const word ActivityColor     = 0x0111;
const word ActivityBGColor   = 0x0000;
const word Activity_CountOut = 5000;
//=========================================================
// Some Midi Vars
byte       Serial1Byte = 0;
byte       MidiChannel = 0;
byte       MidiCommand = 0;
byte       MidiComCom  = 0;
byte       MidiParm1   = 0;
byte       MidiParm2   = 0;
byte       AantalParms = 0;
byte       ParmCount   = 0;
// Array with Number of Parameters of a Command
const byte AantalMidiParms [16] = {0,0,0,0,0,0,0,0,2,2,2,2,1,1,2,0};
// Note On Colors
const word NoteColors [32] = {0x0000,0x0001,0x0002,0x0003,
                              0x0004,0x0005,0x0006,0x0007,
                              0x0010,0x0030,0x0050,0x0070,
                              0x0011,0x0033,0x0055,0x0077,
                              0x0100,0x0300,0x0500,0x0700,
                              0x0101,0x0303,0x0505,0x0707,
                              0x0110,0x0330,0x0550,0x0770,
                              0x0111,0x0333,0x0555,0x0777
                             };
//=========================================================
// Midi Counters, Coordinations & Colors
// Channel
byte       Old_Channel     =  0;
word       Pot_Count       =  0;
const word Pot_TimeOut     = 1000;
const byte ChannelX        =  0;
const byte ChannelY        = 14;
const byte ChannelPotY     = 15;
const word ChannelColor    = 0x0707;
const word ChannelPotColor = 0x0737;
const word ChannelBGColor  = 0x0001;
// $80 & $90 Note On & Note Off ==> 4 lines
const byte NoteY =  0;
// BgColor = 0x0000;
// $A0 AfterTouch ==> 2 lines
const byte AfterY =  4;
// BgColor = 0x0000;
// $B0 Control Change ==> 2 lines
const byte ControlY =  6;
// BgColor = 0x0000;
// $C0 ProgramChange ==> 2 lines
byte       Old_ProgChangeX   =  0;
byte       Old_ProgChangeY   =  0;
const byte ProgChangeY       =  8;
const word ProgChangeColor   = 0x0707;
const word ProgChangeBGColor = 0x0001;
// $D0 Channel AfterTouch ==> 2 lines
byte       Old_ChAfterX   =  0;
byte       Old_ChAfterY   =  0;
const byte ChAfterY       = 10;
const word ChAfterColor   = 0x0770;
const word ChAfterBGColor = 0x0010;
// $E0 PitchBend ==> 2 lines
byte       Old_PitchBendX   =  0;
byte       Old_PitchBendY   =  0;
const byte PitchBendY       = 12;
const word PitchBendColor   = 0x0077;
const word PitchBendBGColor = 0x0100;
//=========================================================
// Common Commands
// $F0 System Exclusive Start
byte       Old_UndefF0_Count =  0;
byte       UndefF0_Count     =  0;
const byte UndefF0X          = 16;
const byte UndefF0Y          = 14;
const word UndefF0Color      = 0x0100;
const word UndefF0BGColor    = 0x0000;
// $F1 Time Code
byte       Old_UndefF1_Count =  0;
byte       UndefF1_Count     =  0;
const byte UndefF1X          = 20;
const byte UndefF1Y          = 14;
const word UndefF1Color      = 0x0100;
const word UndefF1BGColor    = 0x0000;
// $F2 Song Position
byte       Old_UndefF2_Count =  0;
byte       UndefF2_Count     =  0;
const byte UndefF2X          = 24;
const byte UndefF2Y          = 14;
const word UndefF2Color      = 0x0100;
const word UndefF2BGColor    = 0x0000;
// $F3 Choose Song
byte       Old_UndefF3_Count =  0;
byte       UndefF3_Count     =  0;
const byte UndefF3X          = 28;
const byte UndefF3Y          = 14;
const word UndefF3Color      = 0x0100;
const word UndefF3BGColor    = 0x0000;
// $F4 UndefF4
byte       Old_UndefF4_Count =  0;
byte       UndefF4_Count     =  0;
const byte UndefF4X          = 16;
const byte UndefF4Y          = 15;
const word UndefF4Color      = 0x0100;
const word UndefF4BGColor    = 0x0000;
// $F5 UndefF5
byte       Old_UndefF5_Count =  0;
byte       UndefF5_Count     =  0;
const byte UndefF5X          = 20;
const byte UndefF5Y          = 15;
const word UndefF5Color      = 0x0100;
const word UndefF5BGColor    = 0x0000;
// $F6 Tune Request
byte       Old_UndefF6_Count =  0;
byte       UndefF6_Count     =  0;
const byte UndefF6X          = 24;
const byte UndefF6Y          = 15;
const word UndefF6Color      = 0x0100;
const word UndefF6BGColor    = 0x0000;
// $F7 System Exclusive End
byte       Old_UndefF7_Count =  0;
byte       UndefF7_Count     =  0;
const byte UndefF7X          = 28;
const byte UndefF7Y          = 15;
const word UndefF7Color      = 0x0100;
const word UndefF7BGColor    = 0x0000;
//=========================================================
// $F8 Basic Tempo Indications (24 beats per beat)
byte       Old_Rhythm_Count =  0;
byte       Rhythm_Count     =  0;
const byte RhythmX          = 40;
const byte RhythmY          = 14;
const word RhythmColor      = 0x0047;
const word RhythmBGColor    = 0x0001;
// $F8 Extended Tempo Indications
byte       Old_Tempo_Count =  0;
byte       Tempo_Count     =  0;
byte       Tempo_Walk      =  0;
const byte TempoX          = 44;
const byte TempoY          = 15;
const word TempoColor      = 0x0272;
const word TempoBGColor    = 0x0001;
// $F9 UndefF9
byte       Old_UndefF9_Count =  0;
byte       UndefF9_Count     =  0;
const byte UndefF9X          = 32;
const byte UndefF9Y          = 14;
const word UndefF9Color      = 0x0100;
const word UndefF9BGColor    = 0x0000;
// $FA & $FB & $FC Start & Continue & Stop
const word StartColor      = 0x0700;
const word StopColor       = 0x0101;
// $FD UndefFD
byte       Old_UndefFD_Count =  0;
byte       UndefFD_Count     =  0;
const byte UndefFDX          = 32;
const byte UndefFDY          = 15;
const word UndefFDColor      = 0x0100;
const word UndefFDBGColor    = 0x0000;
// $FE Active Sensing
byte       Old_Active_Count =  0;
byte       Active_Count     =  0;
const byte ActiveX          = 36;
const byte ActiveY          = 15;
const word ActiveColor      = 0x0303;
const word ActiveBGColor    = 0x0000;
// $FF Reset
byte       Old_Reset_Count =  0;
byte       Reset_Count     =  0;
const byte ResetX          = 12;
const byte ResetY          = 15;
const word ResetColor      = 0x0777;
const word ResetBGColor    = 0x0000;

//==============================================================================
//== XY-Pos for Key-showing
//==============================================================================

const byte KeyNum     = 60;
const byte KeyX [KeyNum] = { 0, 1, 2, 3, 4, 6, 7, 8, 9,10,11,12,
                            14,15,16,17,18,20,21,22,23,24,25,26,
                            28,29,30,31,32,34,35,36,37,38,39,40,
                            42,43,44,45,46,48,49,50,51,52,53,54,
                            56,57,58,59,60,62,63,64,65,66,67,68
                           };
const byte KeyY [KeyNum] = { 4, 0, 4, 0, 4, 4, 0, 4, 0, 4, 0, 4,
                             4, 0, 4, 0, 4, 4, 0, 4, 0, 4, 0, 4,
                             4, 0, 4, 0, 4, 4, 0, 4, 0, 4, 0, 4,
                             4, 0, 4, 0, 4, 4, 0, 4, 0, 4, 0, 4,
                             4, 0, 4, 0, 4, 4, 0, 4, 0, 4, 0, 4
                           };
const word KeyBkGndColor    = 0x0110;
const word KeyBlackColorOff = 0x0000;
const word KeyBlackColorOn  = 0x0007;
const word KeyWhiteColorOff = 0x0101;
const word KeyWhiteColorOn  = 0x0777;

//==============================================================================
//== Setup and Loop                                                           ==
//==============================================================================

void setup()
{ InitPan(0x0000);
  Serial.begin(115200);
  panel_intro();
  ClrPan();
  Init_Midi();
  Serial1.begin(31250);
}

void loop()
{ Read_Pots();
  Read_Midi();
  WriteLed(0,Serial1Byte);
}

void Read_Pots()
{ if (Pot_Count < Pot_TimeOut)
     { Pot_Count = Pot_Count + 1;
     }
  else
     { Pot_Count = 0;
       // Read The Channel Pot
       SetPoint(ChannelX+PickChannel, ChannelPotY, ChannelBGColor);
       PickChannel = analogRead(ChannelPot) / 61;
       SetPoint(ChannelX+PickChannel, ChannelPotY, ChannelPotColor);
       // Read the PanelMode Pot
       PanelMode = analogRead(ModePot)/256;
       Write_PanelMode(PanelMode);
       // Read The KeyShift Pot
       KeyShiftVal = 12 * (analogRead(KeyShift) - 512) / 48 );
     }
}

//==============================================================================
//==  Midi Panel Introduction                                                 ==
//==============================================================================

void panel_intro()
{ // Write "MegaMidi" & "Panel."
  word kleur=0x0110;
  CharColor (kleur);
//  ReverseChar();
  GotoXY ( 0,0);
  PrintChar ("MegaMidi");
  GotoXY (0,8);
  PrintChar (" Panel. ");
  write_note( 0,8,kleur);
  write_note(56,8,kleur);
  delay(2000);
  // Write "Midi" on Displays
  Write_PanelMode(0);
}

void write_note(byte x, byte y, word k)
{ // Draw the bar
  SetPoint(x+4,y+0,k);
  SetPoint(x+4,y+1,k);
  SetPoint(x+4,y+2,k);
  SetPoint(x+4,y+3,k);
  // Draw Flag
  SetPoint(x+5,y+1,k);
  SetPoint(x+6,y+2,k);
  // Draw the circle
  SetPoint(x+1,y+5,k);
  SetPoint(x+1,y+6,k);
  SetPoint(x+2,y+4,k);
  SetPoint(x+2,y+5,k);
  SetPoint(x+2,y+6,k);
  SetPoint(x+2,y+7,k);
  SetPoint(x+3,y+4,k);
  SetPoint(x+3,y+5,k);
  SetPoint(x+3,y+6,k);
  SetPoint(x+3,y+7,k);
  SetPoint(x+4,y+5,k);
  SetPoint(x+4,y+6,k);
}

void Write_PanelMode(byte Mode)
{ switch (Mode)
    { case  1: { // Wite "Keys" on Displays.
                 PrintDisplay(3,'K');
                 PrintDisplay(2,'E');
                 PrintDisplay(1,'Y');
                 PrintDisplay(0,'S');
                 Init_Key();
                 PanelModeSet = 1;
                 break;
               }
      default: { // Wite "Midi" on Displays.
                 PrintDisplay(3,'M');
                 PrintDisplay(2,'I');
                 PrintDisplay(1,'D');
                 PrintDisplay(0,'I');
                 Init_Midi();
                 PanelModeSet = 0;
               }
    }
}

//==============================================================================
//==  Midi Read Functions                                                     ==
//==============================================================================

void Status(byte S0, byte S1, byte S2)
{ WriteLed(0,S0);
  WriteLed(1,S1);
  WriteLed(2,S2);
}

void Init_Midi()
{ // Some Background Lines
  for (byte qq=0; qq<64; qq=qq+1)
    { // KeyOn Off Area
      SetPoint(0 + qq, 0 + NoteY, 0x0000);
      SetPoint(0 + qq, 1 + NoteY, 0x0000);
      SetPoint(0 + qq, 2 + NoteY, 0x0000);
      SetPoint(0 + qq, 3 + NoteY, 0x0000);
      // AfterTouch
      SetPoint(0 + qq, 0 + AfterY, 0x0000);
      SetPoint(0 + qq, 1 + AfterY, 0x0000);
      // Control
      SetPoint(0 + qq, 0 + ControlY, 0x0000);
      SetPoint(0 + qq, 1 + ControlY, 0x0000);
      // Program Change BGColor
      SetPoint(0 + qq, 0 + ProgChangeY, ProgChangeBGColor);
      SetPoint(0 + qq, 1 + ProgChangeY, ProgChangeBGColor);
      // Channel AfterTouch BGColor
      SetPoint(0 + qq, 0 + ChAfterY, ChAfterBGColor);
      SetPoint(0 + qq, 1 + ChAfterY, ChAfterBGColor);
      // Pitchbend BGColor
      SetPoint(0 + qq, 0 + PitchBendY, PitchBendBGColor);
      SetPoint(0 + qq, 1 + PitchBendY, PitchBendBGColor);
    }
  // Channel BGColor
  for (byte qq=0; qq<16; qq=qq+1)
    { SetPoint(ChannelX + qq, ChannelY   , ChannelBGColor);
      SetPoint(ChannelX + qq, ChannelPotY, ChannelBGColor);
    }
  // Rhythm Leds BGColor
  for (byte qq=0; qq<24; qq=qq+1)
    { SetPoint(RhythmX + qq, RhythmY ,RhythmBGColor);
    }
  // Tempo Leds BGColor
  for (byte qq=0; qq<16; qq=qq+1)
    { SetPoint(TempoX + qq, TempoY ,TempoBGColor);
    }
}

void Init_Key()
{ // Make a wallpaper for the Key-layout
  if ( PanelModeSet != 1 )
     { for (int qy=0; qy<=7; qy=qy+1)
           { for (int qx=0; qx<=63; qx=qx+1)
                 { SetPoint(qx,qy,KeyBkGndColor);
                 }
           }
       for (int qx=0; qx<=127; qx=qx+1)
           { KeyLarge (qx, 0, 0x0000);
           }
     }
}

void Read_Midi()
{ if (Serial1.available() > 0)
     {  Activity_TimeOut = 0;
        Serial1Byte = Serial1.read();
        if (Serial1Byte & 0x80) != 0)
           { // Its a Command Byte
             if ( Serial1Byte >= 0xF0 )  // System Common Commando
                { MidiComCom = Serial1Byte;
                  DecodeComCom(MidiComCom);
                }
             else
                { MidiComCom = 0;  // Its No Common Commando, So Clear it
                  ParmCount=0;
                  // Split Channel and Command
                  MidiChannel = ( Serial1Byte & 0x0F );
                  MidiCommand = ( Serial1Byte & 0xF0 );
                  // Get the Number of Parms of the Command.
                  AantalParms = AantalMidiParms[ MidiCommand >> 4 ];
                }
           }
        else
           { // Its a Parameter Byte
             MidiComCom = 0;
             if (ParmCount < AantalParms)
                { // Count the number of Parameters
                  ParmCount = ParmCount + 1;
                  if (ParmCount == 1)
                     { MidiParm1 = Serial1Byte;  // Read First Parameter
                       MidiParm2 = 0;
                     }
                  if (ParmCount == 2)
                     { MidiParm2 = Serial1Byte;  // Read Second Parameter
                     }
                }
             if (ParmCount == AantalParms)
                { // When All Parms are read, set the counter to NUL.
                  // Maybe only Parms of the next (but same) Command is comming.
                  ParmCount = 0;
                  Status(MidiCommand,MidiParm1,MidiParm2);  // Sent (both) Parms to Front-Leds
                  Channel (MidiChannel);        // Do Channel Leds

                  // Check the Midi Channel (>=$10 is Omni)
                  if ( PickChannel >=0x10 ) || ( MidiChannel == PickChannel ) )
                     { // The Channel does match
                       DecodeCommand (MidiCommand, MidiParm1, MidiParm2);
                     }
                }
           }
     }
}

void DecodeComCom(byte ComCom)
{ switch (ComCom)
    { case 0xF0 : // System Exclusive Start
                  MidiUndefF0();
                  break;
      case 0xF1 : // Time Code
                  MidiUndefF1();
                  break;
      case 0xF2 : // Song Position
                  MidiUndefF2();
                  break;
      case 0xF3 : // Choose Song
                  MidiUndefF3();
                  break;
      case 0xF4 : // Undef
                  MidiUndefF4();
                  break;
      case 0xF5 : // Undef
                  MidiUndefF5();
                  break;
      case 0xF6 : // Tune Request
                  MidiUndefF6();
                  break;
      case 0xF7 : // System Exclusive End
                  MidiUndefF7();
                  break;
      case 0xF8 : // Timeclock
                  MidiRhythm();
                  break;
      case 0xF9 : // Undef
                  MidiUndefF9();
                  break;
      case 0xFA : // Start
                  MidiStart();
                  break;
      case 0xFB : // Continue
                  MidiContinue();
                  break;
      case 0xFC : // Stop
                  MidiStop();
                  break;
      case 0xFD : // Undef
                  MidiUndefFD();
                  break;
      case 0xFE : // Active Sensing
                  MidiActive();
                  break;
      case 0xFF : // Reset
                  MidiReset();
                  break;
    }
}

void DecodeCommand (byte Com, byte Parm1, byte Parm2)
{ switch (Com)
    { case 0x80 : // Note Off
                  NoteOff (Parm1, Parm2);
                  break;
      case 0x90 : // Note On
                  NoteOn (Parm1, Parm2);
                  break;
      case 0xA0 : // AfterTouch
                  AfterTouch (Parm1, Parm2);
                  break;
      case 0xB0 : // Control Change
                  Control (Parm1, Parm2);
                  break;
      case 0xC0 : // Program Change
                  ProgChange (Parm1, Parm2);
                  break;
      case 0xD0 : // Channel AfterTouch
                  ChAfter (Parm1, Parm2);
                  break;
      case 0xE0 : // PitchBend
                  PitchBend (Parm1, Parm2);
                  break;
    }
}

//==============================================================================
//==  Midi Note/ Music Functions                                              ==
//==============================================================================

void Channel(byte Ch)
{ // Channel
  SetPoint(ChannelX + Old_Channel, ChannelY, ChannelBGColor);
  SetPoint(ChannelX + Ch         , ChannelY, ChannelColor);
  Old_Channel = Ch;
}

void NoteOn (byte P1, byte P2)
{ // $80 Note On
  switch (PanelMode)
    { case  1: { KeyLarge (P1,P2,P2 );
                 break;
               }
      default: { NoteSmall (P1,P2,NoteColors[ P2 >> 2 ]);
               }
    }
}

void NoteOff (byte P1, byte P2)
{ // $90 Note Off
  switch (PanelMode)
    { case  1: { KeyLarge (P1,P2,0x0000);
                 break;
               }
      default: { NoteSmall (P1,P2,0x0000);
               }
    }
}

void NoteSmall (byte P1, byte P2, word CC)
{ // $80 / $90 Note On/Off - but small 2x1 lines.
  byte P1x = P1 >> 1;
  byte P1y = 2 * (( P1 & 1 ) xor 1);
  SetPoint(0 + P1x, NoteY + 0 + P1y, CC);
  SetPoint(0 + P1x, NoteY + 1 + P1y, CC);
}

void KeyLarge (byte P1, byte P2, word CC)
{ // $80 / $90 Note On/Off - but small 2x1 lines.
  P1 = P1 + KeyShiftVal;
  if (P1<0) || (P1 > KeyNum))     { return; }
  byte P1x = KeyX[ P1 ];
  byte P1y = KeyY[ P1 ];
  // Calc the color
  if ( CC > 0x0000 )
     { if (P1y <= 1)
          { // Black Key On
            CC = KeyBlackColorOn;
          }
       else
          { // White Key On
            CC = KeyWhiteColorOn;
          }
     }
  else
     { if (P1y <= 1)
          { // Black Key Off
            CC = KeyBlackColorOff;
          }
       else
          { // White Key Off
            CC = KeyWhiteColorOff;
          }
     }


  SetPoint(0 + P1x, NoteY + 0 + P1y, CC);
  SetPoint(0 + P1x, NoteY + 1 + P1y, CC);
  SetPoint(0 + P1x, NoteY + 2 + P1y, CC);
  SetPoint(0 + P1x, NoteY + 3 + P1y, CC);
  SetPoint(1 + P1x, NoteY + 0 + P1y, CC);
  SetPoint(1 + P1x, NoteY + 1 + P1y, CC);
  SetPoint(1 + P1x, NoteY + 2 + P1y, CC);
  SetPoint(1 + P1x, NoteY + 3 + P1y, CC);
}

void AfterTouch (byte P1, byte P2)
{ // $A0 AfterTouch
  switch (PanelMode)
    { case  1: {
                 break;
               }
      default: { byte P1x = P1 >> 1;
                 byte P1y = (( P1 & 1 ) xor 1);
                 SetPoint(0 + P1x, AfterY + 0 + P1y, NoteColors[ P2 >> 2 ] );
               }
    }
}

void Control (byte P1, byte P2)
{ // $B0 Control Change
  switch (PanelMode)
    { case  1: {
                 break;
               }
      default: { // Check for Special Control Messages
                 if (P1 == 0x78) || (P1 == 0x7A) || (P1 == 0x7B) )
                    { // All Notes Off
                      for ( byte qq=0; qq<=63; qq=qq+1)
                          { SetPoint(qq, NoteY + 0, 0x0000);
                            SetPoint(qq, NoteY + 1, 0x0000);
                            SetPoint(qq, NoteY + 2, 0x0000);
                            SetPoint(qq, NoteY + 3, 0x0000);
                          }
                    }
                 if (P1 == 0x79)
                    { // All Notes Off
                      for ( byte qq=0; qq<=63; qq=qq+1)
                          { SetPoint(qq, ControlY + 0, 0x0000);
                            SetPoint(qq, ControlY + 1, 0x0000);
                          }
                    }
                 byte P1x = P1 >> 1;
                 byte P1y = (( P1 & 1 ) xor 1);
                 SetPoint(0 + P1x, ControlY + 0 + P1y, NoteColors[ P2 >> 2 ] );
               }
    }
}

void ProgChange (byte P1, byte PQ)
{ // $C0 ProgramChange
  byte P1x = P1 >> 1;
  byte P1y = (( P1 & 1 ) xor 1);
  SetPoint(Old_ProgChangeX, ProgChangeY + Old_ProgChangeY , ProgChangeBGColor);
  SetPoint(0 + P1x        , ProgChangeY + P1y             , ProgChangeColor  );
  Old_ProgChangeX = P1x;
  Old_ProgChangeY = P1y;
}

void ChAfter (byte P1, byte PQ)
{ // $D0 Channel AfterTouch
  byte P1x = P1 >> 1;
  byte P1y = (( P1 & 1 ) xor 1);
  SetPoint(Old_ChAfterX, ChAfterY + Old_ChAfterY , ChAfterBGColor);
  SetPoint(0 + P1x     , ChAfterY + P1y          , ChAfterColor  );
  Old_ChAfterX = P1x;
  Old_ChAfterY = P1y;
}

void PitchBend (byte P1, byte P2)
{ // $E0 PitchBend
  byte P2x = P2 >> 1;
  byte P2y = (( P2 & 1 ) xor 1);
  SetPoint(Old_PitchBendX, PitchBendY + Old_PitchBendY , PitchBendBGColor);
  SetPoint(0 + P2x       , PitchBendY + P2y            , PitchBendColor  );
  Old_PitchBendX = P2x;
  Old_PitchBendY = P2y;
}

//==============================================================================
//==  Midi Rhythm Functions                                                   ==
//==============================================================================

void MidiUndefF0()
{ // $F0
  SetPoint(UndefF0X + Old_UndefF0_Count, UndefF0Y ,UndefF0BGColor);
  SetPoint(UndefF0X + UndefF0_Count    , UndefF0Y ,UndefF0Color  );
  Old_UndefF0_Count =  UndefF0_Count;
  if ( UndefF0_Count < 3 )  { UndefF0_Count = UndefF0_Count + 1; }
  else                      { UndefF0_Count = 0;                 }
}

void MidiUndefF1()
{ // $F1
  SetPoint(UndefF1X + Old_UndefF1_Count, UndefF1Y ,UndefF1BGColor);
  SetPoint(UndefF1X + UndefF1_Count    , UndefF1Y ,UndefF1Color  );
  Old_UndefF1_Count =  UndefF1_Count;
  if ( UndefF1_Count < 3 )  { UndefF1_Count = UndefF1_Count + 1; }
  else                      { UndefF1_Count = 0;                 }
}

void MidiUndefF2()
{ // $F2
  SetPoint(UndefF2X + Old_UndefF2_Count, UndefF2Y ,UndefF2BGColor);
  SetPoint(UndefF2X + UndefF2_Count    , UndefF2Y ,UndefF2Color  );
  Old_UndefF2_Count =  UndefF2_Count;
  if ( UndefF2_Count < 3 )  { UndefF2_Count = UndefF2_Count + 1; }
  else                      { UndefF2_Count = 0;                 }
}

void MidiUndefF3()
{ // $F3
  SetPoint(UndefF3X + Old_UndefF3_Count, UndefF3Y ,UndefF3BGColor);
  SetPoint(UndefF3X + UndefF3_Count    , UndefF3Y ,UndefF3Color  );
  Old_UndefF3_Count =  UndefF3_Count;
  if ( UndefF3_Count < 3 )  { UndefF3_Count = UndefF3_Count + 1; }
  else                      { UndefF3_Count = 0;                 }
}

void MidiUndefF4()
{ // $F4
  SetPoint(UndefF4X + Old_UndefF4_Count, UndefF4Y ,UndefF4BGColor);
  SetPoint(UndefF4X + UndefF4_Count    , UndefF4Y ,UndefF4Color  );
  Old_UndefF4_Count =  UndefF4_Count;
  if ( UndefF4_Count < 3 )  { UndefF4_Count = UndefF4_Count + 1; }
  else                      { UndefF4_Count = 0;                 }
}

void MidiUndefF5()
{ // $F5
  SetPoint(UndefF5X + Old_UndefF5_Count, UndefF5Y ,UndefF5BGColor);
  SetPoint(UndefF5X + UndefF5_Count    , UndefF5Y ,UndefF5Color  );
  Old_UndefF5_Count =  UndefF5_Count;
  if ( UndefF5_Count < 3 )  { UndefF5_Count = UndefF5_Count + 1; }
  else                      { UndefF5_Count = 0;                 }
}

void MidiUndefF6()
{ // $F6
  SetPoint(UndefF6X + Old_UndefF6_Count, UndefF6Y ,UndefF6BGColor);
  SetPoint(UndefF6X + UndefF6_Count    , UndefF6Y ,UndefF6Color  );
  Old_UndefF6_Count =  UndefF6_Count;
  if ( UndefF6_Count < 3 )  { UndefF6_Count = UndefF6_Count + 1; }
  else                      { UndefF6_Count = 0;                 }
}

void MidiUndefF7()
{ // $F7
  SetPoint(UndefF7X + Old_UndefF7_Count, UndefF7Y ,UndefF7BGColor);
  SetPoint(UndefF7X + UndefF7_Count    , UndefF7Y ,UndefF7Color  );
  Old_UndefF7_Count =  UndefF7_Count;
  if ( UndefF7_Count < 3 )  { UndefF7_Count = UndefF7_Count + 1; }
  else                      { UndefF7_Count = 0;                 }
}

void MidiRhythm()
{ // $F8 Basic Clock
  if (Rhythm_Count % 6 ) == 0)         {  MidiTempo();       }
  SetPoint(RhythmX + Old_Rhythm_Count, RhythmY ,RhythmBGColor);
  SetPoint(RhythmX + Rhythm_Count    , RhythmY ,RhythmColor  );
  Old_Rhythm_Count =  Rhythm_Count;
  if ( Rhythm_Count < 23 )  { Rhythm_Count = Rhythm_Count + 1; }
  else                      { Rhythm_Count = 0;                }
}

void MidiTempo()
{ // $F8 Extended Clock
  SetPoint(TempoX + Old_Tempo_Count, TempoY ,TempoBGColor);
  SetPoint(TempoX + Tempo_Count    , TempoY ,TempoColor  );
  Old_Tempo_Count =  Tempo_Count;
  if ( Tempo_Count < 15 )  { Tempo_Count = Tempo_Count + Tempo_Walk; }
  else                     { Tempo_Count = 0;                        }
}

void MidiUndefF9()
{ // $F9
  SetPoint(UndefF9X + Old_UndefF9_Count, UndefF9Y ,UndefF9BGColor);
  SetPoint(UndefF9X + UndefF9_Count    , UndefF9Y ,UndefF9Color  );
  Old_UndefF9_Count =  UndefF9_Count;
  if ( UndefF9_Count < 3 )  { UndefF9_Count = UndefF9_Count + 1; }
  else                      { UndefF9_Count = 0;                 }
}

void MidiStart()
{ // $FA
  for ( byte qq=0; qq<4; qq=qq+1)
    { SetPoint(TempoX -  4 + qq, TempoY ,StartColor);
      SetPoint(TempoX + 16 + qq, TempoY ,StartColor);
    }
  Rhythm_Count = 0;
  Tempo_Count  = 0;
  Tempo_Walk   = 1;
}

void MidiContinue()
{ // $FB
  for ( byte qq=0; qq<2; qq=qq+1)
    { SetPoint(TempoX -  4 + qq, TempoY ,StartColor);
      SetPoint(TempoX + 18 + qq, TempoY ,StartColor);
    }
  Tempo_Walk   = 1;
}

void MidiStop()
{ // $FC
  for ( byte qq=0; qq<4; qq=qq+1)
    { SetPoint(TempoX -  4 + qq, TempoY ,StopColor);
      SetPoint(TempoX + 16 + qq, TempoY ,StopColor);
    }
  Tempo_Walk   = 0;
}

void MidiUndefFD()
{ // $FD
  SetPoint(UndefFDX + Old_UndefFD_Count, UndefFDY ,UndefFDBGColor);
  SetPoint(UndefFDX + UndefFD_Count    , UndefFDY ,UndefFDColor  );
  Old_UndefFD_Count =  UndefFD_Count;
  if ( UndefFD_Count < 3 )  { UndefFD_Count = UndefFD_Count + 1; }
  else                      { UndefFD_Count = 0;                 }
}

void MidiActive()
{ // $FE
  SetPoint(ActiveX + Old_Active_Count, ActiveY ,ActiveBGColor);
  SetPoint(ActiveX + Active_Count    , ActiveY ,ActiveColor  );
  Old_Active_Count =  Active_Count;
  if ( Active_Count < 3 )  { Active_Count = Active_Count + 1; }
  else                     { Active_Count = 0;                }
}

void MidiReset()
{ // $FF
  SetPoint(ResetX + Old_Reset_Count, ResetY ,ResetBGColor);
  SetPoint(ResetX + Reset_Count    , ResetY ,ResetColor  );
  Old_Reset_Count =  Reset_Count;
  if ( Reset_Count < 3 )  { Reset_Count = Reset_Count + 1; }
  else                    { Reset_Count = 0;               }
}

//==============================================================================
//== Led & Display Vars and Functions                                         ==
//==============================================================================
// Led Vars
volatile byte LedData[8];    // [0..3] = Displays, [4..7] = Leds

void InitLed()
{ // Open Port to OUTPUT and Clear all displays and Leds
  PORTL = ( PORTL + 1 ) & 0xFF;
  for (byte qq=0; qq<=7; qq=qq+1)
      { // Clear al the Led/Display Data
        LedData[qq] = 0;
      }
}

void WriteLed (byte row, int data)
{ // Write DATA binairy to the Leds in the ROW [0..3]
  row = ( row & 0x03 ) | 0x04;
  data = data & 0xFF;
  LedData[row] = data;
}

void WriteDisplay (byte row, int data)
{ // Write DATA binairy to the Display ROW [3,2,1,0]
  row = ( row & 0x03 );
  data = data & 0xFF;
  LedData[row] = data;
}

void PrintDisplay (byte row, int data)
{ // Print the 7-segment number DATA tot Displayt ROW [3,2,1,0]
  row = ( row & 0x03 );
  data = data & 0xFF;
  if ( data <= dispfontchars )
     { word dispbyte=pgm_read_byte_near(dispfont+data);
       LedData[row] = dispbyte;
     }
  else
     { LedData[row] = 0;
     }
}

void ClrDisplay()
{ // Clear only all the Displays
  LedData[0] = 0;
  LedData[1] = 0;
  LedData[2] = 0;
  LedData[3] = 0;
}

void ClrLed()
{ // Clear only all the Leds
  LedData[4] = 0;
  LedData[5] = 0;
  LedData[6] = 0;
  LedData[7] = 0;
}

void DisplayHex(word waarde)
{ // Display WAARDE as a 4-digit hexa-decimal number on the Displays
  PrintDisplay(0,( waarde & 0x000F ) );
  PrintDisplay(1,( waarde & 0x00F0 ) >>  4 );
  PrintDisplay(2,( waarde & 0x0F00 ) >>  8 );
  PrintDisplay(3,( waarde & 0xF000 ) >> 12 );
}

//==============================================================================
//==  Matrix Panel Vars and Functions                                         ==
//==============================================================================
// Paneel Vars.
const byte MaxCol = 64;
const byte MaxRow = 16;
volatile byte PanelData [MaxCol][8][3];   // = [00..63],[0..7],[0..2] of (Rl Gl Bl Ru Gu Bu 0 0)
volatile byte RowCount = 0;
// Brightness Vars.
const byte MaxBrightCount = 9;    // Count 1..MaxBrightCount
const byte BrightRow [MaxBrightCount]  = { 0,2,2,1,2,2,1,2,2}; // Counter Conversion for Binairy Code Modulation.
volatile byte BrightCount =  0;
// BackGround-Color (format: 0x0RGB = B 0000 RRRR GGGG BBBB)
word _bgcolor = 0x0000;
// Font Vars
const byte _bitjes[8] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 };
word _fontcolor = 0x0333;
byte _fontreverse = 0;
byte _fonttransparant = 0;
int _font_x = 0;
int _font_y = 0;

// RGB Pin Definitions - All Pins are hardcoded to speed things up.
// const int b1  = 24;  // Blue 1  - Port A
// const int g1  = 25;  // Green 1 - Port A
// const int r1  = 26;  // Red 1   - Port A
// const int b2  = 27;  // Blue 2  - Port A
// const int g2  = 28;  // Green 2 - Port A
// const int r2  = 29;  // Red 2   - Port A

// const int a   = 37;  // Address A (A0)  - Port C
// const int b   = 36;  // Address B (A1)  - Port C
// const int c   = 35;  // Address C (A2)  - Port C
// const int clk = 33;  // Clock panel     - Port C
// const int lat = 32;  // Latch Panel     - Port C
// const int oep = 31;  // outEnable Panel - Port C
// const int oel = 30;  // outEnable Leds  - Port C

void InitPan(word _k)
// Initializing the Panel
// Input: _k = BackGround-Color (format: 0x0RGB = B 0000 0RRR 0GGG 0BBB)
{ // Put Pins to Output
  DDRA = 0xFF;      // Panel Data All Output
  DDRL = 0xFF;      // Led Data   All Output
  DDRC = 0xFF;      // Addr Ctrl  All Output
  InitLed();
  Setbgcolor(_k);
  ClrPan();
  InitTimer();
}

void InitTimer()
{ // Initialize Timer1
  cli();                        // Disable Interrupts
  // Timer Counter Control Registers 1A & 1B
  TCCR1A = 0;                   // Make all bits of this register to 0
  TCCR1B = 0;                   // Make all bits of this register to 0

  OCR1A = 3900;                 // set Output Compare Register 1 to the desired timer count
  TCCR1B = TCCR1B | B00001000;  // turn on CTC mode (WGM12 = bit 3 - Waveform Generation Mode)
  TCCR1B = TCCR1B | B00000001;  // Set the Prescaler (CS12 CS11 CS10 = bit 2..0 - Clock Select)

  TIMSK1 = TIMSK1 | B00000010;  // set Timer Interupt MaSK 1 to compare interrupt
  // (OCIE1A = bit 1 - Output Compare match Interrupt Enable 1A)
  sei();                        // Enable Interrupts
}

void Setbgcolor(word _k)
// Set the BackGround-Color (format: 0x0RGB = B 0000 0RRR 0GGG 0BBB)
{ _bgcolor = _k & 0x0777;
}

word bgcolor(void)
{ return _bgcolor;
}

void ClrPan()
// Clear the Panel with bgcolor
{ byte _lc = (  LowColor(bgcolor()) * 9 ) << 2;
  byte _mc = (  MidColor(bgcolor()) * 9 ) << 2;
  byte _hc = ( HighColor(bgcolor()) * 9 ) << 2;
  for (byte ww=0; ww<8; ww=ww+1)
      { for (byte qq=0; qq<MaxCol; qq=qq+1)
            { PanelData [qq][ww][0] = _lc;
              PanelData [qq][ww][1] = _mc;
              PanelData [qq][ww][2] = _hc;
            }
      }
_fontreverse = 0;
_fonttransparant = 0;
_font_x = 0;
_font_y = 0;
}

byte LowColor (word _k)
// Get the LowColor rgb from 0000 0RRR 0GGG 0BBB
{ return (( _k & 0x0100 ) >> 6 ) + (( _k & 0x0010 ) >> 3 ) + (( _k & 0x0001 )      );
}

byte MidColor (word _k)
// Get the MidColor RGB from 0000 0RRR 0GGG 0BBB
{ return (( _k & 0x0200 ) >> 7 ) + (( _k & 0x0020 ) >> 4 ) + (( _k & 0x0002 ) >> 1 );
}

byte HighColor (word _k)
// Get the HighColor RGB from 0000 0RRR 0GGG 0BBB
{ return (( _k & 0x0400 ) >> 8 ) + (( _k & 0x0040 ) >> 5 ) + (( _k & 0x0004 ) >> 2 );
}

word Dec2RGB (word _k)
// Convert a decimal color into a hex RGB-color 0000 0RRR 0GGG 0BBB
{ return (( _k & 0x01C0 ) << 2 ) + (( _k & 0x0038 ) << 1 ) + ( _k & 0x0007 );
}

void SetPoint (int _x, int _y, word _k)
// Let one Led lit at the (x;y) position
{ if (( _x < 0 ) || ( _x >= MaxCol ))   { return; }   // _x is outside the panel
  if (( _y < 0 ) || ( _y >= MaxRow ))   { return; }   // _y is outside the panel
  _y = _y ^ 0x0F;
  byte _y7 = _y & 0x07;
  _k = _k & 0x0777;
  byte _lc =  LowColor(_k);
  byte _mc =  MidColor(_k);
  byte _hc = HighColor(_k);
  // Put The Pixel On The Right Spot.
  if (( _y & 0x08 ) == 0 )
     { // This is the Upper-half
       PanelData[_x][_y7][0] = ( PanelData[_x][_y7][0] & B11100000 ) | ( _lc << 2 );
       PanelData[_x][_y7][1] = ( PanelData[_x][_y7][1] & B11100000 ) | ( _mc << 2 );
       PanelData[_x][_y7][2] = ( PanelData[_x][_y7][2] & B11100000 ) | ( _hc << 2 );
     }
  else
     { // This is the Lower half.
       PanelData[_x][_y7][0] = ( PanelData[_x][_y7][0] & B00011100 ) | ( _lc << 5 );
       PanelData[_x][_y7][1] = ( PanelData[_x][_y7][1] & B00011100 ) | ( _mc << 5 );
       PanelData[_x][_y7][2] = ( PanelData[_x][_y7][2] & B00011100 ) | ( _hc << 5 );
     }
}

//--------[ Font Functions ]---------------------------------------------------

void GotoXY (int _x, int _y)
{ _font_x = _x;
  _font_y = _y;
}

void NextXY ()
{ // Set the (_font_x;_font_y) to the next char-position.
  // Do an <LF><CR> at the end of the line;
  _font_x = _font_x + 8;
  if ( _font_x >= MaxCol )
     { _font_x = _font_x - MaxCol;
       _font_y = _font_y + charbytes;
       if (_font_y >= MaxRow)
          { _font_y = _font_y - MaxRow;
          }
     }
}

void ReverseChar ()
{ _fontreverse = 0xFF;
}

void NormalChar ()
{ _fontreverse = 0;
}

void SetReverse (byte _bits)
{ _fontreverse = (_bits & 0xFF);
}

void TransparantChar ()
{ _fonttransparant = 0xFF;
}

void SolidChar ()
{ _fonttransparant = 0;
}

void SetTransparance (byte _bits)
{ _fonttransparant = (_bits & 0xFF);
}

void CharColor (word _kk)
{ _fontcolor = _kk;
}

void WriteChar (word ch)
{ // Writes 1 character ch at position (_font_x;_font_y) in the color _fontcolor
  // If nescesary, xor it with _fontreverse
  // move _font_x to 8 point to the right
  if ( ch>=fontchars )
     { return; }    // Char does not exist in font.
  word _ch=ch*charbytes;
  for (byte qy=0; qy<charbytes; qy=qy+1)
      { word charbyte=pgm_read_byte_near(font+_ch+qy) xor _fontreverse;
        for (byte qx=0; qx<8; qx=qx+1)
            { if ((charbyte & 128)>0)        // Look at MSB-point of charbyte
                 { // if (1) then draw pixel
                   SetPoint (_font_x+qx,_font_y+qy,_fontcolor);
                 }
              else
                 { // if (0) then draw bgcolor
                   if (_fonttransparant & _bitjes[qx]) == 0)
                      { // But only if not Transparant (= 0)
                        SetPoint (_font_x+qx,_font_y+qy,_bgcolor);
                      }
                 }
              charbyte=charbyte<<1;
            }
      }
  NextXY();
}

void PrintChar(char* ss)
{ // Print a character, after conversing it from ascii to font-character
  byte qq = 0;
  while ( ss[qq] != '\0' )
    { // chech every char if it is in the table.
      char cc=ss[qq];
      if (( cc>=asctableshift ) &&         // Char is above the bottom
          ( cc< asctablechars+asctableshift ) // Char is below the top
         )

         { // Find the char in the ascii-table to get the right number in the font.
           word _cc=pgm_read_byte_near(asc2font+cc - asctableshift);
           WriteChar (_cc);
         }
      qq=qq+1;
    }
}

//--------[ The Interupt Function ]--------------------------------------------

ISR(TIMER1_COMPA_vect)
// De Interrupt Service Routine
// The main interupt-routine. Do One Row (at each Interupt)
{
  byte rc = MaxCol;
  byte BrightLayer = BrightRow[BrightCount];
  byte _clock_rise = PORTC | B00010000;  // value for Clk HIGH
  byte _clock_fall = PORTC & B11101111;  // value for Clk LOW
  byte _data_serial = ( PORTA & B00000011 );
  do { rc=rc-1;
       // Send the RGB to the RGB-lines
       PORTA = _data_serial | PanelData[rc][RowCount][BrightLayer];
       // Clock the RGB
       PORTC = _clock_rise;
       PORTC = _clock_fall;
     }
  while (rc>0);
  // Make it Invisible
  PORTC = PORTC | B11000000;             // OeP & OeL HIGH
  // Display Led & Display data
  PORTL = LedData[RowCount];
  // Select the Row on the panels.
  PORTC = ( PORTC & B11111000 ) | RowCount;
  // Latch the Data
  PORTC = PORTC | B00100000;             // Latch HIGH
  PORTC = PORTC & B11011111;             // Latch LOW
  // Make it Visible again
  PORTC = PORTC & B00111111;             // OeP & OeL LOW
  // Next Row
  RowCount = RowCount + 1;     // Count the Row
  if ( RowCount >= 8 )
     { RowCount = 0;
       BrightCount = BrightCount + 1;    // Inc the Brightness counter
       if ( BrightCount >= MaxBrightCount )
          { BrightCount = 0;
          }
     }
}

//-----------------------------------------------------------------------------

==================================================================================================================
==================================================================================================================
//     ---------------------------------------------------------
//     |  RGBMatrix : Cbm-Font Definitions and ASCII-table     |
//     ---------------------------------------------------------

#ifndef CBMFONT_H
#define CBMFONT_H

// Next 2 lines is needed for PROGMEM and pgm_read_byte_near-function
#include <avr/io.h>
#include <avr/pgmspace.h>

// Number of bytes per character
#define charbytes   8
// Number of chars in this font
#define fontchars 256
// Cbm64 Font 8x8
static const unsigned char font[ fontchars * charbytes ] PROGMEM =
      { // UPPER-case & Graphics & More Graphics
        0x3C, 0x66, 0x6E, 0x6E, 0x60, 0x62, 0x3C, 0x00,  // $00 @
        0x18, 0x3C, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00,  // $01 A
        0x7C, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x7C, 0x00,  // $02 B
        0x3C, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3C, 0x00,  // $03 C
        0x78, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0x78, 0x00,  // $04 D
        0x7E, 0x60, 0x60, 0x78, 0x60, 0x60, 0x7E, 0x00,  // $05 E
        0x7E, 0x60, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00,  // $06 F
        0x3C, 0x66, 0x60, 0x6E, 0x66, 0x66, 0x3C, 0x00,  // $07 G
        0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00,  // $08 H
        0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00,  // $09 I
        0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x6C, 0x38, 0x00,  // $0A J
        0x66, 0x6C, 0x78, 0x70, 0x78, 0x6C, 0x66, 0x00,  // $0B K
        0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7E, 0x00,  // $0C L
        0x63, 0x77, 0x7F, 0x6B, 0x63, 0x63, 0x63, 0x00,  // $0D M
        0x66, 0x76, 0x7E, 0x7E, 0x6E, 0x66, 0x66, 0x00,  // $0E N
        0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00,  // $0F O

        0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60, 0x60, 0x00,  // $10 P
        0x3C, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x0E, 0x00,  // $11 Q
        0x7C, 0x66, 0x66, 0x7C, 0x78, 0x6C, 0x66, 0x00,  // $12 R
        0x3C, 0x66, 0x60, 0x3C, 0x06, 0x66, 0x3C, 0x00,  // $13 S
        0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00,  // $14 T
        0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00,  // $15 U
        0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00,  // $16 V
        0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00,  // $17 W
        0x66, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x66, 0x00,  // $18 X
        0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x00,  // $19 Y
        0x7E, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x7E, 0x00,  // $1A Z
        0x3C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3C, 0x00,  // $1B [
        0x0C, 0x12, 0x30, 0x7C, 0x30, 0x62, 0xFC, 0x00,  // $1C Pond
        0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3C, 0x00,  // $1D ]

        0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18,  // $1E Up
        0x00, 0x10, 0x30, 0x7F, 0x7F, 0x30, 0x10, 0x00,  // $1F Left

        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // $20 <Space>
        0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x00,  // $21 !
        0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00,  // $22 "
        0x66, 0x66, 0xFF, 0x66, 0xFF, 0x66, 0x66, 0x00,  // $23 #
        0x18, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x18, 0x00,  // $24 $
        0x62, 0x66, 0x0C, 0x18, 0x30, 0x66, 0x46, 0x00,  // $25 %
        0x3C, 0x66, 0x3C, 0x38, 0x67, 0x66, 0x3F, 0x00,  // $26 &
        0x06, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,  // $27 '
        0x0C, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x00,  // $28 (
        0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00,  // $29 )

        0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00,  // $2A *
        0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00,  // $2B +
        0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30,  // $2C ,
        0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00,  // $2D -
        0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00,  // $2E .
        0x00, 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00,  // $2F /

        0x3C, 0x66, 0x6E, 0x76, 0x66, 0x66, 0x3C, 0x00,  // $30 0
        0x18, 0x18, 0x38, 0x18, 0x18, 0x18, 0x7E, 0x00,  // $31 1
        0x3C, 0x66, 0x06, 0x0C, 0x30, 0x60, 0x7E, 0x00,  // $32 2
        0x3C, 0x66, 0x06, 0x1C, 0x06, 0x66, 0x3C, 0x00,  // $33 3
        0x06, 0x0E, 0x1E, 0x66, 0x7F, 0x06, 0x06, 0x00,  // $34 4
        0x7E, 0x60, 0x7C, 0x06, 0x06, 0x66, 0x3C, 0x00,  // $35 5
        0x3C, 0x66, 0x60, 0x7C, 0x66, 0x66, 0x3C, 0x00,  // $36 6
        0x7E, 0x66, 0x0C, 0x18, 0x18, 0x18, 0x18, 0x00,  // $37 7
        0x3C, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x3C, 0x00,  // $38 8
        0x3C, 0x66, 0x66, 0x3E, 0x06, 0x66, 0x3C, 0x00,  // $39 9
        0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00,  // $3A :
        0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30,  // $3B ;
        0x0E, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0E, 0x00,  // $3C <
        0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00,  // $3D =
        0x70, 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x70, 0x00,  // $3E >
        0x3C, 0x66, 0x06, 0x0C, 0x18, 0x00, 0x18, 0x00,  // $3F ?

        0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00,  // $40 Graf-Hori
        0x08, 0x1C, 0x3E, 0x7F, 0x7F, 0x1C, 0x3E, 0x00,  // $41 Graf-A
        0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,  // $42 Graf-B
        0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00,  // $43 Graf-C
        0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,  // $44 Graf-D
        0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,  // $45 Graf-E
        0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00,  // $46 Graf-F
        0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,  // $47 Graf-G
        0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C,  // $48 Graf-H
        0x00, 0x00, 0x00, 0xE0, 0xF0, 0x38, 0x18, 0x18,  // $49 Graf-I
        0x18, 0x18, 0x1C, 0x0F, 0x07, 0x00, 0x00, 0x00,  // $4A Graf-J
        0x18, 0x18, 0x38, 0xF0, 0xE0, 0x00, 0x00, 0x00,  // $4B Graf-K
        0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xFF, 0xFF,  // $4C Graf-L
        0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0x07, 0x03,  // $4D Graf-M
        0x03, 0x07, 0x0E, 0x1C, 0x38, 0x70, 0xE0, 0xC0,  // $4E Graf-N
        0xFF, 0xFF, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,  // $4F Graf-O

        0xFF, 0xFF, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,  // $50 Graf-P
        0x00, 0x3C, 0x7E, 0x7E, 0x7E, 0x7E, 0x3C, 0x00,  // $51 Graf-Q
        0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00,  // $52 Graf-R
        0x36, 0x7F, 0x7F, 0x7F, 0x3E, 0x1C, 0x08, 0x00,  // $53 Graf-S
        0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x60,  // $54 Graf-T
        0x00, 0x00, 0x00, 0x07, 0x0F, 0x1C, 0x18, 0x18,  // $55 Graf-U
        0xC3, 0xE7, 0x7E, 0x3C, 0x3C, 0x7E, 0xE7, 0xC3,  // $56 Graf-V
        0x00, 0x3C, 0x7E, 0x66, 0x66, 0x7E, 0x3C, 0x00,  // $57 Graf-W
        0x18, 0x18, 0x66, 0x66, 0x18, 0x18, 0x3C, 0x00,  // $58 Graf-X
        0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06,  // $59 Graf-Y
        0x08, 0x1C, 0x3E, 0x7F, 0x3E, 0x1C, 0x08, 0x00,  // $5A Graf-Z
        0x18, 0x18, 0x18, 0xFF, 0xFF, 0x18, 0x18, 0x18,  // $5B Graf-+
        0xC0, 0xC0, 0x30, 0x30, 0xC0, 0xC0, 0x30, 0x30,  // $5C Graf-
        0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,  // $5D Graf-
        0x00, 0x00, 0x03, 0x3E, 0x76, 0x36, 0x36, 0x00,  // $5E Pi
        0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01,  // $5F Graf-

        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // $60 Space
        0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,  // $61 Graf-
        0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,  // $62 Graf-
        0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // $63 Graf-
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,  // $64 Graf-
        0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,  // $65 Graf-
        0xCC, 0xCC, 0x33, 0x33, 0xCC, 0xCC, 0x33, 0x33,  // $66 Graf-
        0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,  // $67 Graf-
        0x00, 0x00, 0x00, 0x00, 0xCC, 0xCC, 0x33, 0x33,  // $68 Graf-
        0xFF, 0xFE, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0, 0x80,  // $69 Graf-
        0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,  // $6A Graf-
        0x18, 0x18, 0x18, 0x1F, 0x1F, 0x18, 0x18, 0x18,  // $6B Graf-
        0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,  // $6C Graf-
        0x18, 0x18, 0x18, 0x1F, 0x1F, 0x00, 0x00, 0x00,  // $6D Graf-
        0x00, 0x00, 0x00, 0xF8, 0xF8, 0x18, 0x18, 0x18,  // $6E Graf-
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,  // $6F Graf-

        0x00, 0x00, 0x00, 0x1F, 0x1F, 0x18, 0x18, 0x18,  // $70 Graf-
        0x18, 0x18, 0x18, 0xFF, 0xFF, 0x00, 0x00, 0x00,  // $71 Graf-
        0x00, 0x00, 0x00, 0xFF, 0xFF, 0x18, 0x18, 0x18,  // $72 Graf-
        0x18, 0x18, 0x18, 0xF8, 0xF8, 0x18, 0x18, 0x18,  // $73 Graf-
        0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,  // $74 Graf-
        0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0,  // $75 Graf-
        0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,  // $76 Graf-
        0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // $77 Graf-
        0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,  // $78 Graf-
        0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF,  // $79 Graf-
        0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0xFF, 0xFF,  // $7A Graf-
        0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,  // $7B Graf-
        0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,  // $7C Graf-
        0x18, 0x18, 0x18, 0xF8, 0xF8, 0x00, 0x00, 0x00,  // $7D Graf-
        0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,  // $7E Graf-
        0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,  // $7F Graf-

        // Lower-case & UPPER-case & Graphics
        0x3C, 0x66, 0x6E, 0x6E, 0x60, 0x62, 0x3C, 0x00,  // $80 @
        0x00, 0x00, 0x3C, 0x06, 0x3E, 0x66, 0x3E, 0x00,  // $81 a
        0x00, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x7C, 0x00,  // $82 b
        0x00, 0x00, 0x3C, 0x60, 0x60, 0x60, 0x3C, 0x00,  // $83 c
        0x00, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3E, 0x00,  // $84 d
        0x00, 0x00, 0x3C, 0x66, 0x7E, 0x60, 0x3C, 0x00,  // $85 e
        0x00, 0x0E, 0x18, 0x3E, 0x18, 0x18, 0x18, 0x00,  // $86 f
        0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x7C,  // $87 g
        0x00, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x66, 0x00,  // $88 h
        0x00, 0x18, 0x00, 0x38, 0x18, 0x18, 0x3C, 0x00,  // $89 i
        0x00, 0x06, 0x00, 0x06, 0x06, 0x06, 0x06, 0x3C,  // $8A j
        0x00, 0x60, 0x60, 0x6C, 0x78, 0x6C, 0x66, 0x00,  // $8B k
        0x00, 0x38, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00,  // $8C l
        0x00, 0x00, 0x66, 0x7F, 0x7F, 0x6B, 0x63, 0x00,  // $8D m
        0x00, 0x00, 0x7C, 0x66, 0x66, 0x66, 0x66, 0x00,  // $8E n
        0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00,  // $8F o

        0x00, 0x00, 0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60,  // $90 p
        0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x06,  // $91 q
        0x00, 0x00, 0x7C, 0x66, 0x60, 0x60, 0x60, 0x00,  // $92 r
        0x00, 0x00, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x00,  // $93 s
        0x00, 0x18, 0x7E, 0x18, 0x18, 0x18, 0x0E, 0x00,  // $94 t
        0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x00,  // $95 u
        0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00,  // $96 v
        0x00, 0x00, 0x63, 0x6B, 0x7F, 0x3E, 0x36, 0x00,  // $97 w
        0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x00,  // $98 x
        0x00, 0x00, 0x66, 0x66, 0x66, 0x3E, 0x0C, 0x78,  // $99 y
        0x00, 0x00, 0x7E, 0x0C, 0x18, 0x30, 0x7E, 0x00,  // $9A z
        0x3C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3C, 0x00,  // $9B [
        0x0C, 0x12, 0x30, 0x7C, 0x30, 0x62, 0xFC, 0x00,  // $9C Pond
        0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3C, 0x00,  // $9D ]

        0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18,  // $9E Up
        0x00, 0x10, 0x30, 0x7F, 0x7F, 0x30, 0x10, 0x00,  // $9F Left

        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // $A0 <Space>
        0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x18, 0x00,  // $A1 !
        0x66, 0x66, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00,  // $A2 "
        0x66, 0x66, 0xFF, 0x66, 0xFF, 0x66, 0x66, 0x00,  // $A3 #
        0x18, 0x3E, 0x60, 0x3C, 0x06, 0x7C, 0x18, 0x00,  // $A4 $
        0x62, 0x66, 0x0C, 0x18, 0x30, 0x66, 0x46, 0x00,  // $A5 %
        0x3C, 0x66, 0x3C, 0x38, 0x67, 0x66, 0x3F, 0x00,  // $A6 &
        0x06, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,  // $A7 '
        0x0C, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x00,  // $A8 (
        0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x18, 0x30, 0x00,  // $A9 )

        0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00,  // $AA *
        0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00,  // $AB +
        0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30,  // $AC ,
        0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00,  // $AD -
        0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00,  // $AE .
        0x00, 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x00,  // $AF /

        0x3C, 0x66, 0x6E, 0x76, 0x66, 0x66, 0x3C, 0x00,  // $B0 0
        0x18, 0x18, 0x38, 0x18, 0x18, 0x18, 0x7E, 0x00,  // $B1 1
        0x3C, 0x66, 0x06, 0x0C, 0x30, 0x60, 0x7E, 0x00,  // $B2 2
        0x3C, 0x66, 0x06, 0x1C, 0x06, 0x66, 0x3C, 0x00,  // $B3 3
        0x06, 0x0E, 0x1E, 0x66, 0x7F, 0x06, 0x06, 0x00,  // $B4 4
        0x7E, 0x60, 0x7C, 0x06, 0x06, 0x66, 0x3C, 0x00,  // $B5 5
        0x3C, 0x66, 0x60, 0x7C, 0x66, 0x66, 0x3C, 0x00,  // $B6 6
        0x7E, 0x66, 0x0C, 0x18, 0x18, 0x18, 0x18, 0x00,  // $B7 7
        0x3C, 0x66, 0x66, 0x3C, 0x66, 0x66, 0x3C, 0x00,  // $B8 8
        0x3C, 0x66, 0x66, 0x3E, 0x06, 0x66, 0x3C, 0x00,  // $B9 9
        0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x00, 0x00,  // $BA :
        0x00, 0x00, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30,  // $BB ;
        0x0E, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0E, 0x00,  // $BC <
        0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00,  // $BD =
        0x70, 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x70, 0x00,  // $BE >
        0x3C, 0x66, 0x06, 0x0C, 0x18, 0x00, 0x18, 0x00,  // $BF ?

        0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00,  // $C0 Graf-Hori
        0x18, 0x3C, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00,  // $C1 A
        0x7C, 0x66, 0x66, 0x7C, 0x66, 0x66, 0x7C, 0x00,  // $C2 B
        0x3C, 0x66, 0x60, 0x60, 0x60, 0x66, 0x3C, 0x00,  // $C3 C
        0x78, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0x78, 0x00,  // $C4 D
        0x7E, 0x60, 0x60, 0x78, 0x60, 0x60, 0x7E, 0x00,  // $C5 E
        0x7E, 0x60, 0x60, 0x78, 0x60, 0x60, 0x60, 0x00,  // $C6 F
        0x3C, 0x66, 0x60, 0x6E, 0x66, 0x66, 0x3C, 0x00,  // $C7 G
        0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00,  // $C8 H
        0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00,  // $C9 I
        0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x6C, 0x38, 0x00,  // $CA J
        0x66, 0x6C, 0x78, 0x70, 0x78, 0x6C, 0x66, 0x00,  // $CB K
        0x60, 0x60, 0x60, 0x60, 0x60, 0x60, 0x7E, 0x00,  // $CC L
        0x63, 0x77, 0x7F, 0x6B, 0x63, 0x63, 0x63, 0x00,  // $CD M
        0x66, 0x76, 0x7E, 0x7E, 0x6E, 0x66, 0x66, 0x00,  // $CE N
        0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00,  // $CF O

        0x7C, 0x66, 0x66, 0x7C, 0x60, 0x60, 0x60, 0x00,  // $D0 P
        0x3C, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x0E, 0x00,  // $D1 Q
        0x7C, 0x66, 0x66, 0x7C, 0x78, 0x6C, 0x66, 0x00,  // $D2 R
        0x3C, 0x66, 0x60, 0x3C, 0x06, 0x66, 0x3C, 0x00,  // $D3 S
        0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00,  // $D4 T
        0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00,  // $D5 U
        0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00,  // $D6 V
        0x63, 0x63, 0x63, 0x6B, 0x7F, 0x77, 0x63, 0x00,  // $D7 W
        0x66, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x66, 0x00,  // $D8 X
        0x66, 0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x00,  // $D9 Y
        0x7E, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x7E, 0x00,  // $DA Z
        0x18, 0x18, 0x18, 0xFF, 0xFF, 0x18, 0x18, 0x18,  // $DB Graf-+
        0xC0, 0xC0, 0x30, 0x30, 0xC0, 0xC0, 0x30, 0x30,  // $DC Graf-
        0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18,  // $DD Graf-
        0x33, 0x33, 0xCC, 0xCC, 0x33, 0x33, 0xCC, 0xCC,  // $DE Pi
        0x33, 0x99, 0xCC, 0x66, 0x33, 0x99, 0xCC, 0x66,  // $DF Graf-

        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // $E0 Space
        0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,  // $E1 Graf-
        0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,  // $E2 Graf-
        0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // $E3 Graf-
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,  // $E4 Graf-
        0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,  // $E5 Graf-
        0xCC, 0xCC, 0x33, 0x33, 0xCC, 0xCC, 0x33, 0x33,  // $E6 Graf-
        0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,  // $E7 Graf-
        0x00, 0x00, 0x00, 0x00, 0xCC, 0xCC, 0x33, 0x33,  // $E8 Graf-
        0xCC, 0x99, 0x33, 0x66, 0xCC, 0x99, 0x33, 0x66,  // $E9 Graf-
        0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,  // $EA Graf-
        0x18, 0x18, 0x18, 0x1F, 0x1F, 0x18, 0x18, 0x18,  // $EB Graf-
        0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,  // $EC Graf-
        0x18, 0x18, 0x18, 0x1F, 0x1F, 0x00, 0x00, 0x00,  // $ED Graf-
        0x00, 0x00, 0x00, 0xF8, 0xF8, 0x18, 0x18, 0x18,  // $EE Graf-
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,  // $EF Graf-

        0x00, 0x00, 0x00, 0x1F, 0x1F, 0x18, 0x18, 0x18,  // $F0 Graf-
        0x18, 0x18, 0x18, 0xFF, 0xFF, 0x00, 0x00, 0x00,  // $F1 Graf-
        0x00, 0x00, 0x00, 0xFF, 0xFF, 0x18, 0x18, 0x18,  // $F2 Graf-
        0x18, 0x18, 0x18, 0xF8, 0xF8, 0x18, 0x18, 0x18,  // $F3 Graf-
        0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,  // $F4 Graf-
        0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0, 0xE0,  // $F5 Graf-
        0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,  // $F6 Graf-
        0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  // $F7 Graf-
        0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00,  // $F8 Graf-
        0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF,  // $F9 Graf-
        0x01, 0x03, 0x06, 0x6C, 0x78, 0x70, 0x60, 0x00,  // $FA Graf-
        0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,  // $FB Graf-
        0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,  // $FC Graf-
        0x18, 0x18, 0x18, 0xF8, 0xF8, 0x00, 0x00, 0x00,  // $FD Graf-
        0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,  // $FE Graf-
        0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,  // $FF Graf-
      };

//--------[ ASCII-table to get the right font-char ]---------------------------

// Number of chars in this table
#define asctablechars 96
// Number to add for first char
#define asctableshift 32
static const unsigned char asc2font[ 96 ] PROGMEM =
      { // Charnr = [ASCII]
         0x20, // $20  <Space>
         0x21, // $21  !
         0x22, // $22  "
         0x23, // $23  #
         0x24, // $24  $
         0x25, // $25  %
         0x26, // $26  &
         0x27, // $27  '
         0x28, // $28  (
         0x29, // $29  )

         0x2A, // $2A  *
         0x2B, // $2B  +
         0x2C, // $2C  ,
         0x2D, // $2D  -
         0x2E, // $2E  .
         0x2F, // $2F  /

         0x30, // $30  0
         0x31, // $31  1
         0x32, // $32  2
         0x33, // $33  3
         0x34, // $34  4
         0x35, // $35  5
         0x36, // $36  6
         0x37, // $37  7
         0x38, // $38  8
         0x39, // $39  9
         0x3A, // $3A  :
         0x3B, // $3B  ;
         0x3C, // $3C  <
         0x3D, // $3D  =
         0x3E, // $3E  >
         0x3F, // $3F  ?

         0x00, // $40  @
         0x01, // $41  A
         0x02, // $42  B
         0x03, // $43  C
         0x04, // $44  D
         0x05, // $45  E
         0x06, // $46  F
         0x07, // $47  G
         0x08, // $48  H
         0x09, // $49  I
         0x0A, // $4A  J
         0x0B, // $4B  K
         0x0C, // $4C  L
         0x0D, // $4D  M
         0x0E, // $4E  N
         0x0F, // $4F  O

         0x10, // $50  P
         0x11, // $51  Q
         0x12, // $52  R
         0x13, // $53  S
         0x14, // $54  T
         0x15, // $55  U
         0x16, // $56  V
         0x17, // $57  W
         0x18, // $58  X
         0x19, // $59  Y
         0x1A, // $5A  Z
         0x1B, // $5B  [
         0x1C, // $5C  \   Pond
         0x1D, // $5D  ]

         0x1E, // $5E  ^   Up
         0x1F, // $5F  _   Left

         0x80, // $60  `   @
         0x81, // $61  a
         0x82, // $62  b
         0x83, // $63  c
         0x84, // $64  d
         0x85, // $65  e
         0x86, // $66  f
         0x87, // $67  g
         0x88, // $68  h
         0x89, // $69  i
         0x8A, // $6A  j
         0x8B, // $6B  k
         0x8C, // $6C  l
         0x8D, // $6D  m
         0x8E, // $6E  n
         0x8F, // $6F  o

         0x90, // $70  p
         0x91, // $71  q
         0x92, // $72  r
         0x93, // $73  s
         0x94, // $74  t
         0x95, // $75  u
         0x96, // $76  v
         0x97, // $77  w
         0x98, // $78  x
         0x99, // $79  y
         0x9A, // $7A  z
         0x9B, // $7B  {   [
         0x9C, // $7C  |   Pond
         0x9D, // $7D  }   ]

         0x9E, // $7E  ~   Up
         0x20, // $7F      Left
      };

#endif // CBMFONT_H

==================================================================================================================
==================================================================================================================
//     ---------------------------------------------------------
//     |  RGBMatrix : 7-segment-Font Definitions               |
//     ---------------------------------------------------------

#ifndef SEGMENT7_H
#define SEGMENT7_H

// Next 2 lines is needed for PROGMEM and pgm_read_byte_near-function
#include <avr/io.h>
#include <avr/pgmspace.h>

// Number of bytes per character
#define dispcharbytes   1
// Number of chars in this font
#define dispfontchars 128
// 7-Segment Font
static const unsigned char dispfont[ dispfontchars * dispcharbytes ] PROGMEM =
      { // Hexa-Decimal Numbers
        0x3F,  // $00 0
        0x06,  // $01 1
        0x5B,  // $02 2
        0x4F,  // $03 3
        0x66,  // $04 4
        0x6D,  // $05 5
        0x7D,  // $06 6
        0x27,  // $07 7
        0x7F,  // $08 8
        0x6F,  // $09 9
        0x77,  // $0A A
        0x7C,  // $0B B
        0x39,  // $0C C
        0x5E,  // $0D D
        0x79,  // $0E E
        0x71,  // $0F F

        0x00,  // $10 <Space>
        0x00,  // $11 <Space>
        0x00,  // $12 <Space>
        0x00,  // $13 <Space>
        0x00,  // $14 <Space>
        0x00,  // $15 <Space>
        0x00,  // $16 <Space>
        0x00,  // $17 <Space>
        0x00,  // $18 <Space>
        0x00,  // $19 <Space>
        0x00,  // $1A <Space>
        0x00,  // $1B <Space>
        0x00,  // $1C <Space>
        0x00,  // $1D <Space>
        0x00,  // $1E <Space>
        0x00,  // $1F <Space>

        0x00,  // $20 <Space>
        0x86,  // $21 !
        0x22,  // $22 "
        0x00,  // $23 #
        0x00,  // $24 $
        0x00,  // $25 %
        0x00,  // $26 &
        0x02,  // $27 '
        0x39,  // $28 (
        0x0F,  // $29 )

        0x00,  // $2A *
        0x00,  // $2B +
        0x84,  // $2C ,
        0x40,  // $2D -
        0x80,  // $2E .
        0x52,  // $2F /

        0x3F,  // $30 0
        0x06,  // $31 1
        0x5B,  // $32 2
        0x4F,  // $33 3
        0x66,  // $34 4
        0x6D,  // $35 5
        0x7D,  // $36 6
        0x27,  // $37 7
        0x7F,  // $38 8
        0x6F,  // $39 9
        0x00,  // $3A :
        0x00,  // $3B ;
        0x58,  // $3C <
        0x48,  // $3D =
        0x4C,  // $3E >
        0xD3,  // $3F ?

        0x5F,  // $40 @
        0x77,  // $41 A
        0x7C,  // $42 B
        0x39,  // $43 C
        0x5E,  // $44 D
        0x79,  // $45 E
        0x71,  // $46 F
        0x3D,  // $47 G
        0x74,  // $48 H
        0x04,  // $49 I
        0x1E,  // $4A J
        0x7A,  // $4B K
        0x38,  // $4C L
        0x37,  // $4D M
        0x54,  // $4E N
        0x5C,  // $4F O

        0x73,  // $50 P
        0x67,  // $51 Q
        0x50,  // $52 R
        0x6D,  // $53 S
        0x78,  // $54 T
        0x1C,  // $55 U
        0x1C,  // $56 V
        0x3E,  // $57 W
        0x76,  // $58 X
        0x6E,  // $59 Y
        0x5B,  // $5A Z
        0x39,  // $5B [
        0x64,  // $5C <BackSlash>
        0x0F,  // $5D ]

        0x23,  // $5E ^
        0x08,  // $5F _

        0x20,  // $60 `
        0x77,  // $61 A
        0x7C,  // $62 B
        0x39,  // $63 C
        0x5E,  // $64 D
        0x79,  // $65 E
        0x71,  // $66 F
        0x3D,  // $67 G
        0x74,  // $68 H
        0x04,  // $69 I
        0x1E,  // $6A J
        0x7A,  // $6B K
        0x38,  // $6C L
        0x37,  // $6D M
        0x54,  // $6E N
        0x5C,  // $6F O

        0x73,  // $70 P
        0x67,  // $71 Q
        0x50,  // $72 R
        0x6D,  // $73 S
        0x78,  // $74 T
        0x1C,  // $75 U
        0x1C,  // $76 V
        0x3E,  // $77 W
        0x76,  // $78 X
        0x6E,  // $79 Y
        0x5B,  // $7A Z
        0x46,  // $7B {
        0x30,  // $7C |
        0x70,  // $7D }
        0x01,  // $7E ~
        0x00   // $7F <Space>
      };


Broncode: [1: Mega Midi Panel]

Afbeeldingen

megamidipanel_1.jpg
1/6: megamidipanel_1.jpg.
megamidipanel_2.jpg
2/6: megamidipanel_2.jpg.
megamidipanel_3.jpg
3/6: megamidipanel_3.jpg.
megamidipanel_4.jpg
4/6: megamidipanel_4.jpg.
megamidipanel_5.jpg
5/6: megamidipanel_5.jpg.
megamidipanel_6.jpg
6/6: megamidipanel_6.jpg.

De aansluitingen van Mega Midi Panel

Het Midi Panel met de Arduino Mega.

Arduino Mega

Pwr USB ?
 
?
aref
gnd Gnd's
? d13
ioreff d12
Reset reset d11
+3.3v d10
+5V +5v d9
Gnd's gnd d8
Gnd's gnd
Vin d7
d6
Midi Kanaal (1) a0 d5
Panel Mode (2) a1 d4
Pot (3) a2 d3
Key Shift (4) a3 d2
a4 d1 Tx
a5 d0 Rx
a6
a7 d14
d15
a8 d16
a9 d17
a10 d18 Tx1 Midi Out
a11 d19 Rx1 Midi In
a12 d20
a13 d21
a14 /~\
a15 \_/
Onderconnector
d22 | d23
R1 |A2 d24 | d25 A3| G1
B1 |A4 d26 | d27 A5| R2
G2 |A6 d28 | d29 A7| B2
 | 
Oe Led & Display |C7 d30 | d31 C6| Oe Paneel
Latch Paneel |C5 d32 | d33 C4| Clock Paneel
|C3 d34 | d35 C2| C (A2)
B (A1) |C1 d36 | d37 C0| A (A0)
 | 
d39 | d39
d40 | d41
 | 
Led Display |L7 d42 | d43 L6| Led Display
Led Display |L5 d44 | d45 L4| Led Display
Led Display |L3 d46 | d47 L2| Led Display
Led Display |L1 d48 | d49 L0| Led Display
 | 
d50 | d51
d52 | d53