You should modulate your signal on a carrier of about 38 kHz. You can generate this with assembly or use a pic12f683 and use the internal pwm generator. Then you can modulate this signal by switching the trisio pin.
I once did it this way:
It sends a Sony DVD play command every five seconds (as an example)
Code:
@ device pic12F683, intrc_osc_noclkout, wdt_off, pwrt_on, mclr_off, protect_off, bod_off
INCLUDE "MODEDEFS.BAS"
DEFINE PULSIN_MAX 5000
GPIO = %00100000
TRISIO = %00001100
CCP1CON = %00001100 ' Mode select = PWM
T2CON = %00000100 ' Timer2 ON + 1:1 prescale (last two bits)
CCPR1L = %00001101 ' pwm duty 50%
PR2 = %00011001 ' Set PWM frequency to +/- 40kHz, set to 26 for 38kHz or 28 for 36kHz
ANSEL = %00000000
CMCON0 = %00000111
led var GPIO.5
counter VAR BYTE
counter2 VAR BYTE
command VAR WORD 'IR command to send
temp VAR WORD
bitcount VAR WORD
bitselector var word
rewind CON $79A 'sony DVD codes for testing
play CON $59A
postdata con $36
clear
loop:
command = play
gosub sendIR
pause 5000
goto loop
sendIR: ' send IR code
for counter = 1 to 5 ' five times
TRISIO.2 = 0
PauseUs 2450 ' Lead_in pulse
TRISIO.2 = 1
pauseus 450 ' (space)
bitcount = 11 ' send first 11 bits
temp = command
GoSub transmit
bitcount = 8 ' send remaining 8 bits
temp = postdata
GoSub transmit
TRISIO.2 = 0
PauseUs 650 ' ptrail (pulse)
TRISIO.2 = 1
Pauseus 13080
next counter
Return
transmit:
bitselector = 1 << (bitcount - 1)
For counter2 = 1 TO bitcount 'number of bits
TRISIO.2 = 0 'make output (pin active, led on)
PauseUs 540 'first part of bit, pulse
IF (temp & bitselector) = 0 Then 'if bit is 0
PauseUs 580 'send second part of bit ,pulse
EndIF
TRISIO.2 = 1 'make input (pin inactive, led off)
PauseUs 560 'space (no pulse)
temp = temp << 1 'shift one bit
Next counter2
Return
Bookmarks