📄 sl3010_3.s
字号:
.dbline 276
.dbline 277
; {//遥控车程序
.dbline 279
;
; port_init();//调用端口初始化函数
L47:
L48:
.dbline -2
.dbline 281
;
; work_status = 0x60;//置对应的工作状态标志
L46:
.dbline 0 ; func end
ret
.dbend
.area eeprom(rom, con, rel)
.dbfile E:/icc/include/sl3010.c
_sound::
.byte 'h,38
.byte 37,35
.byte 34,19
.byte 18,'A
.byte 'A,'A
.byte 35,37
.byte 40,'H
.byte 40,41
.byte 42,41
.byte 38,'E
.byte 'E,'E
.byte 'E,'h
.byte 41,41
.byte 40,38
.byte 37,'F
.byte 'F,'F
.byte 37,38
.byte 41,'C
.byte 37,34
.byte 35,34
.byte 33,'B
.byte 'B,'B
.byte 'B,'c
.byte 37,38
.byte 37,38
.byte 37,35
.byte 34,19
.byte 18,'A
.byte 35,37
.byte 40,40
.byte 40,40
.byte 41,42
.byte 42,41
.byte 'F,'F
.byte 'F,'F
.byte 'F,41
.byte 42,40
.byte 40,38
.byte 37,38
.byte 38,37
.byte 'C,'C
.byte 34,'B
.byte 38,37
.byte 35,34
.byte 19,18
.byte 'A,'A
.byte 'A,'A
.byte 0,0
.dbfile E:\icc\iccavr\sl3010\sl3010_3\sl3010_3.c
.dbsym e sound _sound A[96:96]c
.area data(ram, con, rel)
.dbfile E:\icc\iccavr\sl3010\sl3010_3\sl3010_3.c
.area lit(rom, con, rel)
_TONETABLE::
.word 64580
.word 64684
.word 64777
.word 64820
.word 64898
.word 64968
.word 65030
.word 65058
.word 65110
.word 65157
.word 65178
.word 65217
.word 65252
.word 65283
.word 65297
.dbsym e TONETABLE _TONETABLE A[30:15]ki
.area data(ram, con, rel)
.dbfile E:\icc\iccavr\sl3010\sl3010_3\sl3010_3.c
_sound_add::
.blkb 2
.area idata
.word 0
.area data(ram, con, rel)
.dbfile E:\icc\iccavr\sl3010\sl3010_3\sl3010_3.c
.dbsym e sound_add _sound_add i
_led_delayms::
.blkb 2
.area idata
.word 600
.area data(ram, con, rel)
.dbfile E:\icc\iccavr\sl3010\sl3010_3\sl3010_3.c
.dbsym e led_delayms _led_delayms i
.area lit(rom, con, rel)
_led_data::
.byte 254,253
.byte 251,247
.byte 239,223
.byte 191,127
.byte 191,223
.byte 239,247
.byte 251,253
.byte 254,253
.byte 251,247
.byte 239,223
.byte 191,127
.byte 191,223
.byte 239,247
.byte 251,253
.byte 0,24
.byte 60,126
.byte 255,126
.byte 60,24
.byte 0,24
.byte 60,126
.byte 255,126
.byte 60,24
.byte 248,241
.byte 227,199
.byte 143,31
.byte 143,199
.byte 227,241
.byte 248,241
.byte 227,199
.byte 143,31
.byte 143,199
.byte 227,241
.byte 254,252
.byte 248,240
.byte 224,192
.byte 128,0
.byte 128,192
.byte 224,240
.byte 248,252
.byte 254,252
.byte 248,240
.byte 224,192
.byte 128,0
.byte 128,192
.byte 224,240
.byte 248,252
.byte 255,231
.byte 219,189
.byte 126,189
.byte 219,231
.byte 255,231
.byte 219,189
.byte 126,189
.byte 219,231
.byte 255,0
.byte 255,0
.byte 255,0
.byte 255,0
.byte 10,10
.dbsym e led_data _led_data A[118:118]kc
.area text(rom, con, rel)
.dbfile E:\icc\iccavr\sl3010\sl3010_3\sl3010_3.c
.dbfunc e timer0_init _timer0_init fV
.even
_timer0_init::
.dbline -1
.dbline 90
.dbline 91
clr R2
out 0x33,R2
.dbline 92
ldi R24,61
out 0x32,R24
.dbline 93
ldi R24,5
out 0x33,R24
.dbline -2
.dbline 94
L63:
.dbline 0 ; func end
ret
.dbend
.area vector(rom, abs)
.org 14
rjmp _timer0_ovf_isr
.area text(rom, con, rel)
.dbfile E:\icc\iccavr\sl3010\sl3010_3\sl3010_3.c
.dbfunc e timer0_ovf_isr _timer0_ovf_isr fV
.even
_timer0_ovf_isr::
rcall push_lset
.dbline -1
.dbline 98
.dbline 99
ldi R24,61
out 0x32,R24
.dbline 100
lds R24,_t0_times
subi R24,255 ; addi 1
sts _t0_times,R24
.dbline 101
lds R24,_gzsl
cpi R24,136
brne L65
.dbline 102
.dbline 103
lds R24,_t0_times
cpi R24,10
brne L67
.dbline 104
.dbline 105
lds R24,_timers
subi R24,255 ; addi 1
sts _timers,R24
.dbline 106
clr R2
sts _t0_times,R2
.dbline 107
L67:
.dbline 108
L65:
.dbline 109
lds R24,_gzsl
cpi R24,17
brne L69
.dbline 110
.dbline 111
lds R2,_delay_time1
lds R3,_delay_time1+1
lds R4,_t0_times
clr R5
cp R4,R2
cpc R5,R3
brne L71
.dbline 112
.dbline 113
clr R2
sts _t0_times,R2
.dbline 114
ldi R24,34
sts _gzsl,R24
.dbline 115
rcall _forward
.dbline 116
L71:
.dbline 117
L69:
.dbline 118
lds R24,_gzsl
cpi R24,34
brne L73
.dbline 119
.dbline 120
lds R2,_delay_time2
lds R3,_delay_time2+1
lds R4,_t0_times
clr R5
cp R4,R2
cpc R5,R3
brne L75
.dbline 121
.dbline 122
clr R2
sts _t0_times,R2
.dbline 123
ldi R24,17
sts _gzsl,R24
.dbline 124
rcall _turn_right
.dbline 125
L75:
.dbline 126
L73:
.dbline -2
.dbline 127
L64:
rcall pop_lset
.dbline 0 ; func end
reti
.dbend
.dbfunc e stop_timer0 _stop_timer0 fV
.even
_stop_timer0::
.dbline -1
.dbline 130
.dbline 131
cli
.dbline 132
clr R2
out 0x33,R2
.dbline 133
out 0x35,R2
.dbline 134
out 0x3b,R2
.dbline 135
out 0x39,R2
.dbline 136
sei
.dbline -2
.dbline 137
L77:
.dbline 0 ; func end
ret
.dbend
.area vector(rom, abs)
.org 12
rjmp _timer1_ovf_isr
.area text(rom, con, rel)
.dbfile E:\icc\iccavr\sl3010\sl3010_3\sl3010_3.c
.dbfunc e timer1_ovf_isr _timer1_ovf_isr fV
.even
_timer1_ovf_isr::
st -y,R2
st -y,R3
st -y,R24
in R2,0x3f
st -y,R2
.dbline -1
.dbline 149
.dbline 150
lds R2,_toneconst
lds R3,_toneconst+1
out 0x2d,R3
out 0x2c,R2
.dbline 151
ldi R24,1
in R2,0x15
eor R2,R24
out 0x15,R2
.dbline -2
.dbline 152
L78:
ld R2,y+
out 0x3f,R2
ld R24,y+
ld R3,y+
ld R2,y+
.dbline 0 ; func end
reti
.dbend
.dbfunc e music_car _music_car fV
.even
_music_car::
.dbline -1
.dbline 155
.dbline 156
clr R2
out 0x2f,R2
.dbline 157
ldi R24,2
out 0x2e,R24
.dbline 158
ldi R24,<_sound
ldi R25,>_sound
lds R16,_sound_add
lds R17,_sound_add+1
add R16,R24
adc R17,R25
rcall _EEPROMread
sts _temp1,R16
rjmp L81
L80:
.dbline 160
.dbline 161
lds R2,_temp1
sts _temp,R2
.dbline 162
mov R24,R2
andi R24,15
sts _temp,R24
.dbline 174
mov R2,R24
tst R24
breq L83
.dbline 175
.dbline 176
in R24,0x39
ori R24,128
out 0x39,R24
.dbline 177
mov R24,R2
subi R24,1
sts _temp,R24
.dbline 178
ldi R24,<_TONETABLE
ldi R25,>_TONETABLE
lds R16,_temp
clr R17
lsl R16
rol R17
add R16,R24
adc R17,R25
rcall lpm16
sts _toneconst+1,R17
sts _toneconst,R16
.dbline 179
out 0x2d,R17
out 0x2c,R16
.dbline 180
L83:
.dbline 181
lds R2,_temp1
sts _temp,R2
.dbline 182
mov R24,R2
swap R24
andi R24,#0x0F
sts _temp,R24
.dbline 183
andi R24,15
sts _temp,R24
.dbline 184
mov R18,R24
clr R19
ldi R16,129
ldi R17,0
rcall mpy16s
rcall _delay_ms
.dbline 185
in R24,0x39
andi R24,127
out 0x39,R24
.dbline 186
lds R24,_sound_add
lds R25,_sound_add+1
adiw R24,1
sts _sound_add+1,R25
sts _sound_add,R24
.dbline 187
ldi R24,<_sound
ldi R25,>_sound
lds R16,_sound_add
lds R17,_sound_add+1
add R16,R24
adc R17,R25
rcall _EEPROMread
sts _temp1,R16
.dbline 188
L81:
.dbline 159
lds R2,_temp1
tst R2
breq X7
rjmp L80
X7:
.dbline 189
ldi R16,1000
ldi R17,3
.dbline -2
.dbline 190
L79:
.dbline 0 ; func end
rjmp _delay_ms
.dbend
.dbfunc e xuanya_car _xuanya_car fV
.even
_xuanya_car::
.dbline -1
.dbline 204
.dbline 205
ldi R24,165
out 0x1b,R24
.dbline 207
ldi R24,32
sts _work_status,R24
.dbline 209
rcall _mic_startup
rjmp L87
L86:
.dbline 212
.dbline 214
rcall _sw_touch
.dbline 216
in R24,0x13
andi R24,16
sts _pc,R24
.dbline 217
tst R24
brne L89
.dbline 218
.dbline 219
rcall _backward
.dbline 220
ldi R16,300
ldi R17,1
rcall _delay_ms
.dbline 221
rcall _turn_right
.dbline 222
ldi R16,150
ldi R17,0
rcall _delay_ms
.dbline 223
L89:
.dbline 224
in R24,0x13
andi R24,224
sts _pc,R24
.dbline 225
cpi R24,64
brne L91
.dbline 226
.dbline 227
rcall _backward
.dbline 228
ldi R16,300
ldi R17,1
rcall _delay_ms
.dbline 229
rcall _turn_right
.dbline 230
ldi R16,150
ldi R17,0
rcall _delay_ms
.dbline 231
L91:
.dbline 232
lds R24,_pc
cpi R24,128
brne L93
.dbline 233
.dbline 234
rcall _backward
.dbline 235
ldi R16,300
ldi R17,1
rcall _delay_ms
.dbline 236
rcall _turn_right
.dbline 237
ldi R16,150
ldi R17,0
rcall _delay_ms
.dbline 238
L93:
.dbline 239
lds R24,_pc
cpi R24,32
brne L95
.dbline 240
.dbline 241
rcall _backward
.dbline 242
ldi R16,300
ldi R17,1
rcall _delay_ms
.dbline 243
rcall _turn_right
.dbline 244
ldi R16,150
ldi R17,0
rcall _delay_ms
.dbline 245
L95:
.dbline 246
lds R24,_pc
cpi R24,192
brne L97
.dbline 247
.dbline 248
rcall _backward
.dbline 249
ldi R16,300
ldi R17,1
rcall _delay_ms
.dbline 250
rcall _turn_right
.dbline 251
ldi R16,150
ldi R17,0
rcall _delay_ms
.dbline 252
L97:
.dbline 253
lds R24,_pc
cpi R24,96
brne L99
.dbline 254
.dbline 255
rcall _backward
.dbline 256
ldi R16,300
ldi R17,1
rcall _delay_ms
.dbline 257
rcall _turn_right
.dbline 258
ldi R16,150
ldi R17,0
rcall _delay_ms
.dbline 259
L99:
.dbline 260
lds R24,_pc
cpi R24,224
brne L101
.dbline 261
.dbline 263
rcall _stop
.dbline 264
ldi R24,60
out 0x1b,R24
.dbline 265
ldi R16,300
ldi R17,1
rcall _delay_ms
.dbline 266
ldi R24,195
out 0x1b,R24
.dbline 267
ldi R16,300
ldi R17,1
rcall _delay_ms
.dbline 268
rjmp L102
L101:
.dbline 270
.dbline 271
rcall _forward
.dbline 272
L102:
.dbline 273
L87:
.dbline 211
rjmp L86
X8:
.dbline -2
.dbline 274
L85:
.dbline 0 ; func end
ret
.dbend
.dbfunc e remote_car _remote_car fV
.even
_remote_car::
rcall push_gset1
.dbline -1
.dbline 277
.dbline 279
rcall _port_init
.dbline 281
ldi R24,96
sts _work_status,R24
L104:
.dbline 283
; remote_rst:
; PORTA = 0x0F;
ldi R24,15
out 0x1b,R24
.dbline 284
; mic_startup();//等待声控启动函数
rcall _mic_startup
rjmp L106
L105:
.dbline 287
;
; while(1)
; {
.dbline 289
;
; sw_touch();//检测轻触开关
rcall _sw_touch
.dbline 291
;
; remote_in = PINB & 0x0F;
in R24,0x16
andi R24,15
sts _remote_in,R24
.dbline 292
; switch (remote_in)
mov R20,R24
clr R21
cpi R20,0
cpc R20,R21
breq L111
X9:
cpi R20,1
ldi R30,0
cpc R21,R30
breq L115
cpi R20,2
ldi R30,0
cpc R21,R30
breq L113
cpi R20,4
ldi R30,0
cpc R21,R30
breq L112
cpi R20,8
ldi R30,0
cpc R21,R30
breq L114
rjmp L108
X10:
.dbline 293
; {//检测遥控器是否有键按下
L111:
.dbline 295
; case 0x00:
; forward(); //前行
rcall _forward
.dbline 296
; rst_time=0;
clr R2
sts _rst_time,R2
.dbline 297
; break;
rjmp L109
L112:
.dbline 299
; case 0x04: // < A >
; turn_right(); //右转
rcall _turn_right
.dbline 300
; rst_time=0;
clr R2
sts _rst_time,R2
.dbline 301
; break;
rjmp L109
L113:
.dbline 303
; case 0x02: // < B >
; backward(); //后退
rcall _backward
.dbline 304
; rst_time=0;
clr R2
sts _rst_time,R2
.dbline 305
; break;
rjmp L109
L114:
.dbline 307
; case 0x08: // < C >
; stop(); //停止运动
rcall _stop
.dbline 308
; rst_time++;
lds R24,_rst_time
subi R24,255 ; addi 1
sts _rst_time,R24
.dbline 309
; break;
rjmp L109
L115:
.dbline 311
; case 0x01: // < D >
; turn_left(); //左转
rcall _turn_left
.dbline 312
; rst_time=0;
clr R2
sts _rst_time,R2
.dbline 313
; break;
L108:
L109:
.dbline 315
; }
; delay_ms(200);
ldi R16,200
ldi R17,0
rcall _delay_ms
.dbline 316
; if(rst_time == 50)
lds R24,_rst_time
cpi R24,50
brne L116
.dbline 317
; {//当按住< C > 键的持续时间超过10S,遥控机器人复位,等待声控重起运行
.dbline 318
; rst_time=0;
clr R2
sts _rst_time,R2
.dbline 319
; goto remote_rst;
rjmp L104
L116:
.dbline 321
L106:
.dbline 286
rjmp L105
X11:
.dbline -2
.dbline 322
; }
; }
; }
L103:
rcall pop_gset1
.dbline 0 ; func end
ret
.dbend
.dbfunc e auto_car _auto_car fV
.even
_auto_car::
.dbline -1
.dbline 327
;
; //自走车 机器人走四方形路线,遥控器调节行走路线
;
; void auto_car()
; {
.dbline 328
; port_init();//PA,PB,PC,PD 初始化
rcall _port_init
.dbline 330
;
; work_status = 0x51;//置对应的工作状态标志
ldi R24,81
sts _work_status,R24
.dbline 332
;
; PORTA = 0x44;//0100,0100
ldi R24,68
out 0x1b,R24
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -