Knocked this up when the remote for my aircon died , never really finished it . got a clone remote on ebay for $10 (delivered)
why bother.
this can work for any osc >= 8 MHz
Code:'**************************************************************** '* Name : ir38khz.BAS * '* Author : RICHARD * '* Notice : * '* : * '* Date : 6/30/2016 * '* Version : 1.0 * '* Notes : REPL BRA WITH GOTO FOR NASTY OLD CHIPS * '* : OSC MUST BE AT LEAST 8 MHZ * '**************************************************************** DEFINE OSC 16 ; MIN=8 TESTED OK 8,16,32 DEFINE IRPORT LATC DEFINE IRPIN 4 define IR_1 2000 ; 1 TIME IN uS MAX 6500 ISH define IR_0 900 ; 0 TIME IN uS cycnt var byte bank0 ;set to numbr of 38k cycles req then call irout RANGE 1-255 dly var byte bank0 ;system goto overasm asm _irout1 ;entry point FOR 1 pulse movlw (IR_1/26) movwf _cycnt BRA _irout ;GOTO _irout0 movlw (IR_0/26) ;entry point FOR 0 pulse movwf _cycnt _irout ;entry point for cycnt cycles nxbt CHK?RP IRPORT BSF IRPORT ,IRPIN CALL dly13 CHK?RP IRPORT BCF IRPORT ,IRPIN CALL dly13 RST?RP DECFSZ _cycnt,F BRA nxbt ;GOTO RETURN dly13 movlw (OSC-(16/OSC)) RST?RP movwf _dly d13 DECFSZ _dly,F BRA d13 ;GOTO RETURN endasm overasm: OSCCON=$78 ANSELA=0 ANSELC=0 TRISA = %111110 TRISC = %11000011 ' set PORTC I/O main: cycnt = 100 call irout pauseus 250 call irout1 pauseus 250 call irout0 pause 50 goto main




Bookmarks