Hallo zusammen,
habe mich jetzt lange mit Midi beschäftigt.
Und mache jetzt so die ersten gehversuche.
Ich habe hier einen Code in Bascom.
Allerdings funktioniert nur PORTD.2.
PORTD.3 geht nicht.
Was ist an meinem Code falsch?
wäre sehr dankbar, wenn ihr mir helfen könntet!!!
Vielen Dank
Gruß
Fabi
1 | $regfile = "m8def.dat" ' ATMEGA8
|
2 | $crystal = 1000000 ' 1 MHz
|
3 | $baud = 31250 ' MIDI-Baudrate (31,25kBit)
|
4 |
|
5 | Taster Alias Pind.2
|
6 | Taster1 Alias Pind.3
|
7 |
|
8 | Dim Keydown As Byte
|
9 | Dim Keydown1 As Byte ' Tasten-Merker
|
10 |
|
11 | Init:
|
12 | Ddrd.1 = 1 ' Sendeleitung auf Output
|
13 | Portd.2 = 1
|
14 | Portd.3 = 1 ' internen Pull-Up aktivieren für Taster
|
15 |
|
16 | Main:
|
17 | Do
|
18 | If Taster = 0 Then
|
19 | If Keydown = 1 Then
|
20 | Gosub Sendmidinoteon
|
21 | Keydown = 0
|
22 | End If
|
23 | Else
|
24 | If Keydown = 0 Then
|
25 | Gosub Sendmidinoteoff
|
26 | Keydown = 1
|
27 | End If
|
28 | End If
|
29 | Loop
|
30 | Do
|
31 | If Taster1 = 0 Then
|
32 | If Keydown1 = 1 Then
|
33 | Gosub 1sendmidinoteon
|
34 | Keydown1 = 0
|
35 | End If
|
36 | Else
|
37 | If Keydown1 = 0 Then
|
38 | Gosub 1sendmidinoteoff
|
39 | Keydown1 = 1
|
40 | End If
|
41 | End If
|
42 | Loop
|
43 | End
|
44 |
|
45 | Sendmidinoteon:
|
46 | Print Chr(&B10010001); ' NOTE-ON-Command
|
47 | Print Chr(65); ' Tasten-Nummer 69 (A4)
|
48 | Print Chr(100); ' Key-Down-Velocity 100
|
49 | Return
|
50 |
|
51 | Sendmidinoteoff:
|
52 | Print Chr(&B10000001); ' NOTE-OFF-Command
|
53 | Print Chr(65); ' Tasten-Nummer 69 (A4)
|
54 | Print Chr(0); ' Release-Velocity 0 (Default)
|
55 | Return
|
56 | 1sendmidinoteon:
|
57 | Print Chr(&B10010000); ' NOTE-ON-Command
|
58 | Print Chr(69); ' Tasten-Nummer 69 (A4)
|
59 | Print Chr(100); ' Key-Down-Velocity 100
|
60 | Return
|
61 |
|
62 | 1sendmidinoteoff:
|
63 | Print Chr(&B10000000); ' NOTE-OFF-Command
|
64 | Print Chr(69); ' Tasten-Nummer 69 (A4)
|
65 | Print Chr(0); ' Release-Velocity 0 (Default)
|
66 | Return
|