'use byte library for smaller code $lib "mcsbyte.lbx" $regfile = "8535def.dat" $crystal = 7372800 ' Taktfrequenz $baud = 19200 Dim Address As Byte , Command As Byte Dim A As Byte ' eingelesens Datenbyte Dim B As Byte 'Zwischenspeicher fuer Datenuebertragung Dim Daten As Byte Declare Sub Txnext Declare Sub Txbits Config Portb = Output Config Rc5 = Pinc.1 Ddrc = &B10000000 'Ddrb = &B00000001 Reset Portc.7 Enable Interrupts Print "Waiting for RC5..." Do Waitms 200 Getrc5(address , Command) If Address = 0 Then Command = Command And &B01111111 Select Case Command 'Print " " ; Command Case 12 : Gosub Standby Case 16 : Gosub Volup Case 17 : Gosub Voldown Case 32 : Print "Prog+" Case 33 : Print "Prog-" End Select End If Loop End Standby: B = &H44 Gosub Txmain Return Volup: B = &H3B Gosub Txmain Return Voldown: B = &H00 Gosub Txmain Return Txmain: Set Portc.7 Waitms 9 Reset Portc.7 Waitms 4.5 Daten = &H82 Print "Custom Code Hex82" Call Txbits Daten = &H17 Print "Custom Code Hex17" Call Txbits Daten = B Print "Data Code Hex" Call Txbits Toggle Daten 'Print " Daten Hexwert: " ; Hex(daten) Call Txbits Set Portc.7 Waitus 562 'Print "warte 562" Reset Portc.7 Return Txbits: 'Print "Hexwert " ; Hex(daten) For A = 1 To 8 'Schleife zum ausgeben von 8 Bits Print A Print Bin(daten) Txnext: Set Portc.7 'Print " ich warte" Waitus 562 Reset Portc.7 Waitus 562 'Print " ich warte" If Daten.0 = 1 Then 'Bit 0 der Variable testen Waitus 562 Waitus 562 'Print "warte doppelt" Rotate Daten , Right , 1 Else Rotate Daten , Right , 1 End If Next A 'Call Txnext Return