Servus.
Ich stehe hier vor einem Phänomen, welches ich mir nicht ganz erklären kann.
Ich habe lange rumgedockert und gesucht um nun endlich eine RC5 IR Fernbedieung auswerten zu können.
Als Controllerboard verwende ich das RN-Control.
Programmiere mit BASCOM.
IR Fernbedienung: Phillips
Empfänger: Keine Ahnung. Hab ich aus einem Technisat Reciever ausgebaut.
Der funktionierende Polling basierte Code:
Der Code funktioniert vom feinsten.Code:$regfile = "m32def.dat" $crystal = 16000000 $baud = 9600 Config Rc5 = Pina.1 Enable Interrupts Dim Address As Byte , Command As Byte Print "Waiting for RC5..." Sound Portd.7 , 400 , 450 'BEEP Sound Portd.7 , 400 , 250 'BEEP Sound Portd.7 , 400 , 450 'BEEP Do Getrc5(address , Command) Command = Command And &B01111111 If Address < 255 Then Print Address ; " " ; Command End If Loop End
Dieser oben gezeigte Code, war eig. nur um die generelle Funktionalität zu testen. Also: Zwekc erfüllt.
Da das Polling aber überaus unschön und unpraktikabel ist, wollte ich das ganze Interrupt gesteuert umsetzen. ... Dies ist mein bisheriger Code:
Hier funktioniert so ziemlich garnichts. In der Mail ist ein Print eingebaut, welcher jede Sekune "Hallo" sagt.Code:$regfile = "m32def.dat" $crystal = 16000000 $baud = 9600 $lib "mcsbyte.lbx" Config Rc5 = Pind.3 On Int0 Int0_int Enable Int0 Enable Interrupts Dim Address As Byte , Command As Byte , Rc5_flag As Bit Sound Portd.7 , 400 , 450 'BEEP Sound Portd.7 , 400 , 250 'BEEP Sound Portd.7 , 400 , 450 'BEEP Do Print "Hallo" Waitms 1000 Loop End 'Lesen der RC5 Codes Int0_int: 'Interrupt Handler For Int1 Disable Int0 Address = 0 Command = 0 Getrc5(address , Command) Command = Command And &B01111111 Print Address ; " " ; Command Enable Int0 Return
Wenn das Programm startet funktioniert die Ausgabe durch Print auch. Sobald einmal die IR Fernbedienung betätigt wird, scheint sich alles wegzuhängen.
Es wird keine Ausgabe des Empfangs getätigt. Das Programm springt nicht mehr in die Mainschleife zurück.
Hat da wer ne Idee woran das liegen könnte?







Zitieren

Lesezeichen