Ich sende mit einem Mega8 IR Codes aus. Die Fernbedienungen habe ich (da sie keinen RC5 Code senden) mit einem Audioprogramm und einer TSOP aufgezeichnen und analysiert. Die 36khz modulation erzeuge ich mittels PWM an einem zweiten Ausgangsport des Mega8. Nun Suche ich eine Möglichkeit, dass ich das über nur einen Port hinbekomme. Geht das über PWM?

Hier mein Code:

Code:

$regfile = "m8def.dat"
$crystal = 8000000
$hwstack = 100
$swstack = 100
$framesize = 100

Config Pinb.0 = Output
Config Portb.1 = Output
Takt Alias Portb.1                                          '36khz takt moduliert über einen transistor
Irled Alias Portb.0                                         '3 IR LED's über einen zweiten transistor gesteuert

Dim Pwmwert As Word
Dim L As Byte
Dim H As Byte
L = 0
H = 1

Config Timer1 = Timer , Prescale = 1 , Compare A = Toggle , Clear Timer = 1
Pwmwert = 110
Compare1a = Pwmwert

Do
Wait 2
Gosub Sendecodeklimaanlage
Loop

Sendecodeklimaanlage:
Irled = H
Waitus 9000
Irled = L
Waitus 4500
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = L
Waitus 600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = L
Waitus 1600
Irled = H
Waitus 600
Irled = 0
Return

End