⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 init.s

📁 增量式模糊PID控制方法AVR单片机mega16
💻 S
字号:
	.module init.c
	.area data(ram, con, rel)
_test::
	.blkw 1
	.area idata
	.word L1
	.area data(ram, con, rel)
	.dbfile D:\仿真\增量式模糊控制\init.c
	.dbsym e test _test pc
_value::
	.blkw 1
	.area idata
	.word L2
	.area data(ram, con, rel)
	.dbfile D:\仿真\增量式模糊控制\init.c
	.dbsym e value _value pc
	.area text(rom, con, rel)
	.dbfile D:\仿真\增量式模糊控制\init.c
	.dbfunc e WDR _WDR fV
	.even
_WDR::
	.dbline -1
	.dbline 13
; #define INIT_C
; #include "includes.h"
; //#define Vref 25600
; 
; 
; int count;
; float j;  
;    
; unsigned char *test = "The Voltage is: ";
; unsigned char *value = "0.000 V";	
; 
; void WDR(void)
; {
	.dbline 14
;      asm("wdr");
	wdr
	.dbline -2
L3:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e WDT_init _WDT_init fV
	.even
_WDT_init::
	.dbline -1
	.dbline 18
; }
; 
; void WDT_init(void)
; {
	.dbline 19
;    WDR();
	xcall _WDR
	.dbline 20
;    WDTCR = 0x0f;
	ldi R24,15
	out 0x21,R24
	.dbline -2
L4:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e init_time1 _init_time1 fV
	.even
_init_time1::
	.dbline -1
	.dbline 23
; }
; void init_time1(void)
; {
	.dbline 24
;     TIMSK = 0X02;  //T1溢出中断
	ldi R24,2
	out 0x39,R24
	.dbline 25
;     TCCR1B = 0X00; //停止T1
	clr R2
	out 0x2e,R2
	.dbline 26
;     TCNT1H = 0XF9; //
	ldi R24,249
	out 0x2d,R24
	.dbline 27
;     TCNT1L = 0XE6;
	ldi R24,230
	out 0x2c,R24
	.dbline 28
;     TCCR1A = 0X00;
	out 0x2f,R2
	.dbline 29
;     TCCR1B = 0X01; 
	ldi R24,1
	out 0x2e,R24
	.dbline 30
;     asm("sei");
	sei
	.dbline -2
L5:
	.dbline 0 ; func end
	ret
	.dbend
	.area vector(rom, abs)
	.org 32
	jmp _timer1_ovf_isr
	.area text(rom, con, rel)
	.dbfile D:\仿真\增量式模糊控制\init.c
	.dbfunc e timer1_ovf_isr _timer1_ovf_isr fV
	.even
_timer1_ovf_isr::
	xcall push_lset
	sbiw R28,2
	.dbline -1
	.dbline 37
; }
; 
; 
; 
; #pragma interrupt_handler timer1_ovf_isr:9
; void timer1_ovf_isr(void)
; {
	.dbline 38
;     TCNT1H = 0XF9; //
	ldi R24,249
	out 0x2d,R24
	.dbline 39
;     TCNT1L = 0XE6;
	ldi R24,230
	out 0x2c,R24
	.dbline 40
;     j = (float)(((float)((Vref /1023)))*( ADC&0X3FF))/1000.00;
	in R24,0x4
	in R25,0x5
	andi R24,1
	andi R25,0
	movw R2,R24
	ldi R16,<L7
	ldi R17,>L7
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	ldi R16,<L8
	ldi R17,>L8
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	movw R16,R2
	lsr R17
	ror R16
	xcall int2fp
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall empy32fs
	movw R16,R2
	xcall int2fp
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall add32fs
	xcall empy32fs
	ldi R16,<L9
	ldi R17,>L9
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall div32f
	sts _j+1,R17
	sts _j,R16
	sts _j+2+1,R19
	sts _j+2,R18
	.dbline 41
;     count = j*100;					
	ldi R16,<L10
	ldi R17,>L10
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	lds R4,_j+2
	lds R5,_j+2+1
	lds R2,_j
	lds R3,_j+1
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall empy32f
	xcall fp2int
	sts _count+1,R17
	sts _count,R16
	.dbline 42
;     value[0] = count /1000+0x30;
	ldi R18,1000
	ldi R19,3
	xcall div16s
	movw R24,R16
	adiw R24,48
	lds R30,_value
	lds R31,_value+1
	std z+0,R24
	.dbline 43
;     count = count %1000;
	ldi R18,1000
	ldi R19,3
	lds R16,_count
	lds R17,_count+1
	xcall mod16s
	sts _count+1,R17
	sts _count,R16
	.dbline 44
;     value[2] = count /100+0x30;
	ldi R18,100
	ldi R19,0
	xcall div16s
	movw R24,R16
	adiw R24,48
	lds R30,_value
	lds R31,_value+1
	std z+2,R24
	.dbline 45
;     count = count %100;
	ldi R18,100
	ldi R19,0
	lds R16,_count
	lds R17,_count+1
	xcall mod16s
	sts _count+1,R17
	sts _count,R16
	.dbline 46
;     value[3] = count  /10 + 0x30;			 
	ldi R18,10
	ldi R19,0
	xcall div16s
	movw R24,R16
	adiw R24,48
	lds R30,_value
	lds R31,_value+1
	std z+3,R24
	.dbline 47
;     value[4] = count  %10 + 0x30;			 
	ldi R18,10
	ldi R19,0
	lds R16,_count
	lds R17,_count+1
	xcall mod16s
	movw R24,R16
	adiw R24,48
	lds R30,_value
	lds R31,_value+1
	std z+4,R24
	.dbline 49
;       
;     LCD_Cursor(0,1);
	ldi R18,1
	clr R16
	xcall _LCD_Cursor
	.dbline 50
;     LCD_DisplayString(2,2,value); 
	lds R2,_value
	lds R3,_value+1
	std y+1,R3
	std y+0,R2
	ldi R18,2
	ldi R16,2
	xcall _LCD_DisplayString
	.dbline -2
L6:
	adiw R28,2
	xcall pop_lset
	.dbline 0 ; func end
	reti
	.dbend
	.area bss(ram, con, rel)
	.dbfile D:\仿真\增量式模糊控制\init.c
_j::
	.blkb 4
	.dbsym e j _j D
_count::
	.blkb 2
	.dbsym e count _count I
	.area lit(rom, con, rel)
L10:
	.word 0x0,0x42c8
L9:
	.word 0x0,0x447a
L8:
	.word 0x0,0x4000
L7:
	.word 0x0,0x41c8
	.area data(ram, con, rel)
	.dbfile D:\仿真\增量式模糊控制\init.c
L2:
	.blkb 8
	.area idata
	.byte 48,46,48,48,48,32,'V,0
	.area data(ram, con, rel)
	.dbfile D:\仿真\增量式模糊控制\init.c
L1:
	.blkb 17
	.area idata
	.byte 'T,'h,'e,32,'V,'o,'l,'t,'a,'g,'e,32,'i,'s,58,32
	.byte 0
	.area data(ram, con, rel)
	.dbfile D:\仿真\增量式模糊控制\init.c

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -