?? main.lst
字號:
66 C ;bc A_buff,@EX_FLAG_BIT
67 00A5 0A90 C bs A_buff,@EX_FLAG_BIT
68 00A6 0410 C mov a,A_buff
69 00A7 000F C iow INT_MAST
70 00A8 001E C ior WTDCON
71 00A9 0050 C mov A_buff,a
72 00AA 0B90 C bs A_buff,@0x06
73 00AB 0410 C mov a,A_buff
74 00AC 000E C iow WTDCON
75 C ;----------------------------------------------
76 C ;腳位變化中斷
77 C ;bs INT_STATU,@P6_FLAG_BIT
78 00AD 084F C bc INT_STATU,@P6_FLAG_BIT
79 C
80 00AE 001F C ior INT_MAST
81 C ;bs A_buff,@P6_FLAG_BIT
82 00AF 0050 C mov A_buff,a
83 00B0 0850 C bc A_buff,@P6_FLAG_BIT
84 00B1 0410 C mov a,A_buff
85 00B2 000F C iow INT_MAST
86 C ;----------------------------------------------
87 C
88 00B3 0012 C ret
89 C
90 C
286 include "key.asm"
1 C include "key.inc"
1 C
2 C
3 C ;nec
4 00FD C IR_SYS_CODE equ 0xfd
5 0005 C IR_TIMES equ 0x05 ;當(dāng)長按遙控時
6 00FF C INVALID_KEY equ 0xff
7 C
8 C
9 C
10 C
2 C ;===============================================
3 C ; Function:Get_Remote_Key()取得遙控按鍵
4 C ;===============================================
5 00B4 C Get_Remote_Key:
6 C ;判斷是否有新的遙控碼值到來
7 00B4 0D11 C jbc Status_1,@IR_KEY_OK_BIT
8 00B5 14EE C jmp get_ir_code
9 C ;判斷按鍵重復(fù)次數(shù)是否為零,為零表示無按鍵按下
10 00B6 041A C mov a,Ir_Repeat_Times
11 00B7 1D00 C sub a,@0x00
12 00B8 0C83 C jbc FLAG,@Z
13 00B9 14FB C jmp get_code_ret
14 C ;判斷按鍵是否彈起
15 00BA 0F51 C jbs Status_1,@IR_KEY_DOWN_UP_BIT
16 00BB 14E2 C jmp ir_key_up
17 C ;=====================================================================
18 C
19 C
20 C ;--------------------------------------------------------------------------------
21 C ;需要連續(xù)發(fā)射的按鍵
22 C ;--------------------------------------------------------------------------------
23 00BC 041B C mov a,Current_Key
24 00BD 1D00 C sub a,@IR_VOL_UP
25 00BE 0C83 C jbc FLAG,@Z
26 00BF 14DA C jmp set_con_send_code
27 C ;-----------------------------
28 00C0 041B C mov a,Current_Key
29 00C1 1D00 C sub a,@IR_VOL_DOWN
30 00C2 0C83 C jbc FLAG,@Z
31 00C3 14DA C jmp set_con_send_code
32 C ;-----------------------------
33 C
34 C
35 C
36 C
37 C
38 C ;--------------------------------------------------------------------------------
39 C ;需要長按才需發(fā)射的按鍵
40 C ;--------------------------------------------------------------------------------
41 00C4 041B C mov a,Current_Key
42 00C5 1D00 C sub a,@IR_VOL_FF
43 00C6 0C83 C jbc FLAG,@Z
44 00C7 14CF C jmp set_hold_send_code
45 C ;-----------------------------
46 00C8 041B C mov a,Current_Key
47 00C9 1D00 C sub a,@IR_VOL_FF
48 00CA 0C83 C jbc FLAG,@Z
49 00CB 14CF C jmp set_hold_send_code
50 C ;-----------------------------
51 C
52 C
53 C
54 C
55 C
56 C
57 C ;--------------------------------------------------------------------------------
58 C ;只需發(fā)射一次的按鍵
59 C ;--------------------------------------------------------------------------------
60 00CC 0951 C bc Status_1,@IR_KEY_DOWN_UP_BIT ;手動設(shè)置按鍵狀態(tài)為彈起
61 00CD 0AD1 C bs Status_1,@KEY_VALID_BIT ;置按鍵為有效
62 C
63 00CE 14FB C jmp get_code_ret
64 C
65 00CF C set_hold_send_code:
66 C ;沒彈起,有按鍵
67 00CF 041A C mov a,Ir_Repeat_Times
68 00D0 1D05 C sub a,@IR_TIMES ;長按響應(yīng)時間
69 00D1 0C03 C jbc FLAG,@C
70 00D2 14FB C jmp get_code_ret
71 00D3 00DA C clr Ir_Repeat_Times
72 00D4 041B C mov a,Current_Key
73 00D5 1F60 C add a,@HOLD_KEY_ADDR
74 00D6 005B C mov Current_Key,a
75 00D7 0AD1 C bs Status_1,@KEY_VALID_BIT ;設(shè)為按鍵有效
76 00D8 0951 C bc Status_1,@IR_KEY_DOWN_UP_BIT;手動設(shè)置按鍵狀態(tài)為彈起
77 00D9 0012 C ret
78 C
79 C ;-----------------------------------------------------------------------------------------
80 00DA C set_con_send_code:
81 C ;沒彈起,有按鍵
82 00DA 041A C mov a,Ir_Repeat_Times
83 00DB 1D05 C sub a,@IR_TIMES ;單次發(fā)送響應(yīng)時間
84 00DC 0C03 C jbc FLAG,@C
85 00DD 14FB C jmp get_code_ret
86 00DE 1801 C mov a,@0x01
87 00DF 005A C mov Ir_Repeat_Times,a
88 C ;置按鍵為有效
89 00E0 0AD1 C bs Status_1,@KEY_VALID_BIT
90 00E1 0012 C ret
91 C ;======================================================================
92 C
93 C ;按鍵彈起
94 00E2 C ir_key_up:
95 C ;清除按鍵重復(fù)次數(shù)
96 00E2 00DA C clr Ir_Repeat_Times
97 C ;判斷按鍵值是否是需要長按按鍵
98 C
99 C ;-----------------------------
100 00E3 1800 C mov a,@IR_VOL_FF
101 00E4 011B C sub a,Current_Key
102 00E5 0C83 C jbc FLAG,@Z
103 00E6 14EC C jmp send_code
104 C ;-----------------------------
105 00E7 1800 C mov a,@IR_VOL_FF
106 00E8 011B C sub a,Current_Key
107 00E9 0C83 C jbc FLAG,@Z
108 00EA 14EC C jmp send_code
109 C ;-----------------------------
110 00EB 0012 C ret
111 00EC C send_code:
112 C
113 C ;置按鍵為有效
114 00EC 0AD1 C bs Status_1,@KEY_VALID_BIT
115 00ED 0012 C ret
116 C
117 C ;============================================================
118 C ;第一次獲得按鍵碼值
119 00EE C get_ir_code:
120 00EE 0911 C bc Status_1,@IR_KEY_OK_BIT ;清除標(biāo)志位
121 00EF 18FD C mov a,@IR_SYS_CODE
122 00F0 0117 C sub a,Remote_Sys_Code0 ;判斷遙控系統(tǒng)碼
123 00F1 0E83 C jbs FLAG,@Z
124 00F2 14FB C jmp get_code_ret
125 00F3 04D5 C com remote_cmd_code0 ;客戶碼取反
126 00F4 0415 C mov a,Remote_Cmd_Code0 ;判斷客戶碼是否相等
127 00F5 0114 C sub a,Remote_Cmd_Code1
128 00F6 0E83 C jbs FLAG,@Z
129 00F7 14FB C jmp get_code_ret
130 00F8 C get_code:
131 C ;bs Status_1,@KEY_VALID_BIT
132 00F8 0415 C mov a,Remote_Cmd_Code0
133 00F9 005B C mov Current_Key,a
134 00FA 055A C inc Ir_Repeat_Times
135 00FB C get_code_ret:
136 00FB 0012 C RET
137 C
138 C
139 C
140 C ;===============================================
141 C ; Function:Get_Key()取得整個程序按鍵
142 C ;===============================================
143 00FC C Get_Key:
144 C
145 00FC 0012 C RET
146 C ;**********************************************************************
147 C
148 C
287 include "time.asm"
1 C ;===============================================
2 C ; Function:延遲25ms
3 C ;===============================================
4 00FD C delay_25ms:
5 00FD 00D2 C clr Time_Int_Count
6 00FE C con_delay_25ms:
7 00FE 0412 C mov a,Time_Int_Count
8 00FF 1DFA C sub a,@250d
9 0100 0E83 C jbs FLAG,@Z
10 0101 14FE C jmp con_delay_25ms
11 0102 0012 C ret
12 C
13 C
14 C
15 C
16 C
17 C ;===============================================
18 C ; Function:延遲1s
19 C ;===============================================
20 C
21 0103 C delay_1s:
22 0103 00ED C clr AudCnt3
23 0104 C con_delay_1s:
24 0104 10FD C call delay_25ms
25 0105 056D C inc AudCnt3
26 0106 042D C mov a,AudCnt3
27 0107 1D14 C sub a,@20d
28 0108 0E83 C jbs FLAG,@Z
29 0109 1504 C jmp con_delay_1s
30 010A 0012 C ret
31 C
32 C
288
289 END
290 ;===============================================
291 ; End of file.
292 ;===============================================
293
0 Error(s), 0 Warning(s), 0 User Message(s)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -