Hallo, ich habe ein Problem mit rc5 (ja, das altbekannte Thema![]()
Also ich will mit einer IR-Diode (SFH415) senden, in einem Programm funktioniert und mit einem IR-Empfänger (SFH5110-36) empfangen (was auch in einem Programm funktioniert.
Habe den Empfänger mal mit einer rc5 Fernbedienung getestet und es funktioniert.
Code:$regfile = "m32def.dat" ' $framesize = 32 '$swstack = 32 '$hwstack = 32 $crystal = 16000000 $baud = 9600 $lib "mcsbyte.lbx" Config Pina.7 = Input 'out-pin vom ir empfänger Config Pinc.3 = Output 'Status-LED Config Rc5 = Pina.7 Porta.7 = 1 Enable Interrupts Dim Adress As Byte , Command As Byte Do Getrc5(adress , Command) Waitms 150 If Adress < 255 Then Print "Adress: " ; Adress ; "Command: " ; Command ; " - " End If If Command = 2 Then 'wenn die Taste 2 gedrückt, dann Status-LED an Portc.3 = 1 Elseif Command = 255 Then portc.3=0 End If Loop End
Will ich aber beide Befehle in einem Programm abarbeiten, akzeptiert Bascom den rc5send Befehl nicht:
Besagt die Zeile command = 12 vor do eigentlich, was gesendet wird?Code:$regfile = "m32def.dat" ' $framesize = 32 '$swstack = 32 '$hwstack = 32 $crystal = 16000000 $baud = 9600 $lib "mcsbyte.lbx" Config Pind.5 = Output 'ir-led Config Pina.7 = Input 'out-pin vom ir empfänger Config Pinc.3 = Output 'Status-LED 1 Config Pinc.4 = Output 'Status-LED 2 Config Rc5 = Pina.7 Porta.7 = 1 Enable Interrupts Dim Togbit As Byte , Adress As Byte , Command As Byte Command = 12 Togbit = 0 Address = 0 Do Waitms 500 Rc5send Togbit , Address , Command Getrc5(adress , Command) Waitms 150 If Adress < 255 Then Print "Adress: " ; Adress ; "Command: " ; Command ; " - " End If If Command = 2 Then ' wenn Taste 2 gedrückt, dann Status-LED 1 an Portc.3 = 1 Elseif Command = 255 Then Portc.3 = 0 End If If Command = 12 Then 'wenn command 12, dann Status-LED 2 an Portc.4 = 1 Elseif Command = 255 Then Portc.4 = 0 End If Loop End
Könnt ihr mir weiterhelfen?







Zitieren

Lesezeichen