Hi
I Used this program to generate signal but it doesnt work.
when i used the ir-receiver to compare the source signal with created signal see the created signal is
very different with source signal.
[code:1:876890cb74]' IR Led: +5V <---[A Led K]---[220 Ohm]---> Pb.1
$regfile = "m8def.dat"
$crystal = 8000000
'40 kHz carrier reload value
'Const T_oc1 = 49 'value for 4MHz crystal
Const T_oc1 = 99 'value for 8MHz crystal
'Const T_oc1 = 124 'value for 10MHz crystal
Const Carrier_on = &B01000000 'IR 40kHz carrier on
Const Carrier_off = &B11000000 'IR 40kHz carrier off
Const Ir_repeat = 3 'number code frames (at least 2)
'Config Kbd =
Config Portb = Output 'keyboard connected at Port b
Config Timer1 = Timer , Prescale = 1 , Compare A = Toggle , Clear Timer = 1
Timer1 = 0
Compare1a = T_oc1 'OC1 = IR carrier = 40 kHz
Tccr1a = Carrier_off
'---[ main program loop ]-------------------------------------------------------
Waitms 1 'small delay
' If Key <> 16 Then 'test if key is pressed else key=16
' Ir_data = Lookup(key , Ir_code) 'lookup pressed key IR Remote Code
Ddrb.1 = 1 'set OC1 (Pb.1) = IR carrier output
Do
Tccr1a = Carrier_on : Waitus 2400 'start = 2.4mS
Tccr1a = Carrier_off : Waitus 600
Tccr1a = Carrier_on : Waitus 1200
Tccr1a = Carrier_off : Waitus 600
Tccr1a = Carrier_on : Waitus 600
Tccr1a = Carrier_off : Waitus 600
Tccr1a = Carrier_on : Waitus 1200
Tccr1a = Carrier_off : Waitus 600
Tccr1a = Carrier_on : Waitus 600 '''''
Tccr1a = Carrier_off : Waitus 600
Tccr1a = Carrier_on : Waitus 1200
Tccr1a = Carrier_off : Waitus 600
Tccr1a = Carrier_on : Waitus 600
Tccr1a = Carrier_off : Waitus 600
Tccr1a = Carrier_on : Waitus 600
Tccr1a = Carrier_off : Waitus 600
Tccr1a = Carrier_on : Waitus 600
Tccr1a = Carrier_off : Waitus 600
Tccr1a = Carrier_on : Waitus 600
Tccr1a = Carrier_off : Waitus 600 ''''''''
Tccr1a = Carrier_on : Waitus 1200
Tccr1a = Carrier_off : Waitus 600
Tccr1a = Carrier_on : Waitus 600
Tccr1a = Carrier_off : Waitus 600
Tccr1a = Carrier_on : Waitus 1200
Tccr1a = Carrier_off : Waitus 600
Tccr1a = Carrier_on : Waitus 600
Tccr1a = Carrier_off : Waitus 600
Tccr1a = Carrier_on : Waitus 1200
Tccr1a = Carrier_off : Waitus 600
Tccr1a = Carrier_on : Waitus 600
Waitms 25
Loop
'-------------------------------------------------------------------------------
[/code:1:876890cb74]
Thanks.
↧