Forum: Mikrocontroller und Digitale Elektronik Problem mit Bascom Programm


von Reinhard S. (reini)


Lesenswert?

Hallo

Habe ein Problem mit dem Programm. Eigentlich funst es ja bestens bis 
auf die Auswertung vom Tastendruck 1 oder 11, da ich ich auf der 
Fernbedienung nur eine 1 als Taste habe will ich 3 Sekunden warte ob 
eine weitere Taste gedrückt wird oder nicht. Bei nicht soll das Programm 
1 geschalten werden, zB. bei 1 + 2 das Programm 12. Das Probelm ist das 
in ca. 40% des druckes auf Taste 1, gleich in das Programm 11 geschalten 
wird. Wie kann ich das lösen?

Start:
Do
  Getrc5(adress , Command) 
'RC5-Fernbedienung einlesen
  If Adress = 0 Then                                        'DVD
    'Portd.4 = 1 
'KontrollLED an
    Command = Command And &B01111111                        'Togglebit 
löschen
   Goto Dvd
  End If
  If Adress = 16 Then                                       'TV
    'Portd.4 = 1 
'KontrollLED an
    Command = Command And &B01111111                        'Togglebit 
löschen
   Goto Tv
  End If
Loop

Dvd:
'Programmtasten
'Taste 1 - 9
  If Command < 10 Then
  Select Case Command
     Case 3                                                 'P3
      Portc.3 = 0
      Portd.4 = 1

      Case 9                                                 'P9
      Portc.4 = 0
      Portc.5 = 0
      Portd.4 = 1

     End Select

'auswerten ob über 8
  If Command = 1 Then
     Code = 200
     Msekunden = 0
     Portd.4 = 1
     Do
     Getrc5(adress , Command)
     Loop Until Command = 0 Or Command = 1 Or Command = 3 Or Command = 2 
Or Command = 4 Or Command = 5 Or Msekunden > Zeit
     If Msekunden > Zeit Then Portc.5 = 0
     If Command = 0 Then Code = 210
     Code = Code + Command

'auswerten bei über 8
      Select Case Code
        Case 202                                            'P12
         Portc.5 = 0

        Case 201                                            'P11
         Portc.4 = 0
         Portc.3 = 0

usw.

Danke für eine Hilfe

mfg
reini

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.