DTMF Remote Control Decoder

download DTMF Remote Control Decoder

of 25

Transcript of DTMF Remote Control Decoder

  • 8/22/2019 DTMF Remote Control Decoder

    1/25

    Copyright Geoff Mather G8DHE 2009

    DTMF Remote Control DecoderVersion 1.4

    This kit provides an interface between any audio path capable of handling Dual Tone Multiple Frequency (DTMF) codingand switched outputs using relays.

    Features

    A 4 digit PIN code enables access to the unit, this PIN code can be changed remotely or reduced to a single *. The PINcan be reset to the default by manual intervention.

    A timeout function on the PIN code which can also be remotely changed to between 5 seconds and 255 seconds (4:15minutes).

    A command sequence end function that overrides the timeout function to prevent follow on.

    Individual control of up to 8 relays comprising Operate, Release,Timed Toggling and Clock operation.

    A full 16 DTMF keypad is required for full access operation although operation with a normal telephone style 12 key unitcan be arranged.

    DTMF tone reception is acknowledged by a tone. Success tone (after the PIN has been entered) will be at 500Hz, andFail tone at 250Hz.

    Commands

    # - Using this key at any point aborts the current command and resets the unit requiring the PIN code to be re-entered.Note: the # key cannot be used within a PIN code.

    PIN code - After entering the required 4 digit PIN code the following commands are available;

    Relay control A digit between 1 and 8 selects a relay for the following digit entered to control,the second digit can be;

    0 Release relay

    1 Operate relay2 Toggle relay using the relay toggle times.3 Switch using Clock times

    Any other value will cause the command to abort and the system to reset, requiring the PIN to be re-entered.

    Change PIN The A key followed by a further 4 keys (other than #), these 4 digits must then be repeated before thenew PIN is saved, once saved the system resets requiring the new PIN to be entered before other commands can beissued. The default PIN as supplied is CCCC. If a PIN of four Stars **** is entered then the PIN function is reduced toa single * , this is primarily for those situations where security is not a concern.Example: CCCC A 14AD 14ADIf the new PIN is entered incorrectly the second time then the system will reset with no changes.If the PIN is forgotten, it can be manually reset by, powering down, placing the LINK in position and powering up, wait forthe Beep to finish. The LINK can then be removed and the default PIN of CCCC will have been restored.

    Change Command Timeout The B key followed by the number of seconds required, between 5 and 255, ending withthe * key. The new timeout period will come into operation after entering the PIN next time.

    Change Relay Toggle times The C key followed by the number of seconds the relay(s) are to operate for, followed by*, followed by the number of seconds the relay(s) are to be released for followed by *.

    When using Relay Toggle, adding a relay to the group of relays to be switched, will cause a new cycle to beginimmediately. A relay can be removed from the group of relays being switched, by either using the Relay Toggle a secondtime in which case the relay will stay in its current setting, or by using the Release command or Operate command whichwill force the relay to the requested position.

    Change Clock times The D key followed by the current time in 24:00 format, followed by the On time in 24:00 formatand finally the Off time in 24:00 format. I.e. D 1339 0500 1900 would set the current time to 1:39 PM the On time at 5:00AM and the Off time to 7:00 PM. To enable a relay to use the Clock times the particular relays then need to be selected.

  • 8/22/2019 DTMF Remote Control Decoder

    2/25

    Copyright Geoff Mather G8DHE 2009

    When using the Clock times use of the Operate, Release or Toggle functions is permitted at any time without altering theClock mode. To exit clock mode for a relay then the Relay 3 command is used a second time. Any number of relays canbe set to operate at the specified times.

  • 8/22/2019 DTMF Remote Control Decoder

    3/25

    Copyright Geoff Mather G8DHE 2009

  • 8/22/2019 DTMF Remote Control Decoder

    4/25

    Copyright Geoff Mather G8DHE 2009

  • 8/22/2019 DTMF Remote Control Decoder

    5/25

    Copyright Geoff Mather G8DHE 2009

    D:\Program Files\FED\WIZPIC\Projects\DTMFRemote\DTMFRemote.HEX

    : 020000040000FA: 0600000000008A01162831: 100008008C00030E83018D0004088E0049280B1D07: 100018000F288F140B110E0884000D0E83008C0E10: 100028000C0E090083018B01840181018F012030AE: 100038008B00FF3085000030860083164130810038: 10004800FF30850000308600831211224A224A20A0: 100058008B171E220F1C3228C8210F108F1C37281F: 100068005C22D4218F100F1D3B2820210F118F1DDA: 100078003F2861218F110F1E432882210F1214225D: 100088008F1E482812218F125C280B28AA01AB0169: 10009800AD01AE01AF01B001B501B101B201B301CB

    : 1000A800B401BB01BA01B901B701B801B601080032: 1000B800B41F2D280C302A020319FD28B319BA28B9: 1000C800331AC128331DD728B31AF528331BF5284E: 1000D800B31B8329AF0803199528AA03031D7A289F: 1000E8002F0886042F09B005AF01E728AA03031DCE: 1000F80085282F08B0062F0932140130B100AF014E: 10010800E728AA03031D8C282F08B506AF01E728A6: 1001180007302A02031DFD282F098605B005AF0107: 10012800E7280D302A02031D9B28B315E7280E3057: 100138002A02031DA2283317AE01E7280F302A022E: 10014800031DAA28B3160230AB00E728AA08031D2E: 10015800B328B3170630AB000230AC00E72803140D: 10016800AF0D0318FD28AA0BB428E7283308073970: 10017800C3002A083222B30AE72833080339043EA9: 10018800C3002822AA02031DFD28B30A331DE7284D: 100198000430C300C3034315282243113222C30885: 1001A800031DCE28FD2833080339C30028220F3940: 1001B8002A02031DFD28330AB3000339013C031941: 1001C800F82133190D21B41334102D2805302E02CF: 1001D800031CFD280830C3002E083222AE01331359: 1001E800E7283C210318FB280319E7280028031DEA: 1001F8000029592134142D28B31EEA282B08083861

    : 10020800C3002E083222AE01AB03031D0C29B31222: 10021800E7280830C3002822AD000800831685149B: 10022800831201300B22573006220310050CAA0056: 10023800B417F830B4050800AD0803192629AD0B2A: 1002480026295921B00803190800B103031D080025: 1002580032183329300986050930C3003729300898: 1002680086040A30C3002822B1000130B206080013: 100278000B302A02031953290A302A02031C472982: 10028800031D5629AA0103102E08AE0DAE0DAE0DA2: 10029800AE07AE072A08AE070310031508000314BB: 1002A80003110800031403150800AA01AB01AD01EE: 1002B800AE01AF01B301B4010800BA0A3C303A02FA: 1002C80003197C2138083A02031D712939083B02B9: 1002D800031D712935088604080036083A02031DF3: 1002E800080037083B02031D080035098605080089: 1002F800BA01BB0A18303B020319BB0108000A30D7: 100308002A02031C8A29031D5629AA0103102E0854: 10031800AE0DAE0DAE0DAE07AE072A08AE07AC0B9C: 10032800E728BB302B0784002E0880000230AC0081: 10033800AE01AB0BE7284108173C031CFD28400819: 100348003B3C031CFD283F08173C031CFD283E08C6: 100358003B3C031CFD283D08173C031CFD283C08BA

    : 100368003B3C031CFD280630AB00BB302B07840048: 100378000008AE00063084022E088000AB0BB929B5: 100388004A22B501B313E728331ACC29331D341494: 10039800B415B414C20134118316851083120800F1: 1003A800B41C080004303418B406341908000230AC: 1003B8008506C20BE029E829851CE529051DB4112D: 1003C80008000519B4110800F830B405831685141F: 1003D8008312B41D0800C3010430AB000A30322276: 1003E800C30AAB0BF2290800C30128220B3C031DEA: 1003F8000800C30A431DF9293308F8390438B30043: 100408000800000000009000900B082A08009100E6: 10041800F0300722910B0C2A0800FF3093000800E7: 100428000508013903191A2A131C8F161310031D06: 100438001314080005080139031D242A93180F1402: 100448009310031D93140800831643088312890030: 100458008316081483120808831208008312880080: 100468008316430883128900831603108B1B031419: 100478008B13081555308900AA308900881488180C: 10048800432A081103188B17831208008316502279: 100498005522592283120800A101A201A301A40137: 1004A8000800A501A601A7010800A801A9010800E4: 1004B8008316A90AA80FA903D0302802031D6A2AA7

    : 1004C80003302902031D6A2A0F155922A50F6F2A26: 1004D800A60F6F2AA70AE1302502031D7E2AE43001: 1004E8002602031D7E2A00302702031D7E2A8F154F: 1004F80055225922A10F852AA20F852AA30F852AE2: 10050800A40ADA302102031D972AA4302202031D0F: 10051800972A35302302031D972A00302402031D31: 0A052800972A0F164A2A83120800D2: 00000001FF

  • 8/22/2019 DTMF Remote Control Decoder

    6/25

    Copyright Geoff Mather G8DHE 2009

    D:\Program Files\FED\WIZPIC\Projects\DTMFRemote\DTMFRemote.LST

    ; *** * Fi l e : D: \ PROGRA~1\ FED\ WI ZPI C\ P16F84. I NC *** *00000 #i ncl ude "D: \ PROGRA~1\ FED\ WI ZPI C\ P16F84. i nc"00001 LI ST00002 ; P16F84. I NC Standard Header Fi l e, Versi on 2. 00 Mi cr ochi p Technol ogy, I nc.001370000200003 #def i ne APROCFREQ D' 4011200'0000400005 #def i ne BI TSI ZE D' 14'00006 #def i ne BOOTADDRESS D' 0'00007 #def i ne FI RSTRAM H' 0C'

    00008 #def i ne LASTRAM H' 4F'00009 #def i ne HASOSCCAL 000010 #def i ne nPAGESRAM 100011 #def i ne nPAGESROM 100012 ;00013 ; Appl i cati on desi gner gl obal s00014 ;00015 vI NTCON=0 ; Val ue l oaded i nto I NTCON dur i ng i ni t i al i sati on00016 vOPTI ON_REG=0x7f ; Val ue l oaded i nto opt i on regi st er duri ng i nti al i sati on00017 vPI E1=0 ; Val ue l oaded i nto PI E1 duri ng i nti al i sati on00018 vPI E2=0 ; Val ue l oaded i nto PI E2 duri ng i nti al i sati on00019 vTRI SA=0xf f ; Val ue l oaded i nto TRI SA duri ng i ni t i al i sati on00020 vTRI SB=0xf f ; Val ue l oaded i nto TRI SA duri ng i ni t i al i sati on00021 vTRI SC=0xf f ; Val ue l oaded i nto TRI SA duri ng i ni t i al i sati on00022 vTRI SD=0xf f ; Val ue l oaded i nto TRI SA duri ng i ni t i al i sati on00023 vTRI SE=0X07 ; Val ue l oaded i nto TRI SA duri ng i ni t i al i sati on00024 vPORTA=0xf f ; Val ue l oaded i nto PORTA dur i ng i ni t i al i sat i on00025 vPORTB=0xf f ; Val ue l oaded i nto PORTA dur i ng i ni t i al i sat i on00026 vPORTC=0xf f ; Val ue l oaded i nto PORTA dur i ng i ni t i al i sat i on00027 vPORTD=0xf f ; Val ue l oaded i nto PORTA dur i ng i ni t i al i sat i on00028 vPORTE=0xf f ; Val ue l oaded i nto PORTA dur i ng i ni t i al i sat i on0002900030 ;00031 ; Macros t o save & r est ore duri ng an i nter r upt00032 ;0003300034 I NTSAVE macr o00035 movwf W_TEMP ; Copy W t o TEMP r egi st er00036 swapf STATUS, w ; Swap st at us t o be saved i nto W00037 cl r f STATUS ; Bank 000038 movwf STATUS_TEMP ; Save st at us00039 movf FSR, w ; Copy FSR t o W00040 movwf FSR_TEMP ; Copy FSR f r om W t o FSR_TEMP00041 #i f ( 1 >1)00042 movf PCLATH, W ; Onl y r equi r ed i f usi ng pages 1, 2 and/ or 300043 movwf PCLATH_TEMP ; Save PCLATH i nt o W00044 cl r f PCLATH ; Page zero, r egardl ess of curr ent page00045 #endi f00046 endm0004700048 I NTRECALL macr o00049 #i f ( 1 >1)00050 movf PCLATH_TEMP, w ; Restor e PCLATH00051 movwf PCLATH ; Move W i nt o PCLATH00052 #endi f00053 movf FSR_TEMP, w ; Whats wr ong wi t h r est or i ng FSR? cqg8dhecq00054 movwf FSR ; Whats wr ong wi t h r est or i ng FSR? cqg8dhecq00055 swapf STATUS_TEMP, w ; Swap STATUS_TEMP r egi st er i nto W00056 movwf STATUS ; Move W i nto STATUS r egi st er00057 swapf W_TEMP, F ; Swap W_TEMP00058 swapf W_TEMP, w ; Swap W_TEMP i nt o W00059 endm0006000061 ;00062 ; Long cal l macro - t hi s set s t he pagi ng bi t s, i t assumes PCLATH00063 ; i s currentl y cl ear, and onl y set s PCLATH i f t he l abel i s unknown (i . e. a00064 ; f orward ref erence), or i t i s known and i s not i n Page 0. I t i s t heref ore more00065 ; ef f i ci ent t han Mi crochi p' s l cal l macro whi ch al ways sets t he pagi ng bi t s00066 ;00067 ; I t onl y sets t he bi t s i f t her e i s more t han 1 page of ROM.00068 ;00069 l ongcal l macr o n00070 i f ( 1 >1)00071 i f ( ( ! n) | | ( n>$) | | n>=0x800) ; Must set pagi ng bi t s00072 i f ( n&0x800)

    00073 bsf PCLATH, 300074 el se00075 bcf PCLATH, 300076 endi f00077 i f ( 1 >2) ; Test 2nd ROM PAGES00078 i f ( n&0x1000)00079 bsf PCLATH, 400080 el se00081 bcf PCLATH, 400082 endi f00083 endi f00084 endi f00085 endi f00086 cal l n ; One PAGES of ROM so si mpl e cal l00087 endm00088 ;00089 ; Thi s i s di f f erent , i t sets t he PCLATH bi t s on t he assumpti on t hat t hey00090 ; are not al r eady known00091 ;00092 ADSetPCLATH macr o n ; Set PCLATH bi t s00093 i f ( 1 >1)00094 i f ( n&0x800)

    00095 bsf PCLATH, 300096 el se00097 bcf PCLATH, 300098 endi f0009900100 i f ( 1 >2)00101 i f ( n&0x1000)00102 bsf PCLATH, 400103 el se

  • 8/22/2019 DTMF Remote Control Decoder

    7/25

    Copyright Geoff Mather G8DHE 2009

    00104 bcf PCLATH, 400105 endi f00106 endi f0010700108 endi f00109 endm0011000111 ;00112 ; Cl ear PCLATH i f i t was set i n a cal l , i f n i s 0 t hen al ways cl ear i t00113 ; onl y cl ear i t i n any case i f more t han 1 page of ROM00114 ;00115 ; Cl earPCLATH macr o n00116 ; i f ( ( ( n>H' 7FF' ) | | ( n==0) ) && ( nPAGESROM>1))00117 ; #i f n&0x80000118 ; bcf PCLATH, 3

    00119 ; #endi f00120 ; #i f n&0x80000121 ; bcf PCLATH, 400122 ; #endi f00123 ; endi f00124 ; endm00125 Cl ear PCLATH macr o n ; cqg8dhecq Repl acment macr o00126 i f ( ( ( n>=H' 800' ) | | ( n==0)) && ( 1 >1))00127 #i f n==000128 cl r f PCLATH00129 el se00130 #i f n&0x80000131 bcf PCLATH, 300132 #endi f00133 #i f n&0x100000134 bcf PCLATH, 400135 #endi f00136 endi f00137 endi f00138 endm0013900140 ;

    00141 ; Vari abl es for i nterrupts00142 ;

    00158 cbl ock H' 0C'000C 00159 W_TEMP ; Save W i n i nterr upt000C 00160 STATUS_TEMP ; Save STATUS i n i nter r upt000C 00161 FSR_TEMP ; Save FSR i n i nter r upt000C 00162 endc

    0016800169 ;00170 ; Macros f or page swi t chi ng vari abl es00171 ; Note we assume t hat al l r out i nes set RP0 and RP1 back to 0 bef ore r etur ni ng00172 ;00173 ADSet RP macr o n00174 i f n&0x8000175 bsf STATUS, RP000176 endi f00177 i f n&0x10000178 bsf STATUS, RP100179 endi f00180 endm0018100182 ADCl ear RP macr o n

    00183 i f n&0x8000184 bcf STATUS, RP000185 endi f00186 i f n&0x10000187 bcf STATUS, RP100188 endi f00189 endm0019000191 ;00192 ; Set I RP for i ndi rect access00193 ;00194 ADSet I RP macr o n00195 i f 1 >200196 i f ( n&0x100)00197 bsf STATUS, I RP00198 el se00199 bcf STATUS, I RP00200 endi f00201 endi f00202 endm0020300204 ;

    00205 ; Corr ect a poi nter t o var i abl es so that t hey al l f i t i n the same memory bl ock00206 ;00207 FI TI NBLOCK macr o Start , Si ze00208 ; #i f ( ( Start &0x7f) +Si ze)>0x80 ; Fai l s when l ast assi gned address i s 7F00209 #i f ( ( ( Start &0x7f) 0x7F) )00210 ; Works f or al l val ues cqg8dhecq00211 Start =( ( Start +0x80)&0x180)+0x2100212 #endi f0021300214 endm00215 ;00216 ; Force a functi on of si ze : all ow to f i t i nto one page of ROM00217 ;00218 MFORCEPAGE macr o al l ow00219 l ocal next00220 next =( $+al l ow+32)&0xf 80000221 i f ( $&0xf 800) ! =next00222 org next00223 endi f00224 endm0022500226 ;00227 ; Thi s macr o del ays an exact00228 ; number of cl ock cycl es between00229 ; 1 at mi ni mum or 186420 at max00230 ;00263 el se ; Versi on f or one ROM page onl y00264 ;00265 ; Thi s macr o del ays an exact00266 ; number of cl ock cycl es between

  • 8/22/2019 DTMF Remote Control Decoder

    8/25

    Copyright Geoff Mather G8DHE 2009

    00267 ; 8 at mi ni mum or 186420 at max00268 ;00269 Del v=000270 DELAY macr o Cyc00271 i f ( CycD' 186420' )00272 Smal l Cyc=Cyc00273 i f ( Smal l Cyc&1)00274 nop00275 Smal l Cyc- =100276 endi f00277 whi l e(Smal l Cyc)00278 goto Del #v( Del v)00279 Del #v( Del v)00280 Del v=Del v+100281 Smal l Cyc- =2

    00282 endw00283 el se00284 Smal l Cyc=Cyc00285 i f Cyc>D' 775'00286 Bi gCyc=( Cyc- D' 730' )00287 LoopDel ay=Bi gCyc/ D' 728'00288 movl w LoopDel ay+100289 cal l Bi gDel00290 Smal l Cyc=Cyc- ( D' 730' +LoopDel ay*D' 728' +3)00291 endi f00292 LoopDel ay=( Smal l Cyc- 3) - 5 ; Del ay

  • 8/22/2019 DTMF Remote Control Decoder

    9/25

    Copyright Geoff Mather G8DHE 2009

    00378 ;00379 ; ***** *****00380 #def i ne Por t Out 5Used 100381 #def i ne I ni t i al Val ue5 D' 0'00382 #def i ne Out 5Port PORTB00383 #def i ne Out5Bi t 500384 ; ***** *****00385 ;00386 ; Por t Dr i ver00387 ;00388 ; ***** *****00389 #def i ne Por t Out 4Used 100390 #def i ne I ni t i al Val ue4 D' 0'00391 #def i ne Out 4Port PORTB00392 #def i ne Out4Bi t 4

    00393 ; ***** *****00394 ;00395 ; Por t Dr i ver00396 ;00397 ; ***** *****00398 #def i ne Por t Out 3Used 100399 #def i ne I ni t i al Val ue3 D' 0'00400 #def i ne Out 3Port PORTB00401 #def i ne Out3Bi t 300402 ; ***** *****00403 ;00404 ; Por t Dr i ver00405 ;00406 ; ***** *****00407 #def i ne Por t Out 2Used 100408 #def i ne I ni t i al Val ue2 D' 0'00409 #def i ne Out 2Port PORTB00410 #def i ne Out2Bi t 200411 ; ***** *****00412 ;00413 ; Por t Dr i ver00414 ;

    00415 ; ***** *****00416 #def i ne Por t Out 1Used 100417 #def i ne I ni t i al Val ue1 D' 0'00418 #def i ne Out 1Port PORTB00419 #def i ne Out1Bi t 100420 ; ***** *****00421 ;00422 ; Por t Dr i ver00423 ;00424 ; ***** *****00425 #def i ne Por t Out 0Used 100426 #def i ne I ni t i al Val ue0 D' 0'00427 #def i ne Out 0Port PORTB00428 #def i ne Out0Bi t 000429 ; ***** *****00430 ;00431 ; Edge Det ect or00432 ;00433 ; ***** *****00434 #def i ne Edge0Used 100435 #def i ne Got Edge0Used 100436 #def i ne Got Edge0Fl ag Fl ag1

    00437 #def i ne Got Edge0Fl agBi t 500438 #def i ne Sel Edge0 D' 1'00439 #def i ne Edge0Port PORTA00440 #def i ne Edge0Bi t 000441 ; ***** *****00442 ;00443 ; Port I nput00444 ;00445 ; ***** *****00446 #def i ne Por t I nUsed 100447 #def i ne Por t I n4Used 100448 #def i ne I n4Port PORTA00449 #def i ne I n4Bi t 000450 ; ***** *****00451 ;00452 ; Port I nput00453 ;00454 ; ***** *****00455 #def i ne Por t I n3Used 100456 #def i ne I n3Port PORTA00457 #def i ne I n3Bi t 100458 ; ***** *****

    00459 ;00460 ; Port I nput00461 ;00462 ; ***** *****00463 #def i ne Por t I n2Used 100464 #def i ne I n2Port PORTA00465 #def i ne I n2Bi t 200466 ; ***** *****00467 ;00468 ; Port I nput00469 ;00470 ; ***** *****00471 #def i ne Por t I n1Used 100472 #def i ne I n1Port PORTA00473 #def i ne I n1Bi t 300474 ; ***** *****00475 ;00476 ; Port I nput00477 ;00478 ; ***** *****00479 #def i ne Por t I n0Used 100480 #def i ne I n0Port PORTA00481 #def i ne I n0Bi t 400482 ; ***** *****00483 ;00484 ; Appl i cati on Desi gner Var i abl es00485 ;00486 ; ***** *****00487

    00488 cbl ock

  • 8/22/2019 DTMF Remote Control Decoder

    10/25

    Copyright Geoff Mather G8DHE 2009

    000F 00489 Fl ag1000F 00490 Temp1000F 00491 Temp2000F 00492 Temp3000F 00493 endc

    00494004950049600497 ; Def i nes speci f i ed by 1 or more el ement s004980049900500 ; * ** I nput Fi l e - D: \ Program Fi l es\FED\ WI ZPI C\ APPWI Z\ Mi sc. I nc0050100502 ;00503 ; Thi s macro al l ows el ement s t o modi f y t he vari abl es whi ch ar e wr i t t en t o

    00504 ; the PORT regi sters on i nit i ali sati on. I t i s cal l ed wi th the00505 ; I OPin port , bit , and wanted i ni ti al val ue00506 ;00507 I NI TOUTPORT macro por t , bi t , val ue ; Note def aul t out put i s 100508 i f val ue==000509 i f def PORTA00510 i f ( por t ==PORTA)00511 vPORTA&=~( 1

  • 8/22/2019 DTMF Remote Control Decoder

    11/25

    Copyright Geoff Mather G8DHE 2009

    0060000601 cbl ock HMSCount

    00602 endc00603

    TRUE 00604 #i f def HourPassUsed ; HMS var i abl es00605 cbl ock

    00A1 00606 Hr Count00A1 00607 Hr Count100A1 00608 Hr Count200A1 00609 Hr Count300A1 00610 endc

    00611 #endi fTRUE 00612 #i f def Mi nPassUsed

    00613 cbl ock00A5 00614 Mi nCount

    00A5 00615 Mi nCount100A5 00616 Mi nCount200A5 00617 endc

    00618 #endi fTRUE 00619 #i f def SecPassUsed

    00620 cbl ock00A8 00621 SecCount00A8 00622 SecCount100A8 00623 endc

    00624 #endi f00625 #endi f006260062700001 ;00002 ; Thi s f i l e i s aut omati cal l y generat ed. Any changes wi l l be overwr i t t en when00003 ; t he appl i cati on i s r egenerated00004 ;

    0000 00005 or g 00x0000 0x0000 00006 nop ; Leave cl ear f or i n ci r cui t debugger

    000070x0001 0x018A 00008 cl r f PCLATH ; Reset progr am page bi t s0x0002 0x2816 00012 goto St ar t

    000130001400015 ;00016 ; I nterr upt s00017 ;

    0004 00018 or g 400019 I NTSAVE ; Save vari abl es

    0x0004 0x008C MACRO movwf W_TEMP ; Copy W t o TEMP r egi st er0x0005 0x0E03 MACRO swapf STATUS, w ; Swap st at us t o be saved i nt o W0x0006 0x0183 MACRO cl r f STATUS ; Bank 00x0007 0x008D MACRO movwf STATUS_TEMP ; Save st at us0x0008 0x0804 MACRO movf FSR, w ; Copy FSR t o W0x0009 0x008E MACRO movwf FSR_TEMP ; Copy FSR f r om W t o FSR_TEMP

    00020 Cl ear PCLATH 000021 I ntPri : ; Pr i or i ty I nterrupts here00022

    0x000A 0x2849 00023 goto User I nter r upt00024 Aut oI nt :

    TRUE 00025 #i f def Tmr 0I ntUsed ; Ti mer 00x000B 0x1D0B 00026 bt f ss I NTCON, T0I F ; Test Ti mer 0 overf l ow0x000C 0x280F 00027 goto Tmr 0_I nt1 ; No overf l owTRUE 00028 #i f def Of Used

    0x000D 0x148F 00029 bsf Fl ag1 , 1 ; Set bi t t o show occur r ence00030 #endi f

    0x000E 0x110B 00031 bcf I NTCON, T0I F ; Cl ear i nterr upt00032 Tmr 0_I nt1: ; J ump her e i f no i nter r upt00033 #endi f0003400035 I NTRECALL ; Rest ore vari abl es af t er i nter r upt

    0x000F 0x080E MACRO movf FSR_TEMP, w ; Whats wr ong wi t h r est or i ng FSR? cqg8dhecq0x0010 0x0084 MACRO movwf FSR ; What s wr ong wi t h r est or i ng FSR? cqg8dhecq0x0011 0x0E0D MACRO swapf STATUS_TEMP, w ; Swap STATUS_TEMP r egi st er i nto W0x0012 0x0083 MACRO movwf STATUS ; Move W i nt o STATUS r egi st er0x0013 0x0E8C MACRO swapf W_TEMP, F ; Swap W_TEMP0x0014 0x0E0C MACRO swapf W_TEMP, w ; Swap W_TEMP i nt o W0x0015 0x0009 00036 r et f i e

    0003700038 ;00039 ; I ni t i al i sati on - i ni t i al i se el ements i n turn00040 ;00041 Star t :

    0x0016 0x0183 00042 cl r f STATUS ; Reset RAM page bi t s0x0017 0x018B 00043 cl r f I NTCON ; Di sabl e i nter r upt s0x0018 0x0184 00052 cl r f FSR ; Poi nt t o l ower RAM page

    0005300054 ADI ni t :00055 l PSD=D' 4' ; Ti mer 000056 vor =- 2

    TRUE 00057 whi l e l PSD00058 vor =vor +100059 l PSD>>=100058 vor =vor +100059 l PSD>>=100058 vor =vor +100059 l PSD>>=100060 endw

    TRUE 00061 #i f D' 1'00062 vOPTI ON_REG&=~( ( 1

  • 8/22/2019 DTMF Remote Control Decoder

    12/25

    Copyright Geoff Mather G8DHE 2009

    0008300084 vTRI SB&=H' EF'00085 I NI TOUTPORT PORTB , 3 , D' 0' ; Port Dr i ver0008600087 vTRI SB&=H' F7'00088 I NI TOUTPORT PORTB , 2 , D' 0' ; Port Dr i ver0008900090 vTRI SB&=H' FB'00091 I NI TOUTPORT PORTB , 1 , D' 0' ; Port Dr i ver0009200093 vTRI SB&=H' FD'00094 I NI TOUTPORT PORTB , 0 , D' 0' ; Port Dr i ver0009500096 vTRI SB&=H' FE'00097 ; Por t I nput

    0009800099 ; Por t I nput0010000101 ; Por t I nput0010200103 ; Por t I nput0010400105 ; Por t I nput00106

    0x001A 0x018F 00107 cl r f Fl ag100108

    0x001B 0x3020 00109 movl w vI NTCON0x001C 0x008B 00110 movwf I NTCONTRUE 00111 #i f def PORTA0x001D 0x30FF 00112 movl w vPORTA0x001E 0x0085 00113 movwf PORTA

    00114 #endi fTRUE 00115 #i f def PORTB0x001F 0x3000 00116 movl w vPORTB0x0020 0x0086 00117 movwf PORTB

    00118 #endi f0x0021 0x1683 00131 bsf STATUS, RP0

    0x0022 0x3041 00132 movl w vOPTI ON_REG0x0023 0x0081 00133 movwf OPTI ON_REGTRUE 00142 #i f def TRI SA0x0024 0x30FF 00143 movl w vTRI SA0x0025 0x0085 00144 movwf TRI SA

    00145 #endi fTRUE 00146 #i f def TRI SB0x0026 0x3000 00147 movl w vTRI SB0x0027 0x0086 00148 movwf TRI SB

    00149 #endi f00162 ; ********************* ********************** ********************** **************00163 ; Added by Geof f Mather t o handl e di f f erences wi t h A/ D chi ps t hat assi gn PORTA00164 ; as anal oge on power up as opposed t o di gi t al I / Ps CQG8DHECQ00170 ; ********************* ********************** ********************** **************

    0x0028 0x1283 00171 bcf STATUS, RP00017200173 ADI ni t End:00174 l ongcal l I ni t Edge

    0x0029 0x2211 MACRO cal l I ni t Edge ; One PAGES of ROM so si mpl e cal l00175 l ongcal l HMSI ni t

    0x002A 0x224A MACRO cal l HMSI ni t ; One PAGES of ROM so si mpl e cal l0x002B 0x204A 00176 cal l UserI ni t i al i se

    0x002C 0x178B 00177 bsf I NTCON, GI E ; Fi nal l y enabl e i nter r upt s0017800179 ;00180 ; Mai n Loop - handl e occur r ences as t hey are f l agged00181 ;00182 Mai n:00183 l ongcal l Test Edge1

    0x002D 0x221E MACRO cal l Test Edge1 ; One PAGES of ROM so si mpl e cal l0x002E 0x1C0F 00184 bt f ss Fl ag1 , 0 ; Det ect ed Sel ect ed Edge0x002F 0x2832 00185 got o Got Edge1End

    00186 l ongcal l CTone0x0030 0x21C8 MACRO cal l CTone ; One PAGES of ROM so si mpl e cal l0x0031 0x100F 00187 bcf Fl ag1 , 0

    00188 Got Edge1End:0x0032 0x1C8F 00189 btf ss Fl ag1 , 1 ; Ti mer 0 over f l ow0x0033 0x2837 00190 got o Of End

    00191 l ongcal l HMSTi ck0x0034 0x225C MACRO cal l HMSTi ck ; One PAGES of ROM so si mpl e cal l

    00192 l ongcal l T0Tone0x0035 0x21D4 MACRO cal l T0Tone ; One PAGES of ROM so si mpl e cal l0x0036 0x108F 00193 bcf Fl ag1 , 1

    00194 Of End:

    0x0037 0x1D0F 00195 bt f ss Fl ag1 , 2 ; Occur s once every second0x0038 0x283B 00196 got o SecPassEnd

    00197 l ongcal l Count Down0x0039 0x2120 MACRO cal l CountDown ; One PAGES of ROM so si mpl e cal l0x003A 0x110F 00198 bcf Fl ag1 , 2

    00199 SecPassEnd:0x003B 0x1D8F 00200 bt f ss Fl ag1 , 3 ; Occur s once every mi nute0x003C 0x283F 00201 got o Mi nPass End

    00202 l ongcal l Ti meMi n0x003D 0x2161 MACRO cal l Ti meMi n ; One PAGES of ROM so si mpl e cal l0x003E 0x118F 00203 bcf Fl ag1 , 3

    00204 Mi nPass End:0x003F 0x1E0F 00205 bt f ss Fl ag1 , 4 ; Occur s once every hour0x0040 0x2843 00206 got o Hour Pass End

    00207 l ongcal l Ti meHour0x0041 0x2182 MACRO cal l Ti meHour ; One PAGES of ROM so si mpl e cal l0x0042 0x120F 00208 bcf Fl ag1 , 4

    00209 Hour Pass End:00210 l ongcal l Test Edge0

    0x0043 0x2214 MACRO cal l Test Edge0 ; One PAGES of ROM so si mpl e cal l0x0044 0x1E8F 00211 bt f ss Fl ag1 , 5 ; Det ect ed Sel ect ed Edge0x0045 0x2848 00212 got o Got Edge0End

    00213 l ongcal l ReadDTMF0x0046 0x2112 MACRO cal l ReadDTMF ; One PAGES of ROM so si mpl e cal l0x0047 0x128F 00214 bcf Fl ag1 , 5

    00215 Got Edge0End:0x0048 0x285C 00219 got o UserLoop

    0022000221 ;00222 ; Load osci l l ator cal i brati on val ue on r eset f or 14 bi t processors

  • 8/22/2019 DTMF Remote Control Decoder

    13/25

    Copyright Geoff Mather G8DHE 2009

    00223 ;00233002340023500001 ; G8DHE no 1 cl ock needs 401600000002 ; G4PAP no 1 cl ock needs 401120000003 ; Thi s f i l e i ncl udes al l user defi nabl e rout i nes. I t may be changed at wi l l as00004 ; i t wi l l not be regener ated once t he appl i cati on has been gener ated f or t he00005 ; f i rst ti me.00006 ;Ver si on = 1.400007 ; versi on 1.0 Basi c r el ay operat i ons00008 ; 1.4 I ncl udes reduct i on of PI N t o a si ngl e * code00009 ; DTMF Remot e operat i on00010 ; Thi s progr amdetect s a sequence of DTMF si gnal t ones f r om a HT9170 decoder00011 ; connect ed t o PORT A, DV=b0, D0=b1, D1=b2, D2=b3 & D3=b4

    00012 ; Looks f or a 4 di gi t PI N sequence hel d i n Fl ash memory bytes 0-3.00013 ; Once t he PI N has been reci eved a Ti mer i s st art ed, of a durat i on hel d00014 ; i n Fl ash memory at byte 8, duri ng whi ch t he remai ni ng command si gnal s must00015 ; be r ecei ved.00016 ; The command si gnal s consi st of a si ngl e key f ol l owed by a paramet er.00017 ;Keys 1- 8 i denti f i es the rel ay t o be changed,00018 ; a paramet er of 0= 0x0A =Of f , 1= 0x01 = On.00019 ; The PI N number can be changed by sendi ng a DTMF A = 0x0D f ol l owed00020 ; by a new 4 di gi t par ameter ( excl udi ng DTMF code #) whi ch i s t hen stor ed00021 ; i n Fl ash memory byt es 4-7, t hi s must t hen be mat ched by enteri ng t he sequence00022 ; a second ti me af t er whi ch i t i s copi ed t o l ocat i ons 0-3.00023 ; A command of DTMF B =0x0E al l ows t he t i mer val ue t o be set ,00024 ; wi t h a paramet er i n deci mal seconds bet ween 1 and 255 endi ng wi t h DTMF *.00025 ; On recei pt of DTMF # = 0x0C t hen al l operat i ons ar e reset and the ti mer st opped.00026 ; A new PI N sequence wi l l t hen be requi red to i ni t i ate fur t her codes.00027 ;00028 ; On f i r st oper at i on the PI N i s DTMF CCCC and t he Ti mer val ue i s 256 seconds00029 ;00030 ; I n summar y00031 ; 4 Di gi t PI N f ol l owed by t he peri od set by the Ti mer t o send commands i n.00032 ; Commands ar e;00033 ; 1- 8 to sel ect a Rel ay fol l owed by 0 or 1 to Rel ease / Oper ate

    00034 ; " A" f ol l owed by new PI N, f ol l owed by a repeat of t he new PI N i t wi l l t hen be00035 ; st ored and t he sessi on ended.00036 ; "B" f ol l owed by upto 3 di gi t s l ess t han 255 and endi ng wi t h *00037 ; wi l l set t he Ti mer val ue i n seconds f rom t he next access.00038 ; "#" wi l l end t he cur r ent command sessi on.00039 ; Any i nval i d command or parameter wi l l cause t he sessi on t o end, t he PI N wi l l00040 ; need to be re- ent ered to conti nue.00041 ; DTMF KEYS t o HEX00042 ;00043 ; 1=01 2=02 3=03 A=0D00044 ; 4=04 5=05 6=06 B=0E00045 ; 7=07 8=08 9=09 C=0F00046 ; *=0B 0=0A #=0C D=0000047 ;00048 ; ********************* ********************** ********************** **************00049 ;00050 ; I nser t your i nterr upt handl i ng code i f requi red here. Your code shoul d fi ni sh00051 ; wi t h the l i ne "goto AutoI nt"00052 ;0005300054 UserI nter r upt :

    0x0049 0x280B 00055 goto Aut oI nt ; Ret urn t o App Desi gner i nter r upts

    000560005700058 ; ********************* ********************** ********************** **************00059 ;00060 ; I nsert your i ni t i ali sati on code i f requi red here. Your code shoul d fi ni sh wi th00061 ; t he l i ne "return". Note that when this routi ne i s cal l ed I nt errupts wi l l not00062 ; be enabl ed - t he Appl i cati on Desi gner wi l l enabl e thembef ore t he mai n l oop00063 ;

    00064 cbl ock00AA 00065 Curr ent ; Curr ent DTMF t one bei ng process ed00AA 00066 CopyCount ; used f or copyi ng new PI N bytes00AA 00067 TCount ; Temp count er00AA 00068 Ti meCD ; Count Down Ti mer r eset on Zero00AA 00069 NewTi me ; New Ti me t emporary val ue00AA 00070 Rel ay ; Rel ay sel ect ed00AA 00071 R2T ; Rel ays 2 Toggl e00AA 00072 Rel ayCD ; Rel ay Count Down Ti mer00AA 00073 Rel ayTSt at e ; Rel ay Toggl e State00AA 00074 ; b0=Rel ay St at e00AA 00075 DTMFSt at us ; b0- b1 PI N count00AA 00076 ; b2 Val i d PI N r ecei eved00AA 00077 ; b3 New PI N f l ag

    00AA 00078 ; b4 Match New PI N f l ag00AA 00079 ; b5 New Toggl e t i mes00AA 00080 ; b6 New Ti mer00AA 00081 ; b7 New Cl ock Ti mes00AA 00082 DTMFTone ; b0 Zero t hen OK t one, One t hen Reset t one00AA 00083 ; b1 Tone out00AA 00084 ; b2 / 2 f l ag f or l ow t one00AA 00085 ; b3 RESET PI N f l ag00AA 00086 ; b4- 6 spar e00AA 00087 ; b7 New DTMF t one00AA 00088 R2Ti me ; Rel ays t o t i me00AA 00089 MOf f ; Mi nutes Of f00AA 00090 HOf f ; Hours Of f00AA 00091 MOn ; Mi nut es On00AA 00092 HOn ; Hour s On00AA 00093 Mi nutes ; Mi nutes count er00AA 00094 Hours ; Hours counter00AA 00095 TMOf f00AA 00096 THOf f00AA 00097 TMOn00AA 00098 THOn00AA 00099 TM00AA 00100 TH ; Temp ver si ons of above00AA 00101 ToneCount00AA 00102 endc

    00103 UserI ni ti al i se:0x004A 0x01AA 00104 cl r f Cur r ent0x004B 0x01AB 00105 cl r f CopyCount0x004C 0x01AD 00106 cl r f Ti meCD0x004D 0x01AE 00107 cl r f NewTi me

  • 8/22/2019 DTMF Remote Control Decoder

    14/25

    Copyright Geoff Mather G8DHE 2009

    0x004E 0x01AF 00108 cl r f Rel ay0x004F 0x01B0 00109 cl r f R2T0x0050 0x01B5 00110 cl r f R2Ti me0x0051 0x01B1 00111 cl r f Rel ayCD0x0052 0x01B2 00112 cl r f Rel ayTSt ate0x0053 0x01B3 00113 cl r f DTMFSt at us0x0054 0x01B4 00114 cl r f DTMFTone0x0055 0x01BB 00115 cl r f Hours0x0056 0x01BA 00116 cl r f Mi nutes0x0057 0x01B9 00117 cl r f HOn0x0058 0x01B7 00118 cl r f HOf f0x0059 0x01B8 00119 cl r f MOn0x005A 0x01B6 00120 cl r f MOf f0x005B 0x0008 00121 r et urn ; Ret urn t o App Desi gner

    00122

    00123 ; ********************* ********************** ********************** **************00124 ;00125 ; I nser t your mai n l oop code i f r equi red here. Your code shoul d fi ni sh wi t h00126 ; t he l i ne "goto Mai n"00127 ;00128 User Loop:

    0x005C 0x1FB4 00129 bt f ss DTMFTone, 7 ; Check f or a new t one r ecei eved0x005D 0x282D 00130 goto Mai n ; No so back t o mai n l oop0x005E 0x300C 00131 movl w 0x0C ; Check f or a r eset0x005F 0x022A 00132 subwf Cur r ent, W ; Test i t0x0060 0x1903 00133 skpnz0x0061 0x28FD 00134 goto PI Nf ai l ; Does a r eset on r ecei vi ng DTMF #0x0062 0x19B3 00135 bt f sc DTMFStat us, 3 ; Are we deal i ng wi t h a PI N set0x0063 0x28BA 00136 goto NewPI N ; Yes so handl e i t0x0064 0x1A33 00137 btf sc DTMFStat us, 4 ; I s i t a Match new PI N0x0065 0x28C1 00138 goto MatchI t ; Yes so handl e i t0x0066 0x1D33 00139 bt f ss DTMFStat us, 2 ; Has a PI N been r ecei ved0x0067 0x28D7 00140 goto Pi ns ; No so handl e i ncomi ng PI N0x0068 0x1AB3 00141 bt f sc DTMFStat us, 5 ; New t i me set t i ngs ?0x0069 0x28F5 00142 goto NewTi mes ; Yes so handl e t hem0x006A 0x1B33 00143 bt f sc DTMFSt at us, 6 ; Check f or NewTi mer0x006B 0x28F5 00144 goto NewTi mes ; Handl es both t ypes now

    0x006C 0x1BB3 00145 bt f sc DTMFStat us, 7 ; Check f or New Cl ock Ti mes0x006D 0x2983 00146 goto NewCl ock ; Handl e Cl ock t i mes0x006E 0x08AF 00147 movf Rel ay ; Test i f we have a Rel ay number0x006F 0x1903 00148 skpnz0x0070 0x2895 00149 got o Choose

    00150 Operat eRel ay:0x0071 0x03AA 00151 decf Cur r ent ; Check f or a DTMF 1 = Operat e r el ay0x0072 0x1D03 00152 skpz0x0073 0x287A 00153 goto Rel ayToggl e ; Not a 1 so Cur r ent=Cur r ent- 1

    00154 movfw Rel ay ; get t he r el ay t o be operat ed0x0074 0x082F MACRO0x0075 0x0486 00155 i orwf PORTB ; Set t he bi t t o oper at e t he r el ay0x0076 0x092F 00156 comf Rel ay, W ; Cl ear Toggl e bi t j ust i n case0x0077 0x05B0 00157 andwf R2T ; i t was t oggl i ng

    00158 ; andwf R2Ti me ; and any Ti med r el ay; NO doesn' t make sense0x0078 0x01AF 00159 cl r f Rel ay ; Cl ear Rel ay r eady f or next t i me0x0079 0x28E7 00160 goto Done ; Al l done

    00161 Rel ayToggl e:0x007A 0x03AA 00162 decf Cur r ent ; Check f or a DTMF 2 = Toggl e r el ay0x007B 0x1D03 00163 skpz0x007C 0x2885 00164 goto Cl ocked ; Not a 2 so Cur r ent=Cur r ent- 2

    00165 movf w Rel ay ; Get r el ay f l ag bi t

    0x007D 0x082F MACRO0x007E 0x06B0 00166 xorwf R2T ; Toggl e R2T bi t s as r el evant0x007F 0x092F 00167 comf Rel ay, W ; get t he compl ement

    00168 ; andwf R2Ti me ; and cl ear any t i med r el ay; No as above0x0080 0x1432 00169 bsf Rel ayTSt ate, 0 ; Set t he Toggl e State t o oper ate next0x0081 0x3001 00170 movl w 0x01 ; Setup t he Rel ayCD t i me t o 10x0082 0x00B1 00171 movwf Rel ayCD ; and cause t he t i mer t o r unout !0x0083 0x01AF 00172 cl r f Rel ay0x0084 0x28E7 00173 got o Done

    00174 Cl ocked:0x0085 0x03AA 00175 decf Cur r ent ; Check f or DTMF 3 = Cl ock Ti me0x0086 0x1D03 00176 skpz0x0087 0x288C 00177 goto Rel ease ; Not a 3 so Cur r ent=Cur r ent- 3

    00178 movf w Rel ay ; Get t he r el ay f l ag bi t0x0088 0x082F MACRO0x0089 0x06B5 00179 xorwf R2Ti me ; Toggl e t he bi t s as r el evant0x008A 0x01AF 00180 cl r f Rel ay ;0x008B 0x28E7 00181 goto Done ; Thats i t

    00182 Rel ease:0x008C 0x3007 00183 movl w 0x07 ; 0=0x0A- 3=0x070x008D 0x022A 00184 subwf Cur r ent, W ; i f i t was a Zer o=100x008E 0x1D03 00185 skpz

    0x008F 0x28FD 00186 goto PI Nf ai l ; wasn' t a DTMF 0 so r eset0x0090 0x092F 00187 comf Rel ay, W ; Take t he i nver se of r el ay sel ected0x0091 0x0586 00188 andwf PORTB ; and cl ear t he bi t t o r el ease t he r el ay0x0092 0x05B0 00189 andwf R2T ; Al so cl ear any Toggl e bi t

    00190 ; andwf R2Ti me ; and any t i med r el ay; NO as above0x0093 0x01AF 00191 cl r f Rel ay ; Cl ear Rel ay r eady f or next t i me0x0094 0x28E7 00192 goto Done ; Al l done

    00193 Choose:0x0095 0x300D 00194 movl w 0x0D ; Check f or New PI N command0x0096 0x022A 00195 subwf Cur r ent, W ; Check i t0x0097 0x1D03 00196 skpz0x0098 0x289B 00197 goto Test T ; No so i t coul d be a SET TI MER command0x0099 0x15B3 00198 bsf DTMFStat us, 3 ; Set NEWPI N f l ag0x009A 0x28E7 00199 got o Done0x009B 0x300E 00200 Test T: movl w 0x0E ; Check f or New Ti mer val ue0x009C 0x022A 00201 subwf Cur r ent, W ; Check i t0x009D 0x1D03 00202 skpz0x009E 0x28A2 00203 goto Ti mesT ; No so what about Changi ng t i mes0x009F 0x1733 00204 bsf DTMFStat us, 6 ; Set t he Fl ag0x00A0 0x01AE 00205 cl r f NewTi me0x00A1 0x28E7 00206 got o Done0x00A2 0x300F 00207 Ti mesT: movl w 0x0F ; Check f or C key0x00A3 0x022A 00208 subwf Cur r ent, W ; Check i t0x00A4 0x1D03 00209 skpz0x00A5 0x28AA 00210 goto Test Cl ock ; No so now f or Cl ock0x00A6 0x16B3 00211 bsf DTMFStat us, 5 ; Set t he New Ti mes f l ag0x00A7 0x3002 00212 movl w 0x02 ; Use as par t counter0x00A8 0x00AB 00213 movwf CopyCount ; and t hi s i s part t wo0x00A9 0x28E7 00214 got o Done

    00215 Test Cl ock:

  • 8/22/2019 DTMF Remote Control Decoder

    15/25

    Copyright Geoff Mather G8DHE 2009

    0x00AA 0x08AA 00216 movf Curr ent ; Checki ng f or D key ( 0x00)0x00AB 0x1D03 00217 skpz0x00AC 0x28B3 00218 goto Test Rel ay ; No so i t must be a r el ay0x00AD 0x17B3 00219 bsf DTMFStat us, 7 ; Set t he f l ag bi t0x00AE 0x3006 00220 movl w 0x06 ; Use as par t counter0x00AF 0x00AB 00221 movwf CopyCount ; and t hi s i s part t hree0x00B0 0x3002 00222 movl w 0x02 ; Two di gi t s each0x00B1 0x00AC 00223 movwf TCount ; Set t emp count er t o 2 f or di gi t s.0x00B2 0x28E7 00224 got o Done

    00225 Test Rel ay:0x00B3 0x1403 00226 set c ; Set t he C f l ag and r otat e up sel ecti on0x00B4 0x0DAF 00227 Rotat e: r l f Rel ay ; Move i n Bi t0x00B5 0x1803 00228 skpnc ; Test t o make sur e not great er t han 80x00B6 0x28FD 00229 goto PI Nf ai l ; More t han 8 so r eset syst em0x00B7 0x0BAA 00230 decf sz Cur r ent ; Count i t down

    0x00B8 0x28B4 00231 goto Rotat e ; Move up agai n0x00B9 0x28E7 00232 goto Done ; Fi ni shed00233 NewPI N:00234 movf w DTMFStat us ; Get DTMFStat us i n order t o get PI N count

    0x00BA 0x0833 MACRO0x00BB 0x3907 00235 andl w 0x07 ; Poi nt at byt es 4-7 r ather t han 0-30x00BC 0x00C3 00236 movwf EEPromAdr ; Poi nt at pl ace t o save

    00237 movf w Cur r ent ; get new DTMF code0x00BD 0x082A MACRO0x00BE 0x2232 00238 cal l EEPROMWRI TE ; and save t he val ue0x00BF 0x0AB3 00239 i ncf DTMFSt at us ; Move up t he count when 4 Rx t hen

    00240 ; Match New PI N f l ag i s set0x00C0 0x28E7 00241 goto Done ; Keep l oopi ng

    00242 MatchI t :00243 movfw DTMFStat us ; get st atus i n order t o get PI N count

    0x00C1 0x0833 MACRO0x00C2 0x3903 00244 andl w 0x03 ; Mask out al l but PI N count0x00C3 0x3E04 00245 addl w 0x04 ; Poi nt at bytes t o Mat ch0x00C4 0x00C3 00246 movwf EEPromAdr ; Save as Address t o be mat ched t o0x00C5 0x2228 00247 cal l EEPROMREAD ; Get val ue t o be checked f or0x00C6 0x02AA 00248 subwf Cur r ent ; Compare i t0x00C7 0x1D03 00249 skpz

    0x00C8 0x28FD 00250 goto PI Nf ai l ; Oops not r i ght0x00C9 0x0AB3 00251 i ncf DTMFSt at us ; OK when al l 4 mat ch t hen PI N Val i d set0x00CA 0x1D33 00252 bt f ss DTMFStat us, 2 ; Check f or al l mat ched0x00CB 0x28E7 00253 goto Done ; Not yet so conti nue l oopi ng

    00254 CopyPI N:0x00CC 0x3004 00255 movl w 0x04 ; byt e+1 t o copy i nto0x00CD 0x00C3 00256 movwf EEPr omAdr ; save f or address0x00CE 0x03C3 00257 CLoop: decf EEPromAdr ; Move i t down0x00CF 0x1543 00258 bsf EEPr omAdr , 2 ; Poi nt at byte t o copy0x00D0 0x2228 00259 cal l EEPROMREAD ; Read Byte0x00D1 0x1143 00260 bcf EEPr omAdr , 2 ; Poi nt at save area0x00D2 0x2232 00261 cal l EEPROMWRI TE ; Wr i t e i t0x00D3 0x08C3 00262 movf EEPromAdr ; Test i t0x00D4 0x1D03 00263 skpz0x00D5 0x28CE 00264 goto CLoop ; Not f i ni shed yet0x00D6 0x28FD 00265 got o PI Nf ai l ; Onl y t o f orce a r eset!

    00266 Pi ns:00267 movfw DTMFStat us ; get st atus i n order t o get PI N count

    0x00D7 0x0833 MACRO0x00D8 0x3903 00268 andl w 0x03 ; Mask out al l but PI N count0x00D9 0x00C3 00269 movwf EEPromAdr ; Save as Address t o be mat ched t o0x00DA 0x2228 00270 cal l EEPROMREAD ; Get val ue t o be checked f or

    0x00DB 0x390F 00271 andl w 0x0f ; To t ake car e of Hi gh ni bbl e0x00DC 0x022A 00272 subwf Cur r ent , W ; Compare i t0x00DD 0x1D03 00273 skpz0x00DE 0x28FD 00274 goto PI Nf ai l ; Oops not r i ght0x00DF 0x0A33 00275 i ncf DTMFStat us, W ; OK when al l 4 mat ch t hen PI N Val i d set0x00E0 0x00B3 00276 movwf DTMFSt at us ; Save i t0x00E1 0x3903 00277 andl w 0x03 ; Mask count agai n0x00E2 0x3C01 00278 subl w 0x01 ; I f i t s t he f i rst t i me0x00E3 0x1903 00279 skpnz NF ; t hen cal l check st ars el se cont i nue0x00E4 0x21F8 00280 cal l CheckSt ar s0x00E5 0x1933 00281 NF bt f sc DTMFSt at us, 20x00E6 0x210D 00282 cal l LoadTi mer ; Load i n t he t i mer count0x00E7 0x13B4 00283 Done: bcf DTMFTone, 7 ; Cl ear New t one bi t0x00E8 0x1034 00284 bcf DTMFTone, 0 ; OK Tone on f al l i ng edge Por t A00x00E9 0x282D 00285 goto Mai n ; Cont i nue

    00286 NTStore:0x00EA 0x3005 00287 movl w 0x05 ; Check f or mi ni mum of 5 seconds0x00EB 0x022E 00288 subwf NewTi me, W ; Check i t0x00EC 0x1C03 00289 skpc0x00ED 0x28FD 00290 goto PI Nf ai l ; l ess t han 5 so r eset0x00EE 0x3008 00291 movl w 0x08 ; Poi nt t o f l ash l ocat i on0x00EF 0x00C3 00292 movwf EEPromAdr ; Save l ocat i on

    00293 movf w NewTi me ; get new val ue0x00F0 0x082E MACRO0x00F1 0x2232 00294 cal l EEPROMWRI TE ; Save i t0x00F2 0x01AE 00295 cl r f NewTi me ; r eset t he val ue0x00F3 0x1333 00296 bcf DTMFStat us, 6 ; Cl ear t he New t i mer f l ag0x00F4 0x28E7 00297 got o Done ; OK compl et ed

    00298 NewTi mes:0x00F5 0x213C 00299 cal l NTi me ; Add t he next di gi t0x00F6 0x1803 00300 skpnc ; Test f or C set0x00F7 0x28FB 00301 goto NTSoR ; Yes i t s set check next0x00F8 0x1903 00302 skpnz0x00F9 0x28E7 00303 goto Done ; Z=1, C=0 so get next key0x00FA 0x2800 00304 goto 0 ; Oops Z=0 C=0 not val i d! ! ! ! Rest art ! !

    00305 NTSoR:0x00FB 0x1D03 00306 skpz ; Test f or Z bi t0x00FC 0x2900 00307 goto NTSave ; Save val ue ot herwi se f al l t hru t o Reset

    00308 PI Nf ai l :0x00FD 0x2159 00309 cal l ResetVal ues ; Restar t al l val ues0x00FE 0x1434 00310 bsf DTMFTone, 0 ; Reset Tone on f al l i ng edge Port A 00x00FF 0x282D 00311 goto Mai n ; Retur n t o App Desi gner mai n l oop

    00312 NTSave:0x0100 0x1EB3 00313 bt f ss DTMFStat us, 5 ; I t s Rel ay t i mes not t i me out0x0101 0x28EA 00314 goto NTStor e ; Store new t i mer peri od

    00315 movf w CopyCount ; Get t he val ue poi nter0x0102 0x082B MACRO0x0103 0x3808 00316 i orl w 0x08 ; t o gener ate byt e i n Fl ash0x0104 0x00C3 00317 movwf EEPr omAdr ; Save poi nt er

    00318 movf w NewTi me ; Get t he val ue0x0105 0x082E MACRO0x0106 0x2232 00319 cal l EEPROMWRI TE ; save t he val ue

  • 8/22/2019 DTMF Remote Control Decoder

    16/25

    Copyright Geoff Mather G8DHE 2009

    0x0107 0x01AE 00320 cl r f NewTi me0x0108 0x03AB 00321 decf CopyCount ; Move down t he poi nter0x0109 0x1D03 00322 skpz0x010A 0x290C 00323 got o NT20x010B 0x12B3 00324 bcf DTMFStat us, 5 ; Cl ear t he Fl ag as i t s done0x010C 0x28E7 00325 NT2: goto Done ; And now back i n both condi t i ons

    00326 ; ********************* ********************** ********************** **************00327 LoadTi mer :

    0x010D 0x3008 00328 movl w 0x08 ; Poi nt at f l ash addr ess0x010E 0x00C3 00329 movwf EEPr omAdr0x010F 0x2228 00330 cal l EEPROMREAD ; Get t he count0x0110 0x00AD 00331 movwf Ti meCD ; save i t i n t he count er0x0111 0x0008 00332 r etur n ; f i ni shed

    00333 ;Ri si ng edge r out i ne00334 ReadDTMF:

    0x0112 0x1683 00335 bsf STATUS, RP00x0113 0x1485 00336 bsf TRI SA, 1 ; Make sure Bi t 1 i s an i nput0x0114 0x1283 00337 bcf STATUS, RP0

    00338 DELAY . 1000 ; del ay 1000us=1ms0x0115 0x3001 MACRO movl w LoopDel ay+10x0116 0x220B MACRO cal l Bi gDel0x0117 0x3057 MACRO movl w LoopDel ay/ 3+10x0118 0x2206 MACRO c al l Del ay0- LoopDel ay%30x0119 0x1003 00339 cl r c ; Cl ear t he C f l ag bef ore0x011A 0x0C05 00340 r r f PORTA, W ; r otat i ng Por t A i nto W0x011B 0x00AA 00341 movwf Cur r ent ; Save cur r ent val ue0x011C 0x17B4 00342 bsf DTMFTone, 7 ; I ndi cat e new t one r ecei eved0x011D 0x30F8 00343 movl w 0xF8 ; Cl ear Tone f l ags0x011E 0x05B4 00344 andwf DTMFTone0x011F 0x0008 00345 r et urn

    00346 ; ********************* ********************** ********************** **************00347 ; Count Down of Ti mer00348 Count Down:

    0x0120 0x08AD 00349 movf Ti meCD ; Test t o see i f i t s r unni ng0x0121 0x1903 00350 skpnz0x0122 0x2926 00351 goto RCD ; Zer o not r unni ng check f or r el ay t i mes0x0123 0x0BAD 00352 decf sz Ti meCD ; Count Down

    0x0124 0x2926 00353 got o RCD0x0125 0x2159 00354 cal l ResetVal ues ; Restar t al l val ues

    00355 RCD:0x0126 0x08B0 00356 movf R2T ; t est t o see i f any are t oggl i ng0x0127 0x1903 00357 skpnz0x0128 0x0008 00358 r etur n ; Retur n so t hat Ti me st ands st i l l0x0129 0x03B1 00359 decf Rel ayCD ; Count Down r el ay t i mes0x012A 0x1D03 00360 skpz0x012B 0x0008 00361 r eturn ; Not t i me t o t oggl e yet0x012C 0x1832 00362 bt f sc Rel ayTSt ate, 0 ; Are we Operat i ng or Rel easi ng ?0x012D 0x2933 00363 goto RTOperat e ; Was r el eased so now Operat e

    00364 RTRel ease:0x012E 0x0930 00365 comf R2T, W ; I nvert bi t s i nto W0x012F 0x0586 00366 andwf PORTB ; Cl ear t he Rel ay( s)0x0130 0x3009 00367 movl w 0x09 ; Load t he poi nter t o Rel eased t i me0x0131 0x00C3 00368 movwf EEPromAdr ; Poi nt t o i t0x0132 0x2937 00369 got o RTSetupTi me

    00370 RTOper at e:00371 movfw R2T ; get t he bi t s i nto W

    0x0133 0x0830 MACRO0x0134 0x0486 00372 i orwf PORTB ; Set t he Rel ay( s)0x0135 0x300A 00373 movl w 0x0A ; Load poi nter t o Operat ed t i me

    0x0136 0x00C3 00374 movwf EEPromAdr ; Poi nt t o i t00375 RTSet upTi me:

    0x0137 0x2228 00376 cal l EEPROMREAD ; Get new t i me0x0138 0x00B1 00377 movwf Rel ayCD ; save as new t i me per i od0x0139 0x3001 00378 movl w 0x01 ; Setup t o change Rel ay State0x013A 0x06B2 00379 xorwf Rel ayTSt ate ; t oggl e t he st ate bi t0x013B 0x0008 00380 r eturn ; That s i t

    00381 ; ********************* ********************** ********************** **************00382 NTi me:

    0x013C 0x300B 00383 movl w 0x0B ; Check f or end of sequence0x013D 0x022A 00384 subwf Cur r ent , W0x013E 0x1903 00385 skpnz0x013F 0x2953 00386 goto NTSaveI t0x0140 0x300A 00387 movl w 0x0A ; Check agai nst 100x0141 0x022A 00388 subwf Cur r ent , W0x0142 0x1C03 00389 skpc ; Check f or >90x0143 0x2947 00390 goto NTAddDi gi t ; OK i t s l ess t han 100x0144 0x1D03 00391 skpz0x0145 0x2956 00392 goto NTReset ; I t s great er t han 10 so r eset0x0146 0x01AA 00393 cl r f Curr ent ; Set Curr ent t o Zer o

    00394 NTAddDi gi t : ; Fi r st *10 t hen Add Curr ent0x0147 0x1003 00395 cl r c ; Prepare t o mul t i pl y

    00396 movf w NewTi me ; Save val ue i n W0x0148 0x082E MACRO0x0149 0x0DAE 00397 r l f NewTi me ; *20x014A 0x0DAE 00398 r l f NewTi me ; *40x014B 0x0DAE 00399 r l f NewTi me ; *80x014C 0x07AE 00400 addwf NewTi me ; +10x014D 0x07AE 00401 addwf NewTi me ; +2 now NewTi mer =NewTi mer *10

    00402 movfw Curr ent ; Add i n new val ue0x014E 0x082A MACRO0x014F 0x07AE 00403 addwf NewTi me ; Compl et e0x0150 0x1003 00404 cl r c0x0151 0x1503 00405 set z0x0152 0x0008 00406 r etur n ; Retur n r eady f or next di gi t

    00407 NTSaveI t :0x0153 0x1403 00408 set c0x0154 0x1103 00409 cl r z0x0155 0x0008 00410 r eturn ; Ret urn t o save val ue

    00411 NTReset :0x0156 0x1403 00412 set c0x0157 0x1503 00413 set z0x0158 0x0008 00414 r eturn ; Ret urn t o Reset

    00415 ; ********************* ********************** ********************** **************00416 Reset Val ues:

    0x0159 0x01AA 00417 cl r f Cur r ent0x015A 0x01AB 00418 cl r f CopyCount0x015B 0x01AD 00419 cl r f Ti meCD0x015C 0x01AE 00420 cl r f NewTi me0x015D 0x01AF 00421 cl r f Rel ay0x015E 0x01B3 00422 cl r f DTMFSt at us0x015F 0x01B4 00423 cl r f DTMFTone

  • 8/22/2019 DTMF Remote Control Decoder

    17/25

    Copyright Geoff Mather G8DHE 2009

    0x0160 0x0008 00424 r et urn ; Return t o App Desi gner00425 ; ********************* ********************** ********************** **************00426 Ti meMi n: ; Cal l ed by cl ock r out i nes

    0x0161 0x0ABA 00427 i ncf Mi nutes ; I ncrements t he Mi nut es count er0x0162 0x303C 00428 movl w . 60 ; Load Top count0x0163 0x023A 00429 subwf Mi nutes, w ; Compare t hem0x0164 0x1903 00430 skpnz0x0165 0x217C 00431 cal l Hour I nc

    00432 movf w MOn ; Get t he On mi nutes0x0166 0x0838 MACRO0x0167 0x023A 00433 subwf Mi nutes, w ; Compare On mi nutes0x0168 0x1D03 00434 skpz0x0169 0x2971 00435 goto Mi nutesOf f ; Nope so check Of f t i me

    00436 movf w HOn ; Check Hours0x016A 0x0839 MACRO

    0x016B 0x023B 00437 subwf Hours, w ; compare hour0x016C 0x1D03 00438 skpz0x016D 0x2971 00439 goto Mi nutesOf f ; Nope so check Of f t i me

    00440 movf w R2Ti me ; get t he r el ays0x016E 0x0835 MACRO0x016F 0x0486 00441 i orwf PORTB ; Turn on t he r el ays t hat are t i med0x0170 0x0008 00442 r et urn ; Ti me On compl et e

    00443 Mi nutesOf f :00444 movf w MOf f ; Get t he Of f mi nutes

    0x0171 0x0836 MACRO0x0172 0x023A 00445 subwf Mi nutes, w ; compare Of f mi nutes0x0173 0x1D03 00446 skpz0x0174 0x0008 00447 r eturn ; Ti me doesn' t mat ch so f i ni sh

    00448 movf w HOf f ; Get t he Of f Hours0x0175 0x0837 MACRO0x0176 0x023B 00449 subwf Hours, w ; compare t he Of f hour s0x0177 0x1D03 00450 skpz0x0178 0x0008 00451 r eturn ; No so f i ni sh0x0179 0x0935 00452 comf R2Ti me, w ; get t he r el ays but i nvert ed0x017A 0x0586 00453 andwf PORTB ; Rel ease t he r el ays0x017B 0x0008 00454 r eturn ; f i ni shed

    00455 Hour I nc:

    0x017C 0x01BA 00456 cl r f Mi nutes0x017D 0x0ABB 00457 i ncf Hours ; I ncr ement t he Hours0x017E 0x3018 00458 movl w . 24 ; Load t op count0x017F 0x023B 00459 subwf Hours, w ; compare t hem0x0180 0x1903 00460 skpnz0x0181 0x01BB 00461 cl r f Hour s ; r eset f or new day0x0182 0x0008 00462 Ti meHour: r eturn ; Hours compl et e Cal l here f or Hours Accuracy

    00463 ; ********************* ********************** ********************** **************00464 NewCl ock:

    0x0183 0x300A 00465 movl w 0x0A ; Check agai nst 100x0184 0x022A 00466 subwf Cur r ent , W0x0185 0x1C03 00467 skpc ; Check f or >90x0186 0x298A 00468 goto NCAddDi gi t ; OK i t s l ess t han 100x0187 0x1D03 00469 skpz0x0188 0x2956 00470 goto NTReset ; I t s great er t han 10 so r eset0x0189 0x01AA 00471 cl r f Curr ent ; Set Curr ent t o Zer o

    00472 NCAddDi gi t : ; Fi r st *10 t hen Add Curr ent0x018A 0x1003 00473 cl r c ; Prepare t o mul t i pl y

    00474 movf w NewTi me ; Save val ue i n W0x018B 0x082E MACRO0x018C 0x0DAE 00475 r l f NewTi me ; *20x018D 0x0DAE 00476 r l f NewTi me ; *4

    0x018E 0x0DAE 00477 r l f NewTi me ; *80x018F 0x07AE 00478 addwf NewTi me ; +10x0190 0x07AE 00479 addwf NewTi me ; +2 now NewTi mer =NewTi mer *10

    00480 movfw Curr ent ; Add i n new val ue0x0191 0x082A MACRO0x0192 0x07AE 00481 addwf NewTi me ; Compl et e0x0193 0x0BAC 00482 decf sz TCount ; Decr ement di gi t count0x0194 0x28E7 00483 goto Done ; Loop f or second di gi t

    00484 CSaveDi gi t s:0x0195 0x30BB 00485 movl w TMOf f - 1 ; Poi nter t o l owest t emp vari abl e0x0196 0x072B 00486 addwf CopyCount, W ; Add i n t he of f set actual l y l ess 10x0197 0x0084 00487 movwf FSR ; Poi nt i nt o memor y

    00488 movf w NewTi me ; Get di gi t pai r0x0198 0x082E MACRO0x0199 0x0080 00489 movwf I NDF ; save t he val ue0x019A 0x3002 00490 movl w 0x02 ; r eset di gi t count0x019B 0x00AC 00491 movwf TCount ; t o 20x019C 0x01AE 00492 cl r f NewTi me0x019D 0x0BAB 00493 decf sz CopyCount ; Move of f set / counter down0x019E 0x28E7 00494 goto Done ; More pai r s yet

    00495 Val i dateTi mes:00496 movf w TH ; Load i n Temp Hours

    0x019F 0x0841 MACRO0x01A0 0x3C17 00497 subl w . 230x01A1 0x1C03 00498 skpc0x01A2 0x28FD 00499 got o PI Nf ai l ; Hour s t oo l arge

    00500 movf w TM0x01A3 0x0840 MACRO0x01A4 0x3C3B 00501 subl w . 590x01A5 0x1C03 00502 skpc0x01A6 0x28FD 00503 got o PI Nf ai l ; Mi nut es t ool arge

    00504 movf w THOn0x01A7 0x083F MACRO0x01A8 0x3C17 00505 subl w . 230x01A9 0x1C03 00506 skpc0x01AA 0x28FD 00507 goto PI Nf ai l

    00508 movf w TMOn0x01AB 0x083E MACRO0x01AC 0x3C3B 00509 subl w . 590x01AD 0x1C03 00510 skpc0x01AE 0x28FD 00511 goto PI Nf ai l

    00512 movf w THOf f0x01AF 0x083D MACRO0x01B0 0x3C17 00513 subl w . 230x01B1 0x1C03 00514 skpc0x01B2 0x28FD 00515 goto PI Nf ai l

    00516 movf w TMOf f0x01B3 0x083C MACRO0x01B4 0x3C3B 00517 subl w . 590x01B5 0x1C03 00518 skpc0x01B6 0x28FD 00519 goto PI Nf ai l

    00520 CStore: ; Store t hree t i me pai rs

  • 8/22/2019 DTMF Remote Control Decoder

    18/25

    Copyright Geoff Mather G8DHE 2009

    0x01B7 0x3006 00521 movl w 0x06 ; make of f set count er 6 agai n0x01B8 0x00AB 00522 movwf CopyCount0x01B9 0x30BB 00523 CSLoop: movl w TMOf f - 1 ; Poi nt t o l owest t emp vari abl e0x01BA 0x072B 00524 addwf CopyCount , w ; Add of f set0x01BB 0x0084 00525 movwf FSR ; Poi nt at memor y

    00526 movfw I NDF ; get t he val ue0x01BC 0x0800 MACRO0x01BD 0x00AE 00527 movwf NewTi me ; save i t t emp0x01BE 0x3006 00528 movl w 0x06 ; l oad di f f erence between Temp and f i nal0x01BF 0x0284 00529 subwf FSR ; Poi nt at f i nal l ocat i ons

    00530 movf w NewTi me0x01C0 0x082E MACRO0x01C1 0x0080 00531 movwf I NDF ; save val ue i n new f i nal l ocati on0x01C2 0x0BAB 00532 decf sz CopyCount ; decr ement l oop count er0x01C3 0x29B9 00533 goto CSLoop ; r epeat f or al l 6 val ues

    0x01C4 0x224A 00534 cal l HMSI ni t ; Reset Cl ock vari abl es0x01C5 0x01B5 00535 cl r f R2Ti me ; Cl ear curr ent r el ays usi ng t i me.0x01C6 0x13B3 00536 bcf DTMFStat us, 7 ; Cl ear f l ag as al l done0x01C7 0x28E7 00537 goto Done ; Al l done

    00538 ; ********************* ********************** ********************** **************00539 CTone: ; Comf ort Tone on f al l i ng edge of DTMF

    0x01C8 0x1A33 00540 bt f sc DTMFStat us, 4 ; Check f or mat chi ng PI N0x01C9 0x29CC 00541 got o CTOK0x01CA 0x1D33 00542 btf ss DTMFStat us, 2 ; Tone f ai l unl ess PI N val i d or Matchi ng0x01CB 0x1434 00543 bsf DTMFTone, 00x01CC 0x15B4 00544 CTOK: bsf DTMFTone, 3 ; Reset PI N Fl ag SET0x01CD 0x14B4 00545 bsf DTMFTone, 1 ; Set f l ag f or t one out0x01CE 0x01C2 00546 cl r f ToneCount ; Use f or down counter0x01CF 0x1134 00547 bcf DTMFTone, 2 ; Cl ear t oggl e di vi der0x01D0 0x1683 00548 bsf STATUS, RP00x01D1 0x1085 00549 bcf TRI SA, 1 ; Set b1 f or Output0x01D2 0x1283 00550 bcf STATUS, RP00x01D3 0x0008 00551 r eturn ; Condi t i ons set t o t oggl e on T0

    00552 T0Tone: ; Ti mer 0 Tone0x01D4 0x1CB4 00553 bt f ss DTMFTone, 1 ; Test f or t one out0x01D5 0x0008 00554 r et urn ; Nope so back agai n0x01D6 0x3004 00555 movl w 0x04 ; Toggl e bi t i f r eqd.

    0x01D7 0x1834 00556 bt f sc DTMFTone, 00x01D8 0x06B4 00557 xor wf DTMFTone ; Toggl e di vi der0x01D9 0x1934 00558 bt f sc DTMFTone, 2 ; I f cl ear t hen t oggl e Output0x01DA 0x0008 00559 r eturn ; Di vi di ng by t wo so r eturn0x01DB 0x3002 00560 movl w 0x02 ; Toggl e bi t f or output0x01DC 0x0685 00561 xor wf PORTA ; change st at e of Output bi t0x01DD 0x0BC2 00562 decf sz ToneCount ; 255 ms Count0x01DE 0x29E0 00563 got o TReset0x01DF 0x29E8 00564 got o ToneEnd0x01E0 0x1C85 00565 TReset : bt f ss PORTA, 1 ; Test Whats sent0x01E1 0x29E5 00566 got o LowReset0x01E2 0x1D05 00567 bt f ss PORTA, 20x01E3 0x11B4 00568 bcf DTMFTone, 3 ; No mat ch so cl ear PI N RESET f l ag0x01E4 0x0008 00569 r et urn

    00570 LowReset :0x01E5 0x1905 00571 bt f sc PORTA, 20x01E6 0x11B4 00572 bcf DTMFTone, 3 ; No mat ch so cl ear PI N RESET f l ag0x01E7 0x0008 00573 r et urn

    00574 ToneEnd: ; Fi ni sh Tone output0x01E8 0x30F8 00575 movl w 0xF80x01E9 0x05B4 00576 andwf DTMFTone ; Cl ear al l Tone f l ags0x01EA 0x1683 00577 bsf STATUS, RP0

    0x01EB 0x1485 00578 bsf TRI SA, 1 ; Set PORTA1 back t o i nput0x01EC 0x1283 00579 bcf STATUS, RP00x01ED 0x1DB4 00580 bt f ss DTMFTone, 3 ; RESET PI N ?0x01EE 0x0008 00581 r eturn ; Al l done

    00582 PI NReset :0x01EF 0x01C3 00583 cl r f EEPr omAdr ; Poi nt at Zer o0x01F0 0x3004 00584 movl w 0x040x01F1 0x00AB 00585 movwf CopyCount0x01F2 0x30FF 00586 RLoop: movl w 0xFF ; Set t he defaul t0x01F3 0x2232 00587 cal l EEPROMWRI TE0x01F4 0x0AC3 00588 i ncf EEPr omAdr0x01F5 0x0BAB 00589 decf sz CopyCount0x01F6 0x29F2 00590 got o RLoop0x01F7 0x0008 00591 r et urn ; Done

    00592 CheckSt ars: ; Check f or al l PI N di gi t s bei ng *' s0x01F8 0x01C3 00593 cl r f EEPromAdr ; Poi nt at f i r st0x01F9 0x2228 00594 PSTest : cal l EEPROMREAD ; Check i t0x01FA 0x3C0B 00595 subl w 0x0B ; f or * =0x0B0x01FB 0x1D03 00596 skpz0x01FC 0x0008 00597 r eturn ; No mat ch so r eturn doi ng nothi ng0x01FD 0x0AC3 00598 i ncf EEPromAdr ; Move up t o next PI N di gi t0x01FE 0x1D43 00599 bt f ss EEPr omAdr , 2 ; Check f or f ourt h di gi t

    0x01FF 0x29F9 00600 goto PSTest ; l ess t han 4 checked00601 movfw DTMFStat us ; Get t he st atus bi t s

    0x0200 0x0833 MACRO0x0201 0x39F8 00602 andl w 0xF8 ; r etai n al l but l ower 3 bi t s0x0202 0x3804 00603 i orl w 0x04 ; set j ust t he Val i d PI N f l ag0x0203 0x00B3 00604 movwf DTMFSt at us ; Save i t agai n0x0204 0x0008 00605 r etur n ; r etur n t el l i ng Val i d Pi n r ecei eved.

    006060000100002 ; ** * I nput Fi l e - D: \ Program Fi l es\FED\ WI ZPI C\ APPWI Z\ Del ays. asm00003

    TRUE 00004 #i f def DELAYUsed00005 ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;00006 ;00007 ; Del ay routi nes00008 ;00009 ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;00010 ;00011 ; I nsert a del ay of up t o 772 Cycl es00012 ; Loop ti me = 5 + 3*(W- 1), mi ni mum500013 ; Cal l Del ay 1 t o add 1 cycl e00014 ; Cal l Del ay 2 to add 2 Cyc00015 ;00016 ; Remember i t t akes 2 Cycl es t o cal l00017 ; t hi s routi ne, and 1 cycl e to l oad00018 ; W before cal l i ng it00019 ;00020 MFORCEPAGE D' 12'00021

    0x0205 0x0000 00022 Del ay2 nop ; 1

  • 8/22/2019 DTMF Remote Control Decoder

    19/25

    Copyright Geoff Mather G8DHE 2009

    0x0206 0x0000 00023 Del ay1 nop ; 10x0207 0x0090 00024 Del ay0 movwf Temp1 ; 10x0208 0x0B90 00025 Del ayLop decf sz Temp1 ; 1/ 20x0209 0x2A08 00026 goto Del ayLop ; 20x020A 0x0008 00027 r et urn ; 2

    0002800029 ;00030 ; Bi g del ays need an out er l oop00031 ; Thi s del ays 730 + ( W- 1)* 728 Cycl es00032 ;

    0x020B 0x0091 00033 Bi gDel movwf Temp2 ; 10x020C 0x30F0 00034 BDLop movl w H' f 0' ; 10x020D 0x2207 00035 cal l Del ay0 ; 7240x020E 0x0B91 00036 decf sz Temp2 ; 1/ 20x020F 0x2A0C 00037 got o BDLop ; 2

    0x0210 0x0008 00038 ret urn ; 200039 #endi f00040000410004200043 ; *** I nput Fi l e - D: \ Program Fi l es\FED\ WI ZPI C\ APPWI Z\ Mi sc. asm0004400045 ;00046 ; Code associ at ed wi t h Edge el ement whi ch can be dupl i cat ed00047 ;00048

    TRUE 00049 #i f def EdgeUsed ; I ni t Code f or Edge i s onl y used once00050 MFORCEPAGE 150005100052 I ni t Edge:00053 EI Cnt=( D' 2' - 1)/ 8+1 ; Edge Detect or

    0x0211 0x30FF 00054 movl w H' FF'TRUE 00055 whi l e EI Cnt0x0212 0x0093 00056 movwf EdgeFl ags+EI Cnt- 1

    00057 EI Cnt=EI Cnt - 100058 endw00059 Cl earPCLATH I ni t Edge

    0x0213 0x0008 00060 r et urn00061 #endi f0006200063

    TRUE 00064 #i f def EdgeUsed ; %% - f l ag t o show code r epeated f or each i nst ance00065 MFORCEPAGE D' 15'00066 Test Edge000067 EI Fl ag=0/8 ; Fl ag f or t hi s i nstance00068 EI Bi t =( 0)%8 ; Bi t f or t hi s i nstance00069 movf w PORTA

    0x0214 0x0805 MACRO0x0215 0x3901 00070 andl w ( 1

  • 8/22/2019 DTMF Remote Control Decoder

    20/25

    Copyright Geoff Mather G8DHE 2009

    00143 ;00144 ; ******************** *********************00145 ;00146 ; I nput s & Output s ar e :0014700148 ; Code001490015000151 ; ***** *****00152 ; * EEPROMREAD - EEPROMREAD00153 ; ***** *****00154 ; General r out i ne to r ead PI C EEPROM dat a cal l d wi t h address i n EEPromAdr00155 ; r et urns wi t h data i n W. Coded f or 16x8x, 16F62x, 16F82 & 16F8xx process ors .00156 EEPROMREAD:00157 ADSet RP EEPr omAdr

    0x0228 0x1683 MACRO bsf STATUS, RP000158 movf w EEPr omAdr ; Get t he addr ess i nto W0x0229 0x0843 MACRO

    00168 #el se ; 16x87x & 16F8x processor s0x022A 0x1283 00169 bcf STATUS, RP0 ;0x022B 0x0089 00170 movwf EEADR ; Save t he address0x022C 0x1683 00171 bsf STATUS, RP0 ; Al l process or s have EECONx i n bl ocks 1 or 3

    00172 #endi f0x022D 0x1408 00176 bsf EECON1, RD ; Tel l i t t o r ead data

    00179 #el se0x022E 0x1283 00180 bcf STATUS, RP0 ; Bl ock 2 f or 16F87X - 0 f or 16F84

    00181 movf w EEDATA ; Get t he data0x022F 0x0808 MACRO

    00182 #endi f00183 ADCl ear RP EECON2

    0x0230 0x1283 MACRO bcf STATUS, RP000184 Cl ear PCLATH EEPROMREAD

    0x0231 0x0008 00185 r eturn ; That s i t .0018600187 ; ***** *****00188 ; * EEPROMWRI TE - EEPROMWRI TE00189 ; ***** *****

    00190 ; General r out i ne to wr i t e EEPROM dat a cal l ed wi t h address i n EEPromAdr00191 ; dat a t o be saved i n W. Gl obal I nter r upt s are di abl ed & r est ored dur i ng00192 ;act ual wri t e peri od, ret urns onl y af t er actual wri t e has compl eted.00193 EEPROMWRI TE:

    0x0232 0x1283 00197 bcf STATUS, RP0 ; bl ock 2 f or 16F87X - 0 f or 16F840x0233 0x0088 00198 movwf EEDATA ; Save dat a

    00199 ADSet RP EEPr omAdr0x0234 0x1683 MACRO bsf STATUS, RP0

    00200 movf w EEPr omAdr ; Get t he addr ess i nto W0x0235 0x0843 MACRO

    00210 #el se ; 16x87x & 16F8x processor s0x0236 0x1283 00211 bcf STATUS, RP0 ;0x0237 0x0089 00212 movwf EEADR ; Save t he address0x0238 0x1683 00213 bsf STATUS, RP0 ; Al l process or s have EECONx i n bl ocks 1 or 3

    00214 #endi f0x0239 0x1003 00218 cl r c ; Use t he Carr y f l ag t o st ore GI E st ate0x023A 0x1B8B 00219 bt f sc I NTCON, 7 ; Check GI E bi t0x023B 0x1403 00220 set c ; Set C as GI E i s set0x023C 0x138B 00221 bcf I NTCON, GI E ; Di sabl e i nter r upt s dur i ng cr i t i cal code0x023D 0x1508 00222 bsf EECON1, WREN ; Enabl e wr i t e mode

    00223 ; The f ol l owi ng sequence i s mandat ory0x023E 0x3055 00224 movl w 0x55

    0x023F 0x0089 00225 movwf EECON20x0240 0x30AA 00226 movl w 0xAA0x0241 0x0089 00227 movwf EECON20x0242 0x1488 00228 bsf EECON1, WR ; Wr i t e t he data

    00229 ; End of mandator y sequence0x0243 0x1888 00230 bt f sc EECON1, WR ; Check f or cl eared by hardwar e0x0244 0x2A43 00231 got o $-1 ; l oop unt i l wr i t t en0x0245 0x1108 00232 bcf EECON1, WREN ; Di asabl e wr i t e0x0246 0x1803 00233 skpnc ; Test C f or GI E st ate0x0247 0x178B 00234 bsf I NTCON, GI E ; Set i t as i t was

    00235 ADCl earRP EECON2 ; cl ear RPbi t s0x0248 0x1283 MACRO bcf STATUS, RP0

    00236 Cl ear PCLATH EEPROMWRI TE0x0249 0x0008 00237 r et urn

    00238 #endi f002390024000241 ; ** * I nput Fi l e - D: \ Program Fi l es\FED\ WI ZPI C\ APPWI Z\ Ti mers. asm00242002430024400245 ; ***

    00246 ; Ori gi nal f i l e start s here00247 ; ***00248 ;00249 ; Appl i cati on Desi gner, t i mers code00250 ;002510025200253 ;00254 ; Hours , Mi nutes & Seconds00255 ;00256

    TRUE 00257 #i f def HMSUsed00258 HMS_T0OF=D' 256'

    TRUE 00259 #i f D' 1'00260 HMS_T0OF*=D' 4'00261 #endi f00262 SECCOUNTS=( D' 4011200' / 4) / HMS_T0OF00263 MI NCOUNTS=( D' 4011200' *D' 15' ) / HMS_T0OF00264 HOURCOUNTS=( ( D' 4011200' *D' 30' ) / HMS_T0OF) *D' 30'0026500266 MFORCEPAGE D' 30'00267 HMSI ni t :00268 ADSet RP HMSCount

    0x024A 0x1683 MACRO bsf STATUS, RP0TRUE 00269 #i f def HourPassUsed0x024B 0x2250 00270 cal l HourI ni t

    00271 #endi fTRUE 00272 #i f def Mi nPassUsed0x024C 0x2255 00273 cal l Mi nI ni t

    00274 #endi f

  • 8/22/2019 DTMF Remote Control Decoder

    21/25

    Copyright Geoff Mather G8DHE 2009

    TRUE 00275 #i f def SecPassUsed0x024D 0x2259 00276 cal l SecI ni t

    00277 #endi f00278 ADCl ear RP HMSCount

    0x024E 0x1283 MACRO bcf STATUS, RP000279 Cl earPCLATH HMSI ni t

    0x024F 0x0008 00280 r et urn00281

    TRUE 00282 #i f def HourPassUsed0x0250 0x01A1 00283 HourI ni t : cl r f Hr Count0x0251 0x01A2 00284 cl r f Hr Count +10x0252 0x01A3 00285 cl r f Hr Count +20x0253 0x01A4 00286 cl r f Hr Count +30x0254 0x0008 00287 r et urn

    00288 #endi f

    TRUE 00289 #i f def Mi nPassUsed0x0255 0x01A5 00290 Mi nI ni t : cl r f Mi nCount0x0256 0x01A6 00291 cl r f Mi nCount+10x0257 0x01A7 00292 cl r f Mi nCount+20x0258 0x0008 00293 r et urn

    00294 #endi fTRUE 00295 #i f def SecPassUsed0x0259 0x01A8 00296 SecI ni t : cl r f SecCount0x025A 0x01A9 00297 cl r f SecCount+10x025B 0x0008 00298 r et urn

    00299 #endi f00300 MFORCEPAGE D' 75'00301 ;00302 ; Cal l ed every t i mer 0 overf l ow00303 ;00304 HMSTi ck:00305 ADSet RP HMSCount

    0x025C 0x1683 MACRO bsf STATUS, RP0TRUE 00306 #i f def SecPassUsed0x025D 0x0AA9 00307 i ncf SecCount+10x025E 0x0FA8 00308 i ncf sz SecCount0x025F 0x03A9 00309 decf SecCount+1

    00310 HMS_NI S:0x0260 0x30D3 00311 movl w SECCOUNTS>>00x0261 0x0228 00312 subwf SecCount+0, w0x0262 0x1D03 00313 skpz0x0263 0x2A6A 00314 got o HMS_NoOccur S0x0264 0x3003 00315 movl w SECCOUNTS>>80x0265 0x0229 00316 subwf SecCount+1, w0x0266 0x1D03 00317 skpz0x0267 0x2A6A 00318 got o HMS_NoOccur S0x0268 0x150F 00319 HMS_SecPass ed: bsf Fl ag1 , 20x0269 0x2259 00320 cal l SecI ni t

    00321 HMS_NoOccur S:00322 #endi f

    TRUE 00323 #i f def Mi nPassUsed0x026A 0x0FA5 00324 i ncf sz Mi nCount0x026B 0x2A6F 00325 got o HMS_NI M0x026C 0x0FA6 00326 i ncf sz Mi nCount+10x026D 0x2A6F 00327 got o HMS_NI M0x026E 0x0AA7 00328 i ncf Mi nCount+2

    00329 HMS_NI M:0x026F 0x3085 00330 movl w MI NCOUNTS>>00x0270 0x0225 00331 subwf Mi nCount +0, w

    0x0271 0x1D03 00332 skpz0x0272 0x2A7E 00333 got o HMS_NoOccur M0x0273 0x30E5 00334 movl w MI NCOUNTS>>80x0274 0x0226 00335 subwf Mi nCount +1, w0x0275 0x1D03 00336 skpz0x0276 0x2A7E 00337 got o HMS_NoOccur M0x0277 0x3000 00338 movl w MI NCOUNTS>>D' 16'0x0278 0x0227 00339 subwf Mi nCount +2, w0x0279 0x1D03 00340 skpz0x027A 0x2A7E 00341 got o HMS_NoOccur M0x027B 0x158F 00342 bsf Fl ag1 , 30x027C 0x2255 00343 cal l Mi nI ni tTRUE 00344 #i f def SecPassUsed0x027D 0x2259 00345 cal l SecI ni t

    00346 #endi f00347 HMS_NoOccur M:00348 #endi f

    TRUE 00349 #i f def HourPassUsed0x027E 0x0FA1 00350 i ncf sz Hr Count0x027F 0x2A85 00351 got o HMS_NI H0x0280 0x0FA2 00352 i ncf sz Hr Count+10x0281 0x2A85 00353 got o HMS_NI H

    0x0282 0x0FA3 00354 i ncf sz Hr Count+20x0283 0x2A85 00355 got o HMS_NI H0x0284 0x0AA4 00356 i ncf Hr Count +3

    00357 HMS_NI H:0x0285 0x304A 00358 movl w HOURCOUNTS>>00x0286 0x0221 00359 subwf Hr Count+0, w0x0287 0x1D03 00360 skpz0x0288 0x2A97 00361 got o HMS_NoOccur H0x0289 0x30CB 00362 movl w HOURCOUNTS>>80x028A 0x0222 00363 subwf Hr Count+1, w0x028B 0x1D03 00364 skpz0x028C 0x2A97 00365 got o HMS_NoOccur H0x028D 0x3035 00366 movl w HOURCOUNTS>>D' 16'0x028E 0x0223 00367 subwf Hr Count+2, w0x028F 0x1D03 00368 skpz0x0290 0x2A97 00369 got o HMS_NoOccur H0x0291 0x3000 00370 movl w HOURCOUNTS>>D' 24'0x0292 0x0224 00371 subwf Hr Count+3, w0x0293 0x1D03 00372 skpz0x0294 0x2A97 00373 got o HMS_NoOccur H0x0295 0x160F 00374 bsf Fl ag1 , 40x0296 0x2A4A 00375 got o HMSI ni t

    00376 HMS_NoOccur H:00377 #endi f00378 HMS_End:00379 ADCl ear RP HMSCount

    0x0297 0x1283 MACRO bcf STATUS, RP000380 Cl ear PCLATH HMSTi ck

    0x0298 0x0008 00381 r et urn00382 #endi f

  • 8/22/2019 DTMF Remote Control Decoder

    22/25

    Copyright Geoff Mather G8DHE 2009

    003830038400385003860038700388003890039000391003920039300394003950039600397

    00398003990040000401

    ; *; *** END OF PROGRAM; *

    Label s======ADCl ear RP MACROADI ni t 00000019H, . 25ADI ni t End 00000029H, . 41ADSet I RP MACROADSet PCLATH MACROADSet RP MACROAPROCFREQ DEFI NE - D' 4011200'Aut oI nt 0000000BH, . 11BDLop 0000020CH, . 524

    BI TSI ZE DEFI NE - D' 14'BOOTADDRESS DEFI NE - D' 0'Bi gCyc 0000010EH, . 270Bi gDel 0000020BH, . 523C 00000000H, . 0CLoop 000000CEH, . 206CRE DEFI NE - D' 1'CSLoop 000001B9H, . 441CSaveDi gi t s 00000195H, . 405CSt or e 000001B7H, . 439CTOK 000001CCH, . 460CTone 000001C8H, . 456CheckSt ar s 000001F8H, . 504Choose 00000095H, . 149Cl ear PCLATH MACROCl ocked 00000085H, . 133CopyCount 000000ABH, . 171CopyPI N 000000CCH, . 204CountDown 00000120H, . 288Curr ent 000000AAH, . 170DBBI TRATE 00004B00H, . 19200DBBase 00000700H, . 1792

    DBPROCFREQ 003D34C0H, . 4011200DBPages 00000001H, . 1DBRTB 00000000H, . 0DBxPor t 00000005H, . 5DC 00000001H, . 1DELAY MACRODELAYUsed DEFI NE - 1DTMFSt at us 000000B3H, . 179DTMFTone 000000B4H, . 180DebugVars 000000E2H, . 226Del ay0 00000207H, . 519Del ay1 00000206H, . 518Del ay2 00000205H, . 517Del ayLop 00000208H, . 520Del v 00000000H, . 0Done 000000E7H, . 231EEADR 00000009H, . 9EECON1 00000088H, . 136EECON2 00000089H, . 137EEDATA 00000008H, . 8EEI E 00000006H, . 6EEI F 00000004H, . 4

    EEPROMREAD 00000228H, . 552EEPROMUsed DEFI NE - 1EEPROMWRI TE 00000232H, . 562EEPromAdr 000000C3H, . 195EI Bi t 00000001H, . 1EI Cnt 00000000H, . 0EI Fl ag 00000000H, . 0Edge0Bi t DEFI NE - 0Edge0Port DEFI NE - PORTAEdge0Used DEFI NE - 1Edge1Bi t DEFI NE - 0Edge1Port DEFI NE - PORTAEdge1Used DEFI NE - 1EdgeFl ags 00000013H, . 19EdgeUsed DEFI NE - 1EdgenCopy DEFI NE - D' 2'F 00000001H, . 1FI RSTRAM DEFI NE - H' 0C'FI TI NBLOCK MACROFSR 00000004H, . 4FSR_TEMP 0000000EH, . 14Fl ag1 0000000FH, . 15GI E 00000007H, . 7Got Edge0End 00000048H, . 72GotEdge0Fl ag DEFI NE - Fl ag1GotEdge0Fl agBi t DEFI NE - 5Got Edge0Used DEFI NE - 1Got Edge1End 00000032H, . 50GotEdge1Fl ag DEFI NE - Fl ag1GotEdge1Fl agBi t DEFI NE - 0

  • 8/22/2019 DTMF Remote Control Decoder

    23/25

    Copyright Geoff Mather G8DHE 2009

    Got Edge1Used DEFI NE - 1HASOSCCAL DEFI NE - 0HMSCount 000000A1H, . 161HMSI ni t 0000024AH, . 586HMSStar t 00000014H, . 20HMSTi ck 0000025CH, . 604HMSUsed DEFI NE - 1HMS_End 00000297H, . 663HMS_NI H 00000285H, . 645HMS_NI M 0000026FH, . 623HMS_NI S 00000260H, . 608HMS_NoOccur H 00000297H, . 663HMS_NoOccur M 0000027EH, . 638HMS_NoOccur S 0000026AH, . 618HMS_SecPass ed 00000268H, . 616

    HMS_T0OF 00000400H, . 1024HMSnVar 00000009H, . 9HOURCOUNTS 0035CB4AH, . 3525450HOf f 000000B7H, . 183HOn 000000B9H, . 185Hour I nc 0000017CH, . 380Hour I ni t 00000250H, . 592HourPassEnd 00000043H, . 67Hour PassFl ag DEFI NE - Fl ag1Hour PassFl agBi t DEFI NE - 4HourPassUsed DEFI NE - 1Hours 000000BBH, . 187Hr Count 000000A1H, . 161Hr Count1 000000A2H, . 162Hr Count2 000000A3H, . 163Hr Count3 000000A4H, . 164I NDF 00000000H, . 0I NI TOUTPORT MACROI NTCON 0000000BH, . 11I NTE 00000004H, . 4I NTEDG 00000006H, . 6I NTF 00000001H, . 1

    I NTRECALL MACROI NTSAVE MACROI RP 00000007H, . 7I n0Bi t DEFI NE - 4I n0Port DEFI NE - PORTAI n1Bi t DEFI NE - 3I n1Port DEFI NE - PORTAI n2Bi t DEFI NE - 2I n2Port DEFI NE - PORTAI n3Bi t DEFI NE - 1I n3Port DEFI NE - PORTAI n4Bi t DEFI NE - 0I n4Port DEFI NE - PORTAI ni t Edge 00000211H, . 529I ni t i alVal ue0 DEFI NE - D' 0'I ni t i alVal ue1 DEFI NE - D' 0'I ni t i alVal ue2 DEFI NE - D' 0'I ni t i alVal ue3 DEFI NE - D' 0'I ni t i alVal ue4 DEFI NE - D' 0'I ni t i alVal ue5 DEFI NE - D' 0'I ni t i alVal ue6 DEFI NE - D' 0'I ni t i alVal ue7 DEFI NE - D' 0'

    I ntPr i 0000000AH, . 10LASTRAM DEFI NE - H' 4F'LoadTi mer 0000010DH, . 269LoopDel ay 00000103H, . 259LowReset 000001E5H, . 485MFORCEPAGE MACROMI NCOUNTS 0000E585H, . 58757MOf f 000000B6H, . 182MOn 000000B8H, . 184Mai n 0000002DH, . 45MatchI t 000000C1H, . 193Mi nCount 000000A5H, . 165Mi nCount1 000000A6H, . 166Mi nCount2 000000A7H, . 167Mi nI ni t 00000255H, . 597Mi nPassEnd 0000003FH, . 63Mi nPassFl ag DEFI NE - Fl ag1Mi nPassFl agBi t DEFI NE - 3Mi nPassUsed DEFI NE - 1Mi nutes 000000BAH, . 186Mi nutesOf f 00000171H, . 369NCAddDi gi t 0000018AH, . 394

    NF 000000E5H, . 229NOT_PD 00000003H, . 3NOT_RBPU 00000007H, . 7NOT_TO 00000004H, . 4NT2 0000010CH, . 268NTAddDi gi t 00000147H, . 327NTReset 00000156H, . 342NTSave 00000100H, . 256NTSaveI t 00000153H, . 339NTSoR 000000FBH, . 251NTStore 000000EAH, . 234NTi me 0000013CH, . 316NewCl ock 00000183H, . 387NewPI N 000000BAH, . 186NewTi me 000000AEH, . 174NewTi mes 000000F5H, . 245OPTI ON_REG 00000081H, . 129Of End 00000037H, . 55Of Fl ag DEFI NE - Fl ag1Of Fl agBi t DEFI NE - 1Of Used DEFI NE - 1Operat eRel ay 00000071H, . 113Out0Bi t DEFI NE - 0Out0Port DEFI NE - PORTBOut1Bi t DEFI NE - 1Out1Port DEFI NE - PORTBOut2Bi t DEFI NE - 2Out2Port DEFI NE - PORTBOut3Bi t DEFI NE - 3Out3Port DEFI NE - PORTB

  • 8/22/2019 DTMF Remote Control Decoder

    24/25

    Copyright Geoff Mather G8DHE 2009

    Out4Bi t DEFI NE - 4Out4Port DEFI NE - PORTBOut5Bi t DEFI NE - 5Out5Port DEFI NE - PORTBOut6Bi t DEFI NE - 6Out6Port DEFI NE - PORTBOut7Bi t DEFI NE - 7Out7Port DEFI NE - PORTBPCL 00000002H, . 2PCLATH 0000000AH, . 10PI NReset 000001EFH, . 495PI Nf ai l 000000FDH, . 253PORTA 00000005H, . 5PORTB 00000006H, . 6PS0 00000000H, . 0

    PS1 00000001H, . 1PS2 00000002H, . 2PSA 00000003H, . 3PSD DEFI NE - D' 4'PSTest 000001F9H, . 505Pi ns 000000D7H, . 215Por t I n0Used DEFI NE - 1Por t I n1Used DEFI NE - 1Por t I n2Used DEFI NE - 1Por t I n3Used DEFI NE - 1Por t I n4Used DEFI NE - 1Por t I nUsed DEFI NE - 1Por t I nnCopy DEFI NE - D' 5'Port Out0Used DEFI NE - 1Port Out1Used DEFI NE - 1Port Out2Used DEFI NE - 1Port Out3Used DEFI NE - 1Port Out4Used DEFI NE - 1Port Out5Used DEFI NE - 1Port Out6Used DEFI NE - 1Port Out7Used DEFI NE - 1Port OutUsed DEFI NE - 1

    Port OutnCopy DEFI NE - D' 8'R2T 000000B0H, . 176R2Ti me 000000B5H, . 181RBI E 00000003H, . 3RBI F 00000000H, . 0RCD 00000126H, . 294RD 00000000H, . 0RLoop 000001F2H, . 498RP0 00000005H, . 5RP1 00000006H, . 6RTOperat e 00000133H, . 307RTRel ease 0000012EH, . 302RTSetupTi me 00000137H, . 311ReadDTMF 00000112H, . 274Rel ay 000000AFH, . 175Rel ayCD 000000B1H, . 177Rel ayTSt ate 000000B2H, . 178Rel ayToggl e 0000007AH, . 122Rel ease 0000008CH, . 140Reset Val ues 00000159H, . 345Rot at e 000000B4H, . 180SECCOUNTS 000003D3H, . 979

    STATUS 00000003H, . 3STATUS_TEMP 0000000DH, . 13SecCount 000000A8H, . 168SecCount1 000000A9H, . 169SecI ni t 00000259H, . 601SecPassEnd 0000003BH, . 59SecPassFl ag DEFI NE - Fl ag1SecPassFl agBi t DEFI NE - 2SecPassUsed DEFI NE - 1Sel Edge0 DEFI NE - D' 1'Sel Edge1 DEFI NE - D' 0'Smal l Cyc 0000010BH, . 267Star t 00000016H, . 22

    T0CS 00000005H, . 5T0I E 00000005H, . 5T0I F 00000002H, . 2T0SE 00000004H, . 4T0Tone 000001D4H, . 468TCount 000000ACH, . 172TEJ ump0 0000021AH, . 538TEJ ump1 00000224H, . 548TH 000000C1H, . 193

    THOf f 000000BDH, . 189THOn 000000BFH, . 191TM 000000C0H, . 192TMOf f 000000BCH, . 188TMOn 000000BEH, . 190TMR0 00000001H, . 1TRI SA 00000085H, . 133TRI SB 00000086H, . 134TReset 000001E0H, . 480Temp1 00000010H, . 16Temp2 00000011H, . 17Temp3 00000012H, . 18Test Cl ock 000000AAH, . 170Test Edge0 00000214H, . 532Test Edge1 0000021EH, . 542Test Rel ay 000000B3H, . 179Test T 0000009BH, . 155Ti meCD 000000ADH, . 173Ti meHour 00000182H, . 386Ti meMi n 00000161H, . 353Ti mesT 000000A2H, . 162Tmr 0I ntUsed DEFI NE - 1Tmr 0Used DEFI NE - 1Tmr 0_I nt 1 0000000FH, . 15ToneCount 000000C2H, . 194ToneEnd 000001E8H, . 488UseOsc DEFI NE - D' 1'UsePS DEFI NE - D' 1'UserI ni t i al i se 0000004AH, . 74UserI nter r upt 00000049H, . 73

  • 8/22/2019 DTMF Remote Control Decoder

    25/25

    User Loop 0000005CH, . 92Val i dateTi mes 0000019FH, . 415W 00000000H, . 0WR 00000001H, . 1WREN 00000002H, . 2WRERR 00000003H, . 3W_TEMP 0000000CH, . 12Z 00000002H, . 2

    _CP_OFF 00003FFFH, . 16383_CP_ON 0000000FH, . 15_HS_OSC 00003FFEH, . 16382_LP_ OSC 00003FFCH, . 16380_PWRTE_OFF 00003FFFH, . 16383_PWRTE_ON 00003FF7H, . 16375_RC_OSC 00003FFFH, . 16383

    _WDT_OFF 00003FFBH, . 16379_WDT_ON 00003FFFH, . 16383_XT_OSC 00003FFDH, . 16381__ 16F84 00000001H, . 1__ PI CDE 00000001H, . 1l PSD 00000000H, . 0l ongcal l MACROnPAGESRAM DEFI NE - 1nPAGESROM DEFI NE - 1vI NTCON 00000020H, . 32vOPTI ON_REG 00000041H, . 65vPI E1 00000000H, . 0vPI E2 00000000H, . 0vPORTA 000000FFH, . 255vPORTB 00000000H, . 0vPORTC 000000FFH, . 255vPORTD 000000FFH, . 255vPORTE 000000FFH, . 255vTRI SA 000000FFH, . 255vTRI SB 00000000H, . 0vTRI SC 000000FFH, . 255vTRI SD 000000FFH, . 255

    vTRI SE 00000007H, . 7vor 00000001H, . 1

    Progr am memory used, ' X' =used, ' - ' =unused

    0x0000 : XXX- XXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX0x0040 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX0x0080 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX0x00C0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX0x0100 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX0x0140 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX0x0180 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX0x01C0 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX0x0200 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX0x0240 : XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXX0x0280 : XXXXXXXXXXXXXXXX XXXXXXXXX- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

    Ot her memor y bl ocks ar e unusedErr ors : 0Warni ngs : 0Messages : 0