; ; IR Widget 1.00 ; 2006-10-19 ; ; Keivn Timmerman ; irwidget [@t] compendiumarcana [d0t] com ; www.compendiumarcana.com/irwidget ; #ifdef __12C508 include #define CORE12 #define FIRSTREG 0x07 #endif #ifdef __12C508A include #define CORE12 #define FIRSTREG 0x07 #endif #ifdef __12C509 include #define CORE12 #define FIRSTREG 0x07 #endif #ifdef __12C509A include #define CORE12 #define FIRSTREG 0x07 #endif #ifdef __12F508 include #define CORE12 #define FIRSTREG 0x07 #endif #ifdef __12F509 include #define CORE12 #define FIRSTREG 0x07 #endif #ifdef __12F629 include #define CORE14 #define FIRSTREG 0x20 #define PGMSIZE 1024 #endif #ifdef __12F635 include #define CORE14 #define FIRSTREG 0x20 #define PGMSIZE 1024 #endif #ifdef __12F675 include #define CORE14 #define FIRSTREG 0x20 #define PGMSIZE 1024 #endif #ifdef __12F683 include #define CORE14 #define FIRSTREG 0x20 #define PGMSIZE 2048 #endif ; Configuration bits #ifdef CORE12 __config _CP_OFF & _MCLRE_OFF & _WDT_ON & _IntRC_OSC #endif #ifdef CORE14 __config _CPD_OFF & _CP_OFF & _BODEN_ON & _MCLRE_OFF & _PWRTE_ON & _WDT_ON & _INTRC_OSC_CLKOUT #endif errorlevel -220 ; Stupid MPLAB complains about IDLOCS org 0x2000 ; IDLOCS ;dw 'I','R','W','0' ; IR Widget Rev 0 errorlevel +220 BANK1 equ 0x80 ; Reduce assembler whining radix dec ; Default radix of decimal ; --- I/O ; 8 Ground ; bCompatMode equ 0 ; 7 74HC Hardware Compatiblility Mode pCompatMode equ GPIO ; bSerTx equ 1 ; 6 Serial data to host PC pSerTx equ GPIO ; bIRDetect equ 2 ; 5 IR Detector module input pIRDetect equ GPIO ; bOpMode equ 3 ; 4 Operational Mode pOpMode equ GPIO ; bOscOut equ 4 ; 3 Osc Out (12F6xx) ; bIRDemod equ 5 ; 2 IR Demodulator module input pIRDemod equ GPIO ; ; 1 Power ; asio_out_port set pSerTx asio_out_bit set bSerTx cblock FIRSTREG ; Registers last_time time_mask asio_data asio_flags asio_bit_time four temp1 endc org 0x0000 ; - Start of program memory nop ; clrf GPIO ; All outputs off goto skip_isr ; Jump over the ISR ; org 0x0004 ; - ISR goto $ ; Let the watchdog handle this ; ; skip_isr ; ; - Initiailize periferals ; #ifdef CORE12 ; movwf OSCCAL ; Setup OSCCAL ; movlw (1<