📄 minid_20050711.s
字号:
.module MiniD_20050711.c
.area text(rom, con, rel)
.dbfile E:\PMax\单片机源代码\函数库\MiniD\MiniD_20050711.c
.dbfunc e port_init _port_init fV
.even
_port_init::
.dbline -1
.dbline 15
; //ICC-AVR application builder : 2005-7-11 14:38:07
; // Target : M48
; // Crystal: 8.0000Mhz
;
; #include "Minid.h"
;
;
; //函数定义
; void adc_init(void); //ADC initialize
; void adc_isr(void);
; word AdcPedal(word adcp); //踏板信号转换为对应的控制值
;
;
; void port_init(void)
; {
.dbline 16
; PORTB = 0xff;
ldi R24,255
out 0x5,R24
.dbline 17
; DDRB = 0x00;
clr R2
out 0x4,R2
.dbline 18
; PORTC = 0xff; //m103 output only
out 0x8,R24
.dbline 19
; DDRC = 0x00;
out 0x7,R2
.dbline 20
; PORTD = 0xff;
out 0xb,R24
.dbline 21
; DDRD = 0x00;
out 0xa,R2
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e init_devices _init_devices fV
.even
_init_devices::
.dbline -1
.dbline 26
; }
;
; //call this routine to initialize all peripherals
; void init_devices(void)
; {
.dbline 28
; //stop errant interrupts until set up
; CLI(); //disable all interrupts
cli
.dbline 29
; port_init();
rcall _port_init
.dbline 30
; timer1_init();
rcall _timer1_init
.dbline 32
;
; MCUCR = 0x00;
clr R2
out 0x35,R2
.dbline 33
; EICRA = 0x00; //extended ext ints
sts 105,R2
.dbline 34
; EIMSK = 0x00;
out 0x1d,R2
.dbline 36
;
; TIMSK0 = 0x00; //timer 0 interrupt sources
sts 110,R2
.dbline 37
; TIMSK1 = 0x21; //timer 1 interrupt sources
ldi R24,33
sts 111,R24
.dbline 38
; TIMSK2 = 0x00; //timer 2 interrupt sources
sts 112,R2
.dbline 40
;
; PCMSK0 = 0x00; //pin change mask 0
sts 107,R2
.dbline 41
; PCMSK1 = 0x00; //pin change mask 1
sts 108,R2
.dbline 42
; PCMSK2 = 0x00; //pin change mask 2
sts 109,R2
.dbline 43
; PCICR = 0x00; //pin change enable
sts 104,R2
.dbline 44
; PRR = 0x00; //power controller
sts 100,R2
.dbline 45
; SEI(); //re-enable interrupts
sei
.dbline -2
L2:
.dbline 0 ; func end
ret
.dbend
.dbfunc e main _main fV
; d -> R20
; jj -> R22,R23
; j -> R10,R11
; i -> y+0
.even
_main::
sbiw R28,4
.dbline -1
.dbline 51
; //all peripherals are now initialized
; }
;
; //
; void main(void)
; {
.dbline 55
; dword i;
; word j,jj;
; byte d;
; init_devices();
rcall _init_devices
.dbline 58
;
; //insert your functional code here...
; PIDInit (&sPID);
ldi R16,<_sPID
ldi R17,>_sPID
rcall _PIDInit
rjmp L5
L4:
.dbline 60
.dbline 61
lds R4,_g_DeltaEnc+2
lds R5,_g_DeltaEnc+2+1
lds R2,_g_DeltaEnc
lds R3,_g_DeltaEnc+1
movw R30,R28
std z+0,R2
std z+1,R3
std z+2,R4
std z+3,R5
.dbline 62
movw R24,R10
adiw R24,1
movw R10,R24
.dbline 63
movw R16,R24
rcall _AdcPedal
movw R22,R16
.dbline 64
clr R2
clr R3
sts _sPID+4+1,R3
sts _sPID+4,R2
.dbline 65
sts _sPID+2+1,R3
sts _sPID+2,R2
.dbline 66
ldi R24,5000
ldi R25,19
sts _sPID+1,R25
sts _sPID,R24
.dbline 67
movw R30,R28
ldd R18,z+0
ldd R19,z+1
ldi R16,<_sPID
ldi R17,>_sPID
rcall _PIDCalc
mov R20,R16
.dbline 69
L5:
.dbline 59
rjmp L4
X0:
.dbline -2
L3:
adiw R28,4
.dbline 0 ; func end
ret
.dbsym r d 20 c
.dbsym r jj 22 i
.dbsym r j 10 i
.dbsym l i 0 l
.dbend
.area bss(ram, con, rel)
.dbfile E:\PMax\单片机源代码\函数库\MiniD\MiniD_20050711.c
_g_ValueAdc::
.blkb 2
.dbfile E:\PMax\单片机源代码\函数库\MiniD/Minid.h
.dbsym e g_ValueAdc _g_ValueAdc i
_g_AdcNum::
.blkb 1
.dbsym e g_AdcNum _g_AdcNum c
_g_AdcEnd::
.blkb 1
.dbsym e g_AdcEnd _g_AdcEnd c
_g_DeltaEnc::
.blkb 4
.dbsym e g_DeltaEnc _g_DeltaEnc l
_g_CntOld::
.blkb 2
.dbsym e g_CntOld _g_CntOld i
_g_CntUpdate::
.blkb 2
.dbsym e g_CntUpdate _g_CntUpdate i
_g_TotalEnc::
.blkb 1
.dbsym e g_TotalEnc _g_TotalEnc c
_sPID::
.blkb 16
.dbstruct 0 16 PID
.dbfield 0 SetValue I
.dbfield 2 P I
.dbfield 4 I I
.dbfield 6 D I
.dbfield 8 LastError I
.dbfield 10 PrevError I
.dbfield 12 SumError L
.dbend
.dbsym e sPID _sPID S[PID]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -