;******************************************************************************* ;** ;** D70 Remote control using a PIC16C84 ;** ;** Written by Rick Huang, Copyright (C) 2004 ;** Revision YYYY/MM/DD ;** Rev 1. 2004/04/25 - Initial release, code base adapted from bike dimmer ;** ;** IR code implemented: ;** 1: 2ms ;** 0: 28ms ;** 1: 0.5ms ;** 0: 1.50ms ;** 1: 0.50ms ;** 0: 3.50ms ;** 1: 0.50ms ;** ;** This program is free software; you can redistribute it and/or modify ;** it under the terms of the GNU General Public License as published by ;** the Free Software Foundation; either version 2 of the License, or ;** (at your option) any later version. ;** ;** This program is distributed in the hope that it will be useful, ;** but WITHOUT ANY WARRANTY; without even the implied warranty of ;** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;** GNU General Public License for more details. ;** ;** You should have received a copy of the GNU General Public License ;** along with this program; if not, write to the Free Software ;** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ;******************************************************************************* ;******************************************************************************* ;** Pinout: ;** RA0 - Output ;** Crystal - 4Mhz ;** Reset connected to power ;** All other pins are unused (Connect to ground) ;******************************************************************************* include __config _XT_OSC & _WDT_OFF #define _DOUT PORTA, 0 ; Outgoing data ;******************************************************************************* ;** Memory start at 0Ch Temp equ 0Ch Time equ 0Dh Counter equ 0Eh Counter2 equ 0Fh goto Reset ORG 4 ;******************************************************************************* ;** Start of the program Reset: clrf PORTA ; Clear output data ;------------------------ Preset variable bsf STATUS, RP0 movlw b'00011110' ; Set PA0 to output movwf TRISA bcf STATUS, RP0 ;------------------------ movlw d'80' movwf Counter Loop2ms: bsf _DOUT ; 0 Set output high nop nop nop nop nop nop nop nop nop nop nop bcf _DOUT ; 12 nop nop nop nop nop nop nop nop nop decfsz Counter, F ; 22 goto Loop2ms ; 23, (24 goto) movlw d'20' ; 24 movwf Counter2 ; 0 (25) Loop28msO: movlw d'199' ; 0 (1400) movwf Counter ; 1 Loop28msI: nop ; 0 (7) nop ; 1 nop ; 2 nop ; 3 decfsz Counter, F ; 4 goto Loop28msI ; 5, 6 ; Total delay - 7 ins nop ; 1394 nop ; 1395 nop ; 1396 decfsz Counter2, F ; 1397 goto Loop28msO ; 1398, 1399 movlw d'20' movwf Counter Loop05ms: bsf _DOUT ; 0 Set output high nop nop nop nop nop nop nop nop nop nop nop bcf _DOUT ; 12 nop nop nop nop nop nop nop nop nop decfsz Counter, F ; 22 goto Loop05ms ; 23, 24 movlw d'60' ; 24 movwf Counter ; 25 Loop15ms: bcf _DOUT ; 0 Set output high nop nop nop nop nop nop nop nop nop nop nop bcf _DOUT ; 12 nop nop nop nop nop nop nop nop nop decfsz Counter, F ; 22 goto Loop15ms ; 23, 24 movlw d'20' movwf Counter Loop05ms2: bsf _DOUT ; 0 Set output high nop nop nop nop nop nop nop nop nop nop nop bcf _DOUT ; 12 nop nop nop nop nop nop nop nop nop decfsz Counter, F ; 22 goto Loop05ms2 ; 23, 24 movlw d'140' movwf Counter Loop35ms: bcf _DOUT ; 0 Set output high nop nop nop nop nop nop nop nop nop nop nop bcf _DOUT ; 12 nop nop nop nop nop nop nop nop nop decfsz Counter, F ; 22 goto Loop35ms ; 23, 24 movlw d'20' movwf Counter Loop05ms3: bsf _DOUT ; 0 Set output high nop nop nop nop nop nop nop nop nop nop nop bcf _DOUT ; 12 nop nop nop nop nop nop nop nop nop decfsz Counter, F ; 22 goto Loop05ms3 ; 23, 24 sleep ;------------------------ End of file end