资源描述
HT48CA0 APPLICATION NOTE.Applicati on Circuit.*;* File name : SAMPLE.ASM (Remote 64KEY) * ;*OSC:455KHzCARRY:38KHz* ;* .* System memory Map *M_INDIRECT1 equ 00h ;ln direct addressi ng registerM_MP0equ01h ;Data Memory poi ntM_ACCequ05h AccumulatorM_PCLequ06h Program Coun ter Lower-orderM_TBLPequ 07h ;Table Poi nterM_TBLHequ 08h ;Table Higher-order byteM_STATUSequi 0ah ;Micro con troll statusPORT_Aequ 12h ;PA I/O registerPORT_Bequ 14h ;PB I/O registerHOLTEK HT48CA0 (64KEY).Work ing Register DefineHT48CA0 *PORT_C equ 16h ;PC Output registerPORT_AC equ 3Eh ;PA Temp register;- System FLAG define -;- I/O Pin define -#define pn_IR ;-Address Define -#define DATA_RAM 20h ;HT48CA0;- Instruction Define - #define NOP2 JMP $+1 ;Long NOP Define;-SAMPLE .SECTION DATA ; - Temp RAM -a_SR10DB ?;WORK Temp Registera_SR11DB ?;a_SR12DB ?;a_SR13DB ?;- Program RAM -a_SCAN_STEPDB?;Scan Key Colummn Step Numbera_PREV_KEYDB?;Save Previous Key Numbera_KEY_NUMDB ?;Scan Key Numbera_COL_VALUEDB?;Read on column value to a_COL_VALUEKD_TEMPDB?;Key Debounce Check TimesNKD_TEMPDB?;Key Release Confirm Times;- User FLAG define -fg_SendActive DBIT;VALIDITY KEY Flagfg_PressRecDBIT;Check Column Multi_Key Flagfg_REPEATDBIT;REPEAT KEY Flagfg_Multi_KeyDBIT;INVALID KEY Flag#define fg_CF#define fg_ZFM_STATUS.0M_STATUS.2;CARRYFlag ;ZEROFlagPORT_C.0 ;Carry Output PortHT48CA0 REMOTE CONTROL FLOWCHARTAny KeyWakeUpSTARTTHALTSCAN KEY PROCEDURE FLOWCHARTRETURNREAD KEY PROCEDURE FLOWCHARTTIME DELAY PROCEDURE FLOWCHART.Mai n ProgramJ J;= Main Program =SAMPLE_CODE .SECTION CODEorgMAIN:00hJclrWDT;-:=Initial Port-J J+- -PB7:OPULL-HIGHJ J+- -PB6:OPULL-HIGHJ J+- -PB5:OPULL-HIGHJ J+ -PB4:OPULL-HIGHJ J|+- -PB3:OPULL-HIGH|+-|+-|+- PORT_ PORT_A +|+-|+-|+-|+-|+-|+-|+- PORT_B+- PC0:A,11111111b PORT_C,AClear RAM ( HT-48CA0 : 20h-3Fh );T1=455KHz /4 = 8.79 uS;% Main Prog.Array % START_MAIN_PROC:;* Polling System Event *POLLING_EVENT:CALL SCAN_KEY_MATRIX ;SCAN KEY PROCEDURECALL F_DELAY ;TIME DELAY PROCEDURECALL SEND_REMOTE_CODE ;SEND CODE PROCEDURESZ fg_Multi_Key;Check Invalid KeyJMP POLLING_EVENT ;SZ fg_SendActive ;Check Validity KeyJMP POLLING_EVENT;SZ a_KEY_NUM ;Check NO Key PressJMP POLLING_EVENT;SLEEP:clr PORT_A;Ready WakeUp Low Levelhalt;System HaltJMP POLLING_EVENT ;Any Key WakeUp ;% SubroutineArray %;* SUBROUTINExx: Scan 64 Key Matrix (8x8) *SCAN_KEY_MATRIX:;- READ KEY PROCEDURE -clr wdt ;Initiate Processclr a_KEY_NUM ;clr fg_PressRec ;PB2:OPULL-HIGHPB1:OPULL-HIGHPB0:OPULL-HIGHAACAC- PA7:WAKE-UPI PULL-HIGH- PA6:WAKE-UPI PULL-HIGH- PA5:WAKE-UPI PULL-HIGH- PA4:WAKE-UPI PULL-HIGHPA3:WAKE-UPI PULL-HIGHPA2:WAKE-UPI PULL-HIGHPA1:WAKE-UPI PULL-HIGHPA0:WAKE-UPI PULL-HIGHsetclrsetCLEAR_RAM:movA,DATA_RAM; 1. RAM Start AddressmovM_MP0,A ;movA,032d ; 2.Amount of RAMCLEAR_RAM_1:门clrM_INDIRECT1 ;incM_MP0 ;SDZM_ACC ;JMPCLEAR_RAM_1CLEAR_RAM_END:OPULL-HIGH;- Default RAM valueDEFAULT_RAM:clr a_SCAN_STEPmovmov;=clr a_SCAN_STEP clr fg_Multi_Key mov A,01111111b mov PORT_AC,A NEXT_COLUMN:rlA PORT_AC mov PORT_A,A mov PORT_AC,A NOP ;- READ PB PORT-SET PORT_B MOVA,PORT_Bmov a_COL_VALUE,Amov A,001dmov a_SR11,Amov A,11111110b ;mov a_SR10,Amov A,a_COL_VALUE ; This column value to ACCSNZ a_COL_VALUE.7JMP KEY_ROW_7SNZ a_COL_VALUE.6JMP KEY_ROW_6SNZ a_COL_VALUE.5JMP KEY_ROW_5SNZ a_COL_VALUE.4JMP KEY_ROW_4SNZ a_COL_VALUE.3JMP KEY_ROW_3SNZ a_COL_VALUE.2JMP KEY_ROW_2SNZ a_COL_VALUE.1JMP KEY_ROW_1SNZ a_COL_VALUE.0JMP KEY_ROW_0NOP2nopJMP COL_WITHOUT_KEYKEY_ROW_7:rla_SR10; a_SR10 rotate to 01111111binca_SR11KEY ROW_6:rla_SR10; a_SR10 rotate to 10111111binc a_SR11KEY_ROW_5:rla_SR10; a_SR10 rotate to 11011111binca_SR11KEY ROW_4:rla_SR10; a_SR10 rotate to 11101111binc a_SR11KEY_ROW_3:rla_SR10; a_SR10 rotate to 11110111binca_SR11KEY_ROW_2:rla_SR10; a_SR10 rotate to 11111011binca_SR11KEY ROW_1:rla_SR10; a_SR10 rotate to 11111101binc a_SR11KEY_ROW_0:xor A,a_SR10 ;Check ROW Multi-Key SZ fg_ZFJMP COL_WITH_KEY COL_ERROR_KEY:set fg_Multi_Key;Scan Column PA PORT OUTPUT;SET PB0,PB1 Pull-Up;Read on column value to a_COL_VALUECOL_WITHOUT_KEY:NOP2NOP2NOP2inc a_SCAN_STEP mov A,a_SCAN_STEP xor A,008d SNZ fg_ZFJMP NEXT_COLUMNnopREAD_KEY_COMPLETE: ;* SUBROUTINExx: Check Key Active * ;- Scan KeyComplete, Check key valid ? - CHECK_KEY_ACTIVE:clr wdtSZ a_KEY_NUM ;If a_KEY_NUM = ffh, invalid keyJMP VALID_KEY_CHKJMP INVALID_KEY_CHK;-VALID_KEY_CHK:SZ a_PREV_KEY ;Check New KeyJMP VALID_KEYC_PROJMP KEY_DEBVALID_KEYC_PRO:mov xorSNZJMPA,a_KEY_NUMA,a_PREV_KEY ; Check Repeat key fg_ZFVALID_SEND_KEYVALID_ snzJMPRPSEND_KEY:fg_Multi_key ;Check Multi-Key Clear a_KEY_NUMREPEAT_KEYclr reta_KEY_NUMREPEAT_KEY:SET fg_REPEAT ;SET Repeat FlagNOP2JMP SET_VALIDFGVALID_SEND_KEY:movXORSNZJMPa,a_PREV_KEY ;Check Change KeyA,0FFH ;Check Debounce END fg_ZFCHANG_KEYNEW KEY InitiaterlAa_SCAN_STEP;rlM_ACC ; a_SCAN_STEP * 8 - ACCrlM_ACC ;/addA,a_SR11 ;mova_KEY_NUM,A门SZfg_PressRec ;Check Column Multi-Keysetfg_Multi_Key ;setfg_PressRec ;JMP READY_2_NEXT_COLUMNCOL_WITH_KEY:;KEY NUMBER PROCESSREADY_2_NEXT_COLUMN:CLRfg_REPEATmov mova,a_KEY_NUM a_PREV_KEY,a;- SET VALIDITY KEY SET_VALIDFG:SET fg_SendActiveretCHANG_KEY:CLR KD_TEMPJMP RKEY_PRO;-INVALID_KEY_CHK:CLR KD_TEMPRKEY_PRO:;Release Key ConfirmINCNKD_TEMPMOVA,NKD_TEMPXORA,5SNZfg_ZFJMPSCAN_KEY_MATRIXDEC NKD_TEMPNO_KEY_PROC:clr fg_SendActiveNOP2NOP2NOPEXIT_INVALID_KEY:mov a,a_KEY_NUM ;Clear a_PREV_KEY mov a_PREV_KEY,aNOP2retKEY_DEB: ;T1=455KHz/4=116480Hz = 8.79us ;Check Key DebounceINC KD_TEMPMOV A,KD_TEMPXOR A,6SNZJMPfg_ZFSCAN_KEY_MATRIXMOVMOVJMPA,0FFH ;SAVE KEY Debounce Check ENDa_PREV_KEY,A;0FFH to a_PREV_KEYSCAN_KEY_MATRIX;* SubRoutinexx: Delay 10*ACC+5 Instruction Cycle * ;- TIME DELAY PROCEDURE -F_DELAY:SZ KD_TEMPJMP NEWK_DMOV A,NKD_TEMP ;Release Confirm time offset delay mov a_SR13,ABLANK_DELAY_00:INCa_SR13MOVA,a_SR13XORA,5SZfg_ZFJMPBLANK_DELAY_010movA,155dBLANKDELAY_01:SDZM_ACCJMPBLANK_DELAY_01clrwdtJMPBLANK_DELAY_00BLANK_DELAY_010:CLR NKD_TEMPMOV a,1;OFFSET TIME DELAYmov a_SR13,ABLANK_DELAY_02:mov A,37dBLANK_DELAY_03:clrwdtSDZM_ACCJMPBLANK_DELAY 03SDZa_SR13JMPBLANK_DELAY 02RETNEWK_D: ;New Key No Time Offset Delay CLR KD_TEMPRET ;* SUBROUTINExx: Send Remote Code * SEND_REMOTE_CODE:clr WDTSZ fg_SendActiveJMP READY_SENDretREADY_SEND:REMOTE CODE SEND & DATA FRAME DELAY TIME OFFSETretEND*End of program *SEND CODE PROCEDURE FLOWCHARTOffset DataFrameRepetiti on timeA. HT6221 ( NEC FORMAT ).*;* File name : NEC.FORMAT (Remote 64KEY) *;*OSC:455KHzCARRY:38KHz* ;*.*#define CUS_6221_1 00110100b;1234H#define CUS_6221_2 00010010b;-NEC_CODE .SECTION CODE;* suBROUTINExx: Send Remote Code *SEND_REMOTE_CODE:clr WDT;CHECK VALIDITY KEYSZ fg_Se ndActiveJMP READY_SENDretREADY_SEND:NEC_CODE:mov A,a_KEY_NUM ;READ KEY DATA2.5ms (284cycle)First code-Repetition time 108ms = 12286 cycleRepeat Code0.56ms*(63cyclefi(63cycle)HT48CA0 *NEC .SECTION DATAa_REM_CODE DB ?a_CUSTOMER_1 DB ?a_CUSTOMER_2 DB ?;KEY DATA CODE;CUSTOMER CODE LOW BYTE;CUSTOMER CODE HIGH BYTENEC Format CodeRepeat Code胃4 0.56msE |9ms 1.12ms0.56msEX.logic 0PS. Custom Code = 0808HData Code =mov M_TBLP,ATABRDL a_REM_CODEMOV A,CUS_6221_1 ;READ CUSTOMER CODEMOV a_CUSTOMER_1,AMOV A,CUS_6221_2MOV a_CUSTOMER_2,A;- Starting send NEC Remote code - SEND_NEC:;Check No KeyCode ffHSIZAJMPreta_REM_CODE LEADNEC_CODELEADNEC_CODE:; 1 Instruction Cycle = 8.79usclrpn_IR;High Level 9 ms (455KHz:1023 Cycle)movA,002d ; (3*168)+5*2 = 1018mova_SR13,ALEADIND_CODE_00:movA,168dmovM_ACC,ALEADIND_CODE_01:SDZM_ACCJMPLEADIND_CODE_01SDZa_SR13JMPLEADIND_CODE_00NOP2NOP2NOPsetpn_IRclrwdtmovA,001d;LOW Level 2.5ms (284Cycle)mova_SR13,A ; (4*69)+5*1 = 281LEAD_CODE_04:movA,70dmovM_ACC,ALEAD_CODE_05:NOPSDZM_ACCJMPLEAD_CODE_05SDZa_SR13JMPLEAD_CODE_04clrwdtSZfg_REPEAT ;CHECK REPEAT KEYJMPREPEAT_CODEmovA,001d;LOW Level 2.0ms (227Cycle)mova_SR13,A ; (4*55)+5*1 = 225LEAD_CODE_06:movA,53dmovM_ACC,ALEAD_CODE_07:NOPSDZM_ACCJMPLEAD_CODE_07SDZa_SR13JMP LEAD_CODE_06 clr wdt nop2CUSNEC_CODE:movA,002dmova_SR13,AMOVA,OFFSET a_CUSTOMER_1MOVM_MP0,ACUSTOM_PRO:movA,008dmova_SR11,A; 8 data bitnopCUSTOM_BIT_BL ;0.56ms-63 Cycleclrpn_IR ;(3*20)+2=62movA,20dCUSTOM_BIT_BL_1:SDZM_ACCJMPCUSTOM_BIT_BL_1clrwdtnopCUSTOM_BIT_BH: ;0 0.56ms-63 Cyclesetpn_IR ;1 1.68ms-191 CyclenoprrM_INDIRECT1 ;movA,18dSZM_INDIRECT1.7 ;movA,61dCUSTOM_BIT_BH_0:SDZM_ACCJMPCUSTOM_BIT_BH_0clrwdtSDZa_SR11JMPCUSTOM_BIT_BLINCM_MP0SDZa_SR13JMPCUSTOM_PRODATA6NEC_BIT:movA,002dmova_SR13,ADATA_ PRO:movA,008dmova_SR11,A ; 8 data bitnopDATA_ BIT_BL: ;0.53ms-60 Cycleclrpn_IR ;(3*19)+2=59movA,20dDATA _BIT_BL_1:SDZM_ACCJMPDATA_BIT_BL_1clr wdtnopDATA_BIT_BH: ;0 0.53ms-60 Cyclesetpn_IR ;1 1.58ms-179 Cyclenoprra_REM_CODE ;movA,18dSZa_REM_CODE.7movA,61dDATA _BIT_BH_0:SDZM_ACCJMPDATA_BIT_BH_0clrwdtSDZa_SR11JMPDATA_BIT_BLCPLA_REM_CODESDZa_SR13JMPDATA_PROclr;0.53ms-60 Cyclepn_IR ;(3*19)+2=59movA,20dDATA _BIT_BL_2:SDZM_ACCJMPDATA_BIT_BL_2clrwdtsetpn_IR;- Frame Delay Time Process -movA,004d;Repetition time=108ms (12286 Cycle)mova_SR13,A;Scan Key = 2471 Cycle;Send Code = 7349 CycleFDTP_LOOP_01:;12286-2471-7349=2466movA,152d;(4*152)+5*4=2452mov M_ACC,AFDTP_LOOP_02:nopSDZM_ACCJMPFDTP_LOOP 02clrwdtSDZa_SR13JMPFDTP_LOOP_01movA,3dmovM_ACC,AFDTP_LOOP_03:SDZ M_ACCJMP FDTP_LOOP_03NOP2retREPEAT_CODE:;0.56ms-63 Cycleclr pn_IR ;(3*20)+2=62mov A,19dREP_BIT_BL_3:SDZ M_ACCJMP REP_BIT_BL_3clr wdtset pn_IR;- Repeat Frame Delay Time Process -mov A,016d;Repetition time=108ms (12286 Cycle)mov a_SR13,A;Scan Key = 2471 Cycle;Send Repeat Code = 1390 CycleREP_DELAY_02: ;12286-2471-1390=8425mov A,130d ;(4*130)+5*16=8400mov M_ACC,A ;REP_DELAY_03: ;nopSDZM_ACCJMPREP_DELAY_03clrwdtSDZa_SR13JMPREP_DELAY_02movA,07dmovM_ACC,AREP_DELAY_04:SDZ M_ACCJMP REP_DELAY_04NOP2ret% Remote Table Array %org 300h; -000000 00000000;|;+- 8 bit Data code; NEC Key00:01020304050607080123456:1:1:1:1:1:11600ffh; Key 00 : -0000h; Key 1 :0001h; Key 2 :0002h; Key 3 :0003h; Key 4 :0004h; Key 5 :0005h; Key 6 :0006h; Key 7 :0007h; Key 8 :0008h; Key 9 :0009h; Key 10 :000ah; Key 11 :000bh; Key 12 :000ch; Key 13 :000dh; Key 14 :000eh; Key 15 :000fh; Key 16 :0010h; Key 17 :WWWWWWWWWWWWWWWWWDDDDDDDDDDDDDDDDDDW0011h; Key 18DW0012h; Key 19DW0013h; Key 20DW0014h; Key 21DW0015h; Key 22DW0016h; Key 23DW0017h; Key 24DW0018h; Key 25DW0019h; Key 26DW001ah; Key 27DW001bh; Key 28DW001ch; Key 29DW001dh; Key 30DW001eh; Key 31DW001fh; Key 32DW0020h; Key 33DW0021h; Key 34DW0022h; Key 35DW0023h; Key 36DW0024h; Key 37DW0025h; Key 38DW0026h; Key 39DW0027h; Key 40DW0028h; Key 41DW0029h; Key 42DW002ah; Key 43DW002bh; Key 44DW002ch; Key 45DW002dh; Key 46DW002eh; Key 47DW002fh; Key 48DW0030h; Key 49DW0031h; Key 50DW0032h; Key 51DW0033h; Key 52DW0034h; Key 53DW0035h; Key 54DW0036h; Key 55DW0037h; Key 56DW0038h; Key 57DW0039h; Key 58DW003ah; Key 59DW003bh; Key 60DW003ch; Key 61DW003dh; Key 62DW003eh; Key 63DW003fh; Key 64ENDB. M50560 (MITSUBISH Format)(HT6240)8ms(4.22msk (HT6240)M7(4.22ms;J (8.44ms)C0 C1 C2 C3 C4 C5 C6 C7EndD0 D1D2 D3 D4 D5 D6 D7End4ms4msHead pulse8 Custom bits8 Date bits1st. code2nd. codeRepetition time 80ms (67.5ms)-百500usp30u护1ms(1.06ms) f500usT530us)*(Carry 38KHz)2ms(2.11ms)logic 0logic 1PS. 500us = 56 cycle (530us = 60 cycl2ms-500us=1.5ms = 170 cycle(2.11ms-530us=1.58ms = 179 cycl80ms = 9101 cycle(67.5ms =7678ms = 910 cycle (8.44ms = 9604ms = 455 cycle (4.22ms = 480EX.*;* File name : MITSUBISH.FORMAT (Remote 64KEY);* OSC:455KHz CARRY:38KHz* ;*HT48CA0 *.*MITSUBISH .SECTION DATAa_REM_CODE DB ?;KEY DATA CODEa_FACTOR DB ?;KEY DATA DELAY TIME FACTORa_CUSTOMER_1 DB ?;CUSTOMER CODE#define CUS_5056011101110b ;0EEH;-MITSUBISH_CODE .SECTION CODE;* suBROUTINExx: Send Remote Code *SEND_REMOTE_CODE:clr WDT;CHECK VALIDITY KEYSZ fg_Se ndActiveJMP READY_SENDretREADY_SEND:M5056_ACODE:mov A,a_KEY_NUM ;READ KEY DATAmov M_TBLP,A ;TABRDL a_REM_CODE;mov A,M_TBLH ;READ Data Delay Time Factor and A,00001111b ;mov a_FACTOR,A ;MOV A,CUS_50560 ;READ CUSTOM CodeMOV a_CUSTOMER_1,A ;- Starting send 5056 Remote code -SEND_5056:SIZA a_REM_CODE ;CHECK NO KEY CODE ffHJMP LEAD50_CODEretLEAD50_CODE:clrpn_IR ;movA,001d;High Level 8.ms (910Cycle)mova_SR13,A; (4*226)+5*1 = 909LEAD50_CODE_00:movA,225dmovM_ACC,ALEAD50_CODE_01:NOPSDZM_ACCJMPLEAD50_CODE _01SDZa_SR13JMPLEAD50_CODE _00clr wdtnopNOP2setpn_IRmovA,001d ;Low Level 4ms (455Cycle)mova_SR13,A ;(4*112)+5*1 = 453LEAD50_CODE_02:movA,111dmovM_ACC,ALEAD50_CODE_03:NOPSDZM_ACCJMPLEAD50_CODE_03SDZa_SR13JMPLEAD50_CODE_02clr wdtNOP2CUS50_CODE:mov A,008dmov a_SR11,A ; 8 data bitCUS50_BIT_BL: ;0.5ms-57 Cycle clr pn_IR ;(3*18)+2=56 mov A,18dCUS50_BIT_BL_1:SDZ M_ACCJMP CUS50_BIT_BL_1clr wdtnopCUS50_BIT_BH: ;0 0.5ms-57 Cycle set pn_IR ;1 1.5ms-170 Cycle rra_CUSTOMER_1 ;mov A,16dnopSZ a_CUSTOMER_1.7 ;mov A,54dCUS50_BIT_BH_0:SDZ M_ACCJMP CUS50_BIT_BH_0clr wdtSDZ a_SR11JMP CUS50_BIT_BL;0.5ms-57 Cycle clr pn_IR ;(3*18)+2=56 mov A,18dCUS50_BIT_BL_2:SDZ M_ACCJMP CUS50_BIT_BL_2clr wdtnopset pn_IR;-;Low Level 4ms (455Cycle); (4*112)+5*1 = 453 mov A,001d mov a_SR13,ALEAD50_CODE_04:mov A,111dmov M_ACC,ALEAD50_CODE_05:NOPSDZM_ACCJMPLEAD50_CODE_05SDZa_SR13JMPLEAD50_CODE_04clr wdtNOP2DATA50_BIT:mov A,008dmov a_SR11,A; 8 data bitDAT50_BIT_BL:;0.5ms-57 Cycleclr pn_IR ;(3*18)+2=56 mov A,18dDAT50_BIT_BL_1:SDZ M_ACCJMP DAT50_BIT_BL_1 clr wdt nopDAT50_BIT_BH:;0 0.5ms-57 Cycleset pn_IR;1 1.5ms-170 Cyclerr a_REM_CODE ;mov A,16dnopSZ a_REM_CODE.7mov A,54dDAT50_BIT_BH_0:SDZ M_ACCJMP DAT50_BIT_BH_0clr wdtSDZ a_SR11JMP DAT50_BIT_BL;0.5ms-57 Cycleclr pn_IR ;(3*18)+2=57mov A,18dDAT50_BIT_BL_2:SDZ M_ACCJMP DAT50_BIT_BL_2clr wdtnopset pn_IR;- delay factor ;Low Level 1.ms (114Cycle); (4*27)+5*1 = 113mov A,a_FACTORmov a_SR13,ADELAY50_CODE_01:mov A,27dnop2mov M_ACC,ADELAY50_CODE_02:NOPSDZ M_ACCJMP DELAY50_CODE_02clr wdtSDZ a_SR13JMP DELAY50_CODE_01;- FRAME DELAY TIME PROCESS -mov A,002d;Repetition time=80ms (9101 Cycle)mov a_SR13,A;Scan Key = 2471 Cycle;Send Code = 7349 Cycle DELAY_LOOP_01: ;9101-2471-5376=1254mov A,155d ;(4*155)+5*2=1250mov M_ACC,ADELAY_LOOP_02:nopSDZ M_ACCJMP DELAY_LOOP_02clr wdtSDZ a_SR13JMP DELAY_LOOP_01NOP2CODE50_END:45ret;* SUBROUTINExx: Scan Key Matrix *;% Remote Table Array %org 300h; -000000 00000000|+- 8 bit Data code+- Delay Factor (Data 0 bit Num); M50560Key00FFh0800h0701h0702h0603h0704h0605h0606h0507h0708h0609h060ah050bh060ch050dh050eh040fh0710h0611h0612h0513h0614h0515h0516h0417h0618h0519h051ah041bh051ch041dh041eh031fh0720h0621h0622h0523h0624h0525h0226h0427h0628h0529h052ah042bh052ch; Key XX :; Key 1 : - ;Key 2 : - ;Key 3 : ; Key4 : ; Key 5 : ;Key 6 : ; Key7 : ; Key 8 : ;Key 9 : ; Key10 ; Key 11 ;Key 12 ; Key13 ; Key 14 ;Key 15 ; Key16 : ; Key17 ; Key 18 ;Key 19 ; Key20 ; Key 21 ;Key 22 ; Key23 ; Key 24 ;Key 25 ; Key26 ; Key 27 ;Key 28 ; Key29 ; Key 30 ;Key 31 ; Key32 : ; Key33 ; Key 34 ;Key 35 ; Key36 ; Key 37 ;Key 38 ; Key39 ; Key 40 ;Key 41 ; Key42 ; Key 43 ;Key 44 ; Key450:0:0203040506070801234511111178901234567890111222222222233234567890123333333344444544484555555555566166DW042dh; Key 46DW042eh; Key 47DW032fh; Key 48 :DW0630h; Key 49DW0531h; Key 50DW0532h; Key 51DW0433h; Key 52DW0534h; Key 53DW0435h; Key 54DW0436h; Key 55DW0337h; Key 56DW0538h; Key 57DW0439h; Key 58DW043ah; Key 59DW033bh; Key 60DW043ch; Key 61 :DW033dh; Key 62DW033eh; Key 63DW023fh; Key 64 :ENDC. SONY Format(273cycle)2.4ms1st. codeRepetition time 45ms = 5119 cycle.*;-SONY_CODE .SECTION CODE;* suBROUTINExx: Send Remote Code *SEND_REMOTE_CODE:clr WDT;CHECK VALIDITY KEYSZfg_Se ndActiveJMP READY_SENDretREADY_SEND:SONY_CODE:mov A,a_KEY_NUM ;READ KEY DATAmov M_TBLP,AimHeaderD0D1D2D3D4D5D6C0C1C2C3C4 C5C6C7C8C9C10 C11C125 Category bits7 Data bits3 (8) HEX bitsEX.(68cycle)u 0.6ms一0.6ms _ logic 0亠0.6ms-亠1.2ms-i(136cycle)logic 11 0 0 0 1 0 0 0 0 1 0 0 0 1 0;I:I |;!LeaderData CodeCategory Code HEX Code(11H)(44H)2nd. code;* File name : SONY.FORMAT (Remote 64KEY) *;* OSC:455KHz CARRY:38KHz *;*HT48CA0SONY .SECTIONDATAa REM CODEDB ?;KEY DATA CODEa_KEY_TEMPDB ?;KEY DELAY TIME OFFSET COUNTa_CategoryDB ?;SAVE Category Code*.*#defi ne CATEGORY 00000100b ;04HTABRDL a_REM_CODEMOV A,CATEGORY ;READ CATEGORY CODEMOV a_Category,A;- Starting send SONY Remote code -SEND_SONY:SIZA a_REM_CODE ;Check No Key Code ffHJMP LEADSY_CODEretLEADSY_CODE:clr pn_IR ;High Level 2.4ms (455KHz:273 Cycle) mov A,89d ; (3*91)= 273mov M_ACC,ALEADIND_CODE_00:SDZ M_ACCJMP LEADIND_CODE_00clr wdtCLR a_KEY_TEMPmovA,007dmova_SR11,A; 7 data bitDATSY_BIT_BL:;0.6ms-68 CycleSETpn_IR;(3*22)+2=59mov A,22dDATSY_BIT_BL_1:SDZM_ACCJMPDATSY_BIT_BL_1clrwdtDATSY_BIT_BH: ;0 0.6ms-68 Cycle CLR pn_IR;1 1.2ms-136Cyclerr a_REM_CODE ;movSZmovA,19da_REM_CODE.7A,42dDATSY_BIT_BH_0:SDZ M_ACCJMP DATSY_BIT_BH_0clr wdtSNZ a_REM_CODE.7INC a_KEY_TEMP ;COUNT DELAY TIME OFFSET NOPSDZ a_SR11JMP DATSY_BIT_BLCATESY_BIT: ;SEND Category Code mov A,005dmov a_SR11,A ; 5 Category BitDATASY_BIT:;SEND KEY DATA CODECATSY_BIT_BL: ;0.6ms-68 CycleSET pn_IR;(3*22)+2=59mov A,22dCATSY_BIT_BL_1:SDZJMPM_ACCCATSY_BIT_BL_1clr wdtCATSY_BIT_BH: ;0 0.6ms-68 Cycle CLR pn_IR ;1 1.2ms-136 Cycle rr a_Category ;mov SZmovA,20da_Category.7A,43dCATSY_BIT_BHSDZJMPM_ACCCATSY_BIT_BH_0clr wdtSDZJMPa_SR11CATSY_BIT_BLSETpn_IR;- delay factorDELSY_CODE_00:SZJMPJMPa_KEY_TEMP ;CHECK DELAY TIME OFFSET COUNTDELSY_PRO SEND_ENDDELSY_MOVMOVPRO:A,a_KEY_TEMP a_SR11,ADELSY_LP:mov A,21d ;0.6ms -68CycleDELSY_BIT_BL_1:SDZJMPM_ACCDELSY_BIT_BL_1clr wdtNOPSDZJMPa_SR11DELSY_LPFrame Delay Time ProcessmovmovA,001d ;Repetition time=45ms (5119 Cycle)a_SR13,A ;Scan Key = 2471 Cycle;Send Code = 2473 CycleFDTP_LOOP_01: ;5119-2471-2473=175movmovA,42d ;(4*42)+5*1=173M_ACC,AFDTP_LOOP_02:nopSDZM_ACCJMP FDTP_LOOP_02clr wdtSDZ a_SR13JMP FDTP_LOOP_01SEND_END:ret;% Remote Table Array %org 300h; -000000 00000000;|;+- 7 bit Data code; SONY KeyDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDWDW00ffh0000h0001h0002h0003h0004h0005h0006h0007h0008h0009h000ah000bh000ch000dh000eh000fh0010h0011h0012h0013h0014h0015h0016h0017h0018h0019h001ah001bh001ch001dh001eh001fh0020h0021h0022h0023h0024h0025h0026h0027h0028hKey 00 : - ;Key 1 : - ;Key 2 : ; Key3 : ; Key 4 : ;Key 5 : ; Key6 : ; Key 7 : ;Key 8 : ; Key9 : ; Key10 ; Key11 ; Key 12 ;Key 13 ; Key14 ; Key 15 ;Key 16 : ;Key 17 ; Key18 ; Key19 ; Key20 ; Key21 ; Key22 ; Key23 ; Key24 ; Key25 ; Key26 ; Key27 ; Key 28 ;Key 29 ; Key30 ; Key 31 ;Key 32 : ;Key 33 ; Key34 ; Key35 ; Key36 ; Key37 ; Key38 ; Key39 ; Key40 ; Key 41000304050607080910012341111178901234567890111222222222233234567890333333344444544484555555555566166DW0029h; Key 42DW002ah; Key 43DW002bh; Key 44DW002ch; Key 45DW002dh; Key 46DW002eh; Key 47DW002fh; Key 48DW0030h; Key 49DW0031h; Key 50DW0032h; Key 51DW0033h; Key 52DW0034h; Key 53DW0035h; Key 54DW0036h; Key 55DW0037h; Key 56DW0038h; Key 57DW0039h; Key 58DW003ah; Key 59DW003bh; Key 60DW003ch; Key 61DW003dh; Key 62DW003eh; Key 63DW003fh; Key 64ENDD. M3010(PHILIPS FORMAT)(SAA3010)(HT6230)EX.;* File name : PHILIPS.FORMAT (Remote 64KEY) * ;* OSC:429KHzCARRY:36KHz* ;*.*PHILIPS .SECTION DATA;* suBROUTINExx: Send Remote Code * SEND_REMOTE_CODE:clr WDT;CHECK VALIDITY KEYSZ fg_Se ndActiveJMP READY_SENDret1st. code2nd. code*- Repetitio n time (64 bit-time)-114.573ms = 12288 cycle(Carry 36KHz). PS. system code = 00H 1FH- comma nd code = 00H 3FHlogic 1肯895us盲96cycle*HT48CA0a_REM_CODE DB ?a_FACTOR DB ?a_CUSTOMER_1 DB ?a_CONTROL_BIT DB ?;-PHILIPS CODE .SECTION;KEY DATA CODE;KEY DATA DELAY TIME FACTORCUSTOMER CODE ;SAVECONTROL BIT FLAGCODE(OSC : 429KHz Carry : 36KHz )one codelogic 0.*READY_SEND:M3010_CODE:mov A,a_KEY_NUM ;READ KEY DATA mov M_TBLP,A ;TABRDL a_REM_CODE ;RL a_REM_CODE ;RL a_REM_CODE ;MOV A,M_TBLH ;READ SYSTEM CODERL M_ACCRL M_ACCRL M_ACCMOV a_CUSTOMER_1,ASNZ fg_REPEAT ;INC a_CONTROL_BIT ;NEW KEY 1&0 REPEAT ;- Starting send 6121 Remote code- SEND_M3010:SIZA a_REM_CODE ;CHECK NO KEY CODE ffHJMP START_BITretSTART_BIT: ;START BITE 11BSAT_BIT1:SET pn_IRSAT_BIT1_PRO:MOV A,33dSAT_BIT1P1:SDZ M_ACCJMP SAT_BIT1P1 clr wdtNOPCLR pn_IR;895uS-102 cycle HIGHMOV A,32d;(3*33)+2=101SAT_BIT1P2:SDZ M_ACCJMP SAT_BIT1P2clr wdtSZ a_REM_CODE.0JMP SAT_BIT3SAT_BIT2:NOP2SET pn_IRSAT_BIT2_PRO: ;895uS-102 cycle LOWMOV A,33d;(3*33)+2=101SAT_BIT1P3:SDZ M_ACCJMP SAT_BIT1P3clr wdtNOPCLR pn_IR;895uS-102 cycle HIGHMOV A,32d;(3*33)+2=101SAT_BIT1P4:;895uS-102 cycle LOW;(3*33)+2=101SDZ M_ACCJMP SAT_BIT1P4
展开阅读全文