?? 9313_finish.s
字號(hào):
.module _9313_finish.c
.area text(rom, con, rel)
.dbfile 9313_finish.c
.dbfunc e DELAY_1US _DELAY_1US fV
.even
_DELAY_1US::
.dbline -1
.dbline 28
; //*********************************************************
; //測試功能:測試9313放大n+1倍 現(xiàn)在放大2倍
; //測試方法:
; //測試結(jié)果:?
; //時(shí)鐘頻率:8m
; //管腳分配:Pa0為使能位,Pa1為時(shí)序發(fā)生位,Pa2為+或-位
; //
; //注意事項(xiàng):
; //完成時(shí)間:2009.03.18
; //************************************************
;
; //*************************************************
; //頭文件
; //************************************************
; #include <iom16v.h>
; #include <macros.h>
; //************************************************
;
;
; //**********************************************************
; //函數(shù)名稱:void DELAY_1US(void)
; //參數(shù)入口:無
; //參數(shù)出口:無
; //函數(shù)功能:延時(shí)1us
; //注意事項(xiàng):
; //**********************************************************
; void DELAY_1US(void)
; {
.dbline 29
; NOP();
nop
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e DELAY_NUS _DELAY_NUS fV
; n -> R20,R21
.even
_DELAY_NUS::
xcall push_gset1
movw R20,R16
.dbline -1
.dbline 39
; }
; //**********************************************************
; //函數(shù)名稱:void DELAY_NUS(void)
; //參數(shù)入口:無
; //參數(shù)出口:無
; //函數(shù)功能:延時(shí)nus
; //注意事項(xiàng):
; //**********************************************************
; void DELAY_NUS(unsigned int n)
; {
.dbline 40
; for(;n>0;n--)
xjmp L6
L3:
.dbline 41
xcall _DELAY_1US
L4:
.dbline 40
subi R20,1
sbci R21,0
L6:
.dbline 40
cpi R20,0
cpc R20,R21
brne L3
X0:
.dbline -2
L2:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r n 20 i
.dbend
.dbfunc e DELAY_1MS _DELAY_1MS fV
; i -> R16,R17
.even
_DELAY_1MS::
.dbline -1
.dbline 51
; DELAY_1US();
; }
; //**********************************************************
; //函數(shù)名稱:void DELAY_1MS(void)
; //參數(shù)入口:無
; //參數(shù)出口:無
; //函數(shù)功能:延時(shí)1ms
; //注意事項(xiàng):i=143*n-2
; //**********************************************************
; void DELAY_1MS(void)
; {
.dbline 53
; unsigned int i;
; for(i=1142;i>0;i--)
ldi R16,1142
ldi R17,4
xjmp L11
L8:
.dbline 54
L9:
.dbline 53
subi R16,1
sbci R17,0
L11:
.dbline 53
cpi R16,0
cpc R16,R17
brne L8
X1:
.dbline -2
L7:
.dbline 0 ; func end
ret
.dbsym r i 16 i
.dbend
.dbfunc e DELAY_NMS _DELAY_NMS fV
; n -> R20,R21
.even
_DELAY_NMS::
xcall push_gset1
movw R20,R16
.dbline -1
.dbline 64
; ;
; }
; //**********************************************************
; //函數(shù)名稱:void DELAY_1MS(void)
; //參數(shù)入口:無
; //參數(shù)出口:無
; //函數(shù)功能:延時(shí)1ms
; //注意事項(xiàng):i=143*n-2
; //**********************************************************
; void DELAY_NMS(unsigned int n)
; {
.dbline 65
; for(;n>0;n--)
xjmp L16
L13:
.dbline 66
xcall _DELAY_1MS
L14:
.dbline 65
subi R20,1
sbci R21,0
L16:
.dbline 65
cpi R20,0
cpc R20,R21
brne L13
X2:
.dbline -2
L12:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r n 20 i
.dbend
.dbfunc e PORT_INIT _PORT_INIT fV
.even
_PORT_INIT::
.dbline -1
.dbline 76
; DELAY_1MS();
; }
; //**********************************************************
; //函數(shù)名稱:void INIT_X9313(void)
; //參數(shù)入口:無
; //參數(shù)出口:無
; //函數(shù)功能:是放大倍數(shù)為1
; //注意事項(xiàng):PD0為使能位,PD1為時(shí)序發(fā)生位,PD2為+或-位
; //***************************************************
; void PORT_INIT(void)
; {
.dbline 77
; DDRC|=0X07;
in R24,0x14
ori R24,7
out 0x14,R24
.dbline 78
; PORTC|=0X07;
in R24,0x15
ori R24,7
out 0x15,R24
.dbline -2
L17:
.dbline 0 ; func end
ret
.dbend
.dbfunc e INIT_X9313 _INIT_X9313 fV
; n -> R20
.even
_INIT_X9313::
xcall push_gset1
.dbline -1
.dbline 88
; }
; //**********************************************************
; //函數(shù)名稱:void INIT_X9313(void)
; //參數(shù)入口:無
; //參數(shù)出口:無
; //函數(shù)功能:是放大倍數(shù)為1
; //注意事項(xiàng):PD0為使能位,PD1為時(shí)序發(fā)生位,PD2為+或-位
; //**********************************************************
; void INIT_X9313(void)
; {
.dbline 91
; unsigned char n;
;
; PORTC|=0X07;
in R24,0x15
ori R24,7
out 0x15,R24
.dbline 94
;
; //PORTD=(1<<2);//方法倍數(shù)減操作
; DELAY_NUS(1);
ldi R16,1
ldi R17,0
xcall _DELAY_NUS
.dbline 96
;
; PORTC&=~(1<<0);//使能操作
cbi 0x15,0
.dbline 97
; DELAY_NUS(1);
ldi R16,1
ldi R17,0
xcall _DELAY_NUS
.dbline 99
;
; for(n=35;n>0;n--)
ldi R20,35
xjmp L22
L19:
.dbline 100
.dbline 101
sbi 0x15,1
.dbline 102
ldi R16,2
ldi R17,0
xcall _DELAY_NUS
.dbline 103
cbi 0x15,1
.dbline 104
ldi R16,2
ldi R17,0
xcall _DELAY_NUS
.dbline 105
sbi 0x15,1
.dbline 106
ldi R16,2
ldi R17,0
xcall _DELAY_NUS
.dbline 107
L20:
.dbline 99
dec R20
L22:
.dbline 99
clr R2
cp R2,R20
brlo L19
.dbline 108
; {
; PORTC|=(1<<1);//+
; DELAY_NUS(2);
; PORTC&=~(1<<1);
; DELAY_NUS(2);
; PORTC|=(1<<1);//+
; DELAY_NUS(2);
; }
; PORTC|=(1<<0);//使能操作
sbi 0x15,0
.dbline 109
; DELAY_NMS(20);
ldi R16,20
ldi R17,0
xcall _DELAY_NMS
.dbline -2
L18:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r n 20 c
.dbend
.dbfunc e X9313_ADD _X9313_ADD fV
; n -> R20
.even
_X9313_ADD::
xcall push_gset1
mov R20,R16
.dbline -1
.dbline 120
;
; }
; //**********************************************************
; //函數(shù)名稱:void X9313_ADD(unsigned char n)
; //參數(shù)入口:無
; //參數(shù)出口:無
; //函數(shù)功能:放大n倍
; //注意事項(xiàng):PD0為使能位,PD1為時(shí)序發(fā)生位,PD2為-時(shí)放大
; //**********************************************************
; void X9313_ADD(unsigned char n)
; {
.dbline 121
; PORTC|=0X07;
in R24,0x15
ori R24,7
out 0x15,R24
.dbline 123
;
; PORTC&=~(1<<2);//方法倍數(shù)減操作
cbi 0x15,2
.dbline 124
; DELAY_NUS(1);
ldi R16,1
ldi R17,0
xcall _DELAY_NUS
.dbline 126
;
; PORTC&=~(1<<0);//使能操作
cbi 0x15,0
.dbline 127
; DELAY_NUS(1);
ldi R16,1
ldi R17,0
xcall _DELAY_NUS
.dbline 129
;
; for(;n>0;n--)
xjmp L27
L24:
.dbline 130
.dbline 131
sbi 0x15,1
.dbline 132
ldi R16,2
ldi R17,0
xcall _DELAY_NUS
.dbline 133
cbi 0x15,1
.dbline 134
ldi R16,2
ldi R17,0
xcall _DELAY_NUS
.dbline 135
sbi 0x15,1
.dbline 136
ldi R16,2
ldi R17,0
xcall _DELAY_NUS
.dbline 137
L25:
.dbline 129
dec R20
L27:
.dbline 129
clr R2
cp R2,R20
brlo L24
.dbline 138
; {
; PORTC|=(1<<1);//+
; DELAY_NUS(2);
; PORTC&=~(1<<1);
; DELAY_NUS(2);
; PORTC|=(1<<1);//+
; DELAY_NUS(2);
; }
; PORTC|=(1<<0);//使能操作
sbi 0x15,0
.dbline 139
; PORTC|=(1<<2);//方法倍數(shù)減操作
sbi 0x15,2
.dbline -2
L23:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r n 20 c
.dbend
.dbfunc e main _main fV
.even
_main::
.dbline -1
.dbline 146
; //DELAY_NMS(20);
; }
; //*************************************************
; //主函數(shù)
; //*************************************************
; void main(void)
; {
.dbline 147
; PORT_INIT();
xcall _PORT_INIT
.dbline 148
; INIT_X9313();
xcall _INIT_X9313
.dbline 149
; X9313_ADD(1);
ldi R16,1
xcall _X9313_ADD
L29:
.dbline 151
L30:
.dbline 150
xjmp L29
X3:
.dbline -2
L28:
.dbline 0 ; func end
ret
.dbend
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -