Hallo,

Ich habe heute mein RN Control 1.4 bekommen und schon ein bisschen damit gespielt.
Nun habe ich mich an das zusammenstellen eines eigenen Scripts gewagt. Compilieren klappt Fehlerlos, übertragen auch nach dem übertragen aufs Board leuchten allerdings alle 8 Leds auf.

Habe ich einen Fehler in meinem Programm?
Es soll grundsätzlich nach Druck eines Tasters ein Led aufleuchten und ein Ton abgespielt werden.
Kann da mal jemand einen Fachmännischen Blick draufwerfen? (Habe bisher nur C programmiert und versuche jetzt Bascom Avr)

Code:
Declare Function Tastenabfrage() As Byte

$regfile = "m32def.dat"
$crystal = 160000000
Config Portc = Output
Portc = 0
Dim Tastealt As Byte
Dim Taste As Byte
Tastealt = 0
Taste = 0

Schleife:
Waitms 20
Taste = Tastenabfrage()

If Tastealt <> Taste Then
Select Case Taste
   Case 1
      Portc.1 = 1
      Waitms 10
      Sound Portd.7 , 400 , 450
      Waitms 10
      Portc.1 = 0
   Case 2
      Portc.2 = 1
      Waitms 10
      Sound Portd.7 , 400 , 450
      Waitms 10
      Portc.2 = 0
   Case 3
      Portc.3 = 1
      Waitms 10
      Sound Portd.7 , 400 , 450
      Waitms 10
      Portc.3 = 0
   Case 4
      Portc.4 = 1
      Waitms 10
      Sound Portd.7 , 400 , 450
      Waitms 10
      Portc.4 = 0
   Case 5
      Portc.5 = 1
      Waitms 10
      Sound Portd.7 , 400 , 450
      Waitms 10
      Portc.5 = 0
   End Select
   Tastealt = Taste
End If
Goto Schleife


Function Tastenabfrage() As Byte
Local Ws As Word
Tastenabfrage = 0
Start Adc
Ws = Getadc(7)
If Ws < 1010 Then
Select Case Ws
   Case 410 To 450
   Tastenabfrage = 1
   Case 340 To 380
   Tastenabfrage = 2
   Case 265 To 305
   Tastenabfrage = 3
   Case 180 To 220
   Tastenabfrage = 4
   Case 100 To 130
   Tastenabfrage = 5

End Select
End If
End Function