📄 black_plane-tx-v2.37.lst
字号:
1 000000 ;*******************************************************************************
2 000000 ; FILENAME : Black_plane-TX
3 000000 ; AUTHOR : Hu Zhiyan
4 000000 ; PURPOSE : Template Code for SN8P1602B
5 000000 ; REVISION : 10/05/2004 V1.0 First issue
6 000000 ;*******************************************************************************
7 000000 ;* (c) Copyright 2004, Kodec development CO., LTD.
8 000000 ;*******************************************************************************
9 000000 ;///////////////////////////////////////////////////////////////////////////////////////
10 000000 ; V
11 000000 ; V1.3
12 000000 ; V1.35 将测试模式的10秒进入睡眠改为5秒,充电指示灯
13 000000 ; V1.36 清除在睡眠模式时,按充电按钮,绿灯闪烁一下问题
14 000000 ; V1.37 将4分钟后进入睡眠改为15分钟
15 000000 ;
16 000000 ;\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
17 000000
18 000000 CHIP SN8P1602B ; Select the CHIP
19 000000 //{{SONIX_CODE_OPTION
20 000000 .Code_Option OSG Enable
21 000000 .Code_Option High_Clk 4M_X'tal
22 000000 .Code_Option High_Clk/2 Disable
23 000000 .Code_Option Security Enable
24 000000 ; .Code_Option LVD Enable
25 000000 .Code_Option Watch_Dog Disable
26 000000 .Code_Option Low_Power Enable
27 000000 .Code_Option Noise_Filter Enable
28 000000 .Code_Option Int_16K_RC By_CPUM
29 000000 //}}SONIX_CODE_OPTION
30 000000
31 000000 ;-------------------------------------------------------------------------------
32 000000 ; Include Files
33 000000 ;-------------------------------------------------------------------------------
34 000000
35 000000 ;-------------------------------------------------------------------------------
36 000000 ; Constants Definition
37 000000 ;-------------------------------------------------------------------------------
38 000000 ; ONE EQU 1
39 000000
40 000000 ;-------------------------------------------------------------------------------
41 000000 ; Variables Definition
42 000000 ;-------------------------------------------------------------------------------
43 000000 .DATA
44 000000 org 0h ;Data section start from RAM address 0
45 0000 D Wk00 DS 1 ;Temporary buffer for main loop
46 0001 D Iwk00 DS 1 ;Temporary buffer for ISR
47 0002 D AccBuf DS 1 ;Accumulater buffer
48 0003 D PflagBuf DS 1 ;PFLAG buffer
49 000004
50 E 00000009 flag3 equ 09h
51 E 00000010 flag1 equ 10h
52 E 00000011 flag2 equ 11h
53 E 00000012 keyinbuf equ 12h
54 E 00000013 keychkbuf equ 13h
55 E 00000014 keycvtbuf equ 14h
56 E 00000015 key_value equ 15h
57 E 00000016 key_count equ 16h
58 E 00000017 LEDbuf equ 17h
59 E 00000018 txdata equ 18h
60 000004 ;
61 E 0000001A data_length equ 1ah
62 E 0000001B low_times equ 1bh
63 E 0000001C time50ms equ 1ch
64 E 0000001D time500ms equ 1dh
65 E 0000001E time4s equ 1eh
66 E 0000001F times4 equ 1fh
67 000004 ;
68 E 00000020 sleep_time equ 20h
69 E 00000021 charge_time equ 21h
70 000004
71 E 00000010 key_start equ flag1.0
72 E 00010010 nokeypress equ flag1.1
73 E 00020010 RED_flash_enable equ flag1.2
74 E 00030010 charge_start equ flag1.3 ;?????????????????????????????????????
75 E 00040010 LED_on equ flag1.4
76 E 00050010 time50ms_ok equ flag1.5
77 E 00060010 detect_led_on equ flag1.6
78 E 00070010 charge_ok equ flag1.7
79 000004 ;
80 E 00000011 bitok equ flag2.0
81 E 00010011 code_start equ flag2.1
82 E 00020011 code_head equ flag2.2
83 E 00030011 code_sycn equ flag2.3
84 E 00040011 code_data equ flag2.4
85 E 00050011 code_current_data_ok equ flag2.5
86 E 00060011 code_all_data_ok equ flag2.6
87 E 00070011 before equ flag2.7
88 000004 ;
89 E 00000009 TX_enable equ flag3.0
90 E 00010009 charge_continue equ flag3.1
91 E 00020009 wait_charge equ flag3.2
92 000004
93 000004 ;
94 E 000000D0 p0buf equ p0
95 E 000000D1 p1buf equ p1
96 E 000000C1 p1mbuf equ p1m
97 E 000000D2 p2buf equ p2
98 E 000000C2 p2mbuf equ p2m
99 000004
100 000004 ;-------------------------------------------------------------------------------
101 000004 ; Bit Variables Definition
102 000004 ;-------------------------------------------------------------------------------
103 000004
104 E 00000000 Wk00B0 EQU Wk00.0 ;Bit 0 of Wk00
105 E 00010001 Iwk00B1 EQU Iwk00.1 ;Bit 1 of Iwk00
106 000004
107 000004 ;-------------------------------------------------------------------------------
108 000004 ; Code section
109 000004 ;-------------------------------------------------------------------------------
110 000000 .CODE
111 000000
112 000000 ORG 0 ;Code section start
113 000000 8010 jmp Reset ;Reset vector
114 000001 ;Address 4 to 7 are reserved
115 000008 ORG 8
116 000008 8160 jmp Isr ;Interrupt vector
117 000009
118 000010 ORG 10h
119 000010 ;-------------------------------------------------------------------------------
120 000010 ; Program reset section
121 000010 ;-------------------------------------------------------------------------------
122 000010 Reset:
123 000010 2D7F mov A,#07Fh ;Initial stack pointer and
124 000011 2FDF b0mov STKP,A ;disable global interrupt
125 000012 3600 b0mov PFLAG,#00h ;pflag = x,x,x,x,x,c,dc,z
126 000013 2D40 mov A,#40h ;Clear watchdog timer and initial system mode
127 000014 2FCA b0mov OSCM,A
128 000015
129 000015 C1B4 call ClrRAM ;Clear RAM
130 000016 C19A call SysInit ;System initial
131 000017 6FDF b0bset FGIE ;Enable global interrupt
132 000018
133 000018 ;-------------------------------------------------------------------------------
134 000018 ; Main routine
135 000018 ;-------------------------------------------------------------------------------
136 000018 Main:
137 000018 6ECA b0bset FWDRST ;Clear watchdog timer
138 000019
139 000019 C07D call Mnscan_key ; scan key
140 00001A
141 00001A C0BD call MnRF_TX ; RF TX
142 00001B
143 00001B C01F call Application
144 00001C
145 00001C C0FF call Mntime_count ; time count
146 00001D
147 00001D C14B call MnLED ; LED indicator
148 00001E
149 00001E 8018 jmp Main
150 00001F
151 00001F ;-------------------------------------------------------------------------------
152 00001F ; Main application
153 00001F ;-------------------------------------------------------------------------------
154 00001F Application:
155 00001F ; b0bts1 key_value.6
156 00001F ; jmp App_Normal ; to normal mode
157 00001F ; jmp App_Charge ; to charge mode
158 00001F app_Normal:
159 00001F
160 00001F
161 00001F 6209 b0bclr wait_charge ; added on 2004/10/16
162 000020
163 000020 7909 b0bts1 charge_continue ; when mode the change,will stop the charge mode
164 000021 8029 jmp nor1
165 000022 6109 b0bclr charge_continue
166 000023 6210 b0bclr RED_flash_enable
167 000024 6217 b0bclr LEDbuf.2
168 000025 6E17 b0bset LEDbuf.6
169 000026 6717 b0bclr LEDbuf.7
170 000027 6310 b0bclr charge_start
171 000028 6710 b0bclr charge_ok
172 000029
173 000029 nor1:
174 000029 6809 b0bset TX_enable ; enable tx
175 00002A 6E17 b0bset LEDbuf.6
176 00002B 2D0F mov a,#0fh
177 00002C 2815 and a,key_value
178 00002D 7886 b0bts1 fz ; if z=1,the acc is zero
179 00002E 8030 jmp app_normal10
180 00002F 804A jmp app_normal20
181 000030 app_normal10:
182 000030 2B1E clr time4s ; if there's key pressed,will clear the 4s count
183 000031 2B20 clr sleep_time
184 000032
185 000032 7E11 b0bts1 code_all_data_ok ; if the data transmit ok,will get next data
186 000033 807C jmp app90
187 000034 6611 b0bclr code_all_data_ok
188 000035 7015 b0bts0 key_value.0 ; detect the landing key
189 000036 803E jmp landing
190 000037 7115 b0bts0 key_value.1 ; detect the turbo key
191 000038 8040 jmp turbo
192 000039 7215 b0bts0 key_value.2 ; detect the left key
193 00003A 8042 jmp left
194 00003B 7315 b0bts0 key_value.3 ; detect the right key
195 00003C 8046 jmp right
196 00003D 804A jmp app_normal20
197 00003E
198 00003E landing:
199 00003E ; mov a,#12h
200 00003E ; mov txdata,a ; get the landing code
201 00003E 6009 b0bclr TX_enable ; disable TX
202 00003F 807C jmp app90
203 000040 turbo:
204 000040 ; mov a,#22h
205 000040 ; mov txdata,a ; get the turbo code
206 000040 6009 b0bclr TX_enable ; disable TX
207 000041 807C jmp app90
208 000042 left:
209 000042 6809 b0bset TX_enable ; disable TX
210 000043 2D42 mov a,#42h
211 000044 1F18 mov txdata,a ; get the left code
212 000045 807C jmp app90
213 000046 right:
214 000046 6809 b0bset TX_enable ; disable TX
215 000047 2D82 mov a,#82h
216 000048 1F18 mov txdata,a ; get the right code
217 000049 807C jmp app90
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -