jetzt läuft das sendeprogramm vom rc5-code super.
ist ziemlich kurz und ist mit asm-code gemischt :

Code:
$regfile = "m32def.dat"
$framesize = 32
$swstack = 32
$hwstack = 64
$crystal = 8000000

Config Timer1 = Timer , Prescale = 1 , Compare A = Toggle , Clear Timer = 1

Declare Sub Rc5out()

Dim Adre As Byte
Dim Command As Byte
Dim Togglebit As Byte
Dim Z As Byte

Enable Interrupts

Compare1a = 111

Do

For Z = 1 To 5
   Adre = 20 + Z
   Togglebit = 0
   Command = 50 + Z
   Call Rc5out()

   Waitms 500
Next

Loop

End

Sub Rc5out()
   !Call Bit_lo
' 2x hi
   !Call Bit_hi
   !Call Bit_hi

' toglebit
   lds r17,{togglebit}
   sbrs r17,0
   !call bit_lo
   sbrc r17,0
   !call bit_hi

' 5x adresse
   ldi r18,5
Wgloop1:
   lds r17,{adre}
   sbrs r17,4
   !call bit_lo
   sbrc r17,4
   !call bit_hi
   lsl r17
   sts {adre},r17
   dec r18
   brne wgloop1

' 6x command
   ldi r18,6
Wgloop2:
   lds r17,{command}
   sbrs r17,5
   !call bit_lo
   sbrc r17,5
   !call bit_hi
   lsl r17
   sts {command},r17
   dec r18
   brne wgloop2

   !Call Ende_rc5

Bit_hi:
   Config Timer1 = Timer , Prescale = 1 , Compare A = Clear , Clear Timer = 1
   Waitus 889
   Config Timer1 = Timer , Prescale = 1 , Compare A = Toggle , Clear Timer = 1
   Waitus 889
   ret

Bit_lo:
   Config Timer1 = Timer , Prescale = 1 , Compare A = Toggle , Clear Timer = 1
   Waitus 889
   Config Timer1 = Timer , Prescale = 1 , Compare A = Clear , Clear Timer = 1
   Waitus 889
   ret

Ende_rc5:
   Config Timer1 = Timer , Prescale = 1 , Compare A = Clear , Clear Timer = 1
   Waitms 50
End Sub