kasamiko
Member
I'm going crazy with this..
I'm using 16F628A to generate modulated 40khz to drive an infrared led and a tv infrared remote control receiver as detector...
here is my PWM code below:
but I can't make it works...
I also tried using 556 which is the 40khz oscillator is gated by another 250hz oscillator but still doesn't work!
Any ideas will be appreciated...
TIA
I'm using 16F628A to generate modulated 40khz to drive an infrared led and a tv infrared remote control receiver as detector...
here is my PWM code below:
@ DEVICE HS_OSC,MCLR_OFF,LVP_OFF,WDT_OFF,PROTECT_OFF
DEFINE OSC 20 ' We're using a 20MHz crystal
CCPR1L = 25 ' 25=20% PWM Duty-Cycle
PR2 = 124 ' Set PWM for ~40KHz
T2CON = 4 ' Timer2 ON + 1:1 prescale
TRISB=%00000100 ' Set PortB TRIS register
PORTB=%00000011 ' LEDs off, pulsout pins set for logic 1 pulses
but I can't make it works...
I also tried using 556 which is the 40khz oscillator is gated by another 250hz oscillator but still doesn't work!
Any ideas will be appreciated...
TIA