📄 motor.l
字号:
Sat Jan 14 09:29:55 2006
SAM8 Assembler for Reduced Instruction Ver. 2.15T(Win32)
Copyright (c) 2003 Samsung Electronics Co.
--------------------------------------------------------------------
Source File Name : motor.src
Output File Name : motor.o
List File Name : motor.l
1
2
3 .include "define.mac"
4 .include "S3c9454.reg"
5 ; 86C4504.REG Copyright (c) 1996 SAMSUNG ELECTRONICS CO.
6
7 .list on
8
9
10 ;*************************************************************
11 ; variable define
12 00 00 serial_data equ 00h ;74ls164 data
13 00 01 serial_clk_0 equ 01h
14 00 02 serial_clk_1 equ 02h
15
16 00 03 key_press_time equ 03h ;delay time counter 20ms
17 00 04 key_first_flag equ 04h ;if press first #01 else #00
18 00 05 key_hold_down equ 05h ;if key already hold down
19 00 06 key_value equ 06h
20 00 07 key_value_store equ 07H
21 00 08 key_delay_time1 equ 08h ;0.36S delay
22 00 09 key_delay_time2 equ 09H
23 00 0A key_press_down equ 0ah
24 00 0B key_realease_flag equ 0bh
25 00 0C key_release equ 0ch
26
27 00 10 fire_status equ 10H
28 00 11 temp_status equ 11h
29 00 12 lamp_status equ 12h
30 00 13 sound_status equ 13h
31 00 14 fire_value equ 14h
32 00 15 temp_value equ 15H
33 ;**********************************************************
34 00 12 lamp_status_dress equ 12H
35 00 13 sound_status_dress equ 13H
36 00 14 fire_value_dress equ 14H
37 00 15 temp_value_dress equ 15H
38
39 00 EF I2C_SDA0 equ 0efH ;SDA=P2.4=0 #1110 1111B
40 00 10 I2C_SDA1 equ 10H ;SDA=P2.4=1 #0001 0000B
41 00 DF I2C_SCL0 equ 0dfH ;SCL=P2.5=0 #1101 1111B
42 00 20 I2C_SCL1 equ 20H ;SCL=P2.5=1 #0010 0000B
43 00 E2 I2C_PORT equ P2
44 ;**********************************************************
45 00 16 I2C_ack_flag equ 16h
46 00 17 I2C_wrdata equ 17h
47 00 18 I2C_rddata equ 18h
48 00 19 I2C_data equ 19h
49 00 1A I2C_dress equ 1ah
50 ;***********************************************
51 00 1B led_display_flag equ 1bh ;if led display #01H else #00H
52 00 1C led_15s_time1 equ 1ch ;use to count led_sleep_time
53 00 1D led_15s_time2 equ 1dh
54 00 1E led_15s_time3 equ 1eh
55
56 00 20 motor_value equ 20h
57 00 21 motor_value_temp equ 21h
58
59 00 22 ad_hdata equ 22h
60 00 23 ad_ldata equ 23h
61
62 00 24 beep_flag equ 24h
63 00 25 beep_time1 equ 25h
64 00 26 beep_time2 equ 26h
65
66 00 30 remote_pulse_time equ 30h
67 00 31 remote_flag equ 31h
68 00 32 remote_bit_num equ 32h
69 00 33 remote_byte_num equ 33h
70 00 34 remote_data equ 34h
71 00 35 receive_end_flag equ 35h
72 00 37 remote_byte_buf0 equ 37h
73 00 38 remote_byte_buf1 equ 38h
74 00 39 remote_byte_buf2 equ 39h
75 00 40 remote_byte_buf3 equ 40h
76 00 41 remote_byte_buf4 equ 41h
77 00 42 remote_byte_buf5 equ 42h
78 00 43 remote_byte_buf6 equ 43h
79 00 44 remote_byte_buf7 equ 44h
80 00 45 remote_byte_buf8 equ 45h
81 00 46 remote_byte_buf9 equ 46h
82 00 47 remote_byte_buf10 equ 47h
83 00 48 remote_byte_buf11 equ 48h
84 00 49 remote_byte_buf12 equ 49h
85 00 4A remote_byte_buf13 equ 4ah
86 00 4B remote_byte_buf14 equ 4bh
87
88
89 ;;;;;;;;;define ram part;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
90 ;general_ram:00h-0bfh
91 ;work_register:0c0h-0cfh
92
93
94
95 ;;;;;;;;;define mac part;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
96 ;************initial stack poiter********************
97 ;this marco initials the system clock
98 ;****************************************************
99 init_clock_sp: .macro
100
101 LD CLKCON,#18H ;CPU clock frequency = fxx
102
103 LD SP,#0c0h ;00H-C0H
104
105 .endm
106
107 ;************initial ports macro*********************
108 ;this macro initial P0-P2
109 ;include use the port for I/O or special funtion
110 ;if the port need pull up
111
112 ;Port 0 Control Register:p0conl/p0conh
113
114 ;0 0 = Schmitt trigger input
115 ;0 1 = Schmitt trigger input; pull-up enable
116 ;1 0 = Push-pull output
117 ;1 1 = A/D converter input (ADC3); Schmitt trigger input off
118
119 init_port: .macro
120
121 ld p0conl,#10110101b ;p0.0 key input p0.1 remo input p0.2 RT_AD input
122 ld p0conh,#10101010b ;p0.3-p0.7 output
123 ld p1,#0ffh
124 ld p0pnd,#00000000b ;INT1 falling edge interrupt enable
125
126 ld p1con,#00001010b ;p1.0 not use,p1.1 output,reset_circuit
127
128 ld p2conl,#10101010b ;p2.3-p2.0 output 164_data 164_slk
129 ld p2conh,#01001010b ;p2.6-p2.4 output I2c_SDA I2C_SCL
130
131 ld p2,#0ffH
132
133 .endm
134
135 ;***************initial timers**************
136 ;this marco is used to initial all timers
137 ;including base timer、timer0 、watch timer
138 ;****************************************************
139
140 init_timer: .macro
141
142 ;initial timer0
143 LD T0CON,#10001000b ;timers mode 3.2MHz
144 ;Timer0 clock = fxx/8
145 ;Timer0 interrupt enable
146 LD T0DATA,#50 ;50*0.3125*8=125us
147
148 .endm
149
150 ;****************************************************
151 enable_base_time: .macro
152
153 ;initial base timer
154 LD BTCON,#0b2H ;enable watchdog timer ,Fxx/4096
155 ;Basic timer input clock=fxx/16
156 .endm
157
158 ;****************************************************
159 disable_base_time: .macro
160
161 ;initial base timer
162 LD BTCON,#0a2H ;disable watchdog timer ,Fxx/4096
163 ;Basic timer input clock=fxx/16
164 .endm
165
166
167
168
169
170
171
172
173
174 .public motor_change
175
176 ;*********************************************************
177 0F2D motor_change:
178
179 0F2D 76 10 01 tm fire_status,#01H
180 0F30 EB 09 jr ne,motor_change_end
181
182 0F32 2C 0B ld r2,#0bh
183 0F34 38 14 ld r3,fire_value
184 0F36 E7 02 50 ldc r0,#50h[rr2]
185 0F39 09 20 ld motor_value,r0
186
187 0F3B motor_change_end:
188 0F3B AF ret
189
190
191
192 ;*************************************************************
193 0F3C .end
Total 26 Lines Assembled - 0 Errors, 0 Warnings
Total code size 0xF
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -