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

📄 init.s

📁 AD/DA转换,通过外挂LCD显示转换数据数据值
💻 S
字号:
	.module init.c
	.area text(rom, con, rel)
	.dbfile E:\新建文件夹\ADDA_ICC\cfile\init.c
	.area data(ram, con, rel)
	.dbfile E:\新建文件夹\ADDA_ICC\cfile\init.c
_test::
	.blkw 1
	.area idata
	.word L1
	.area data(ram, con, rel)
	.dbfile E:\新建文件夹\ADDA_ICC\cfile\init.c
	.dbsym e test _test pc
_value::
	.blkw 1
	.area idata
	.word L2
	.area data(ram, con, rel)
	.dbfile E:\新建文件夹\ADDA_ICC\cfile\init.c
	.dbsym e value _value pc
	.area text(rom, con, rel)
	.dbfile E:\新建文件夹\ADDA_ICC\cfile\init.c
	.dbfunc e WDR _WDR fV
	.even
_WDR::
	.dbline -1
	.dbline 10
; #define INIT_C
; #include "includes.h"
; int count;
; float j;  
;    
; unsigned char *test = "The Voltage is: ";
; unsigned char *value = "0.000 V";	
; 
; void WDR(void)
; {
	.dbline 11
;      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 15
; }
; 
; void WDT_init(void)
; {
	.dbline 16
;    WDR();
	xcall _WDR
	.dbline 17
;    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 20
; }
; void init_time1(void)
; {
	.dbline 21
;     TIMSK = 0X02;  //T1溢出中断
	ldi R24,2
	out 0x39,R24
	.dbline 22
;     TCCR1B = 0X00; //停止T1
	clr R2
	out 0x2e,R2
	.dbline 23
;     TCNT1H = 0XF9; //
	ldi R24,249
	out 0x2d,R24
	.dbline 24
;     TCNT1L = 0XE6;
	ldi R24,230
	out 0x2c,R24
	.dbline 25
;     TCCR1A = 0X00;
	out 0x2f,R2
	.dbline 26
;     TCCR1B = 0X01; 
	ldi R24,1
	out 0x2e,R24
	.dbline 27
;     asm("sei");
	sei
	.dbline -2
L5:
	.dbline 0 ; func end
	ret
	.dbend
	.area vector(rom, abs)
	.org 20
	jmp _timer1_capt_isr
	.area text(rom, con, rel)
	.dbfile E:\新建文件夹\ADDA_ICC\cfile\init.c
	.dbfunc e timer1_capt_isr _timer1_capt_isr fV
	.even
_timer1_capt_isr::
	st -y,R0
	st -y,R1
	st -y,R2
	st -y,R3
	st -y,R4
	st -y,R5
	st -y,R6
	st -y,R7
	st -y,R8
	st -y,R9
	st -y,R16
	st -y,R17
	st -y,R18
	st -y,R19
	st -y,R24
	st -y,R25
	st -y,R26
	st -y,R27
	st -y,R30
	st -y,R31
	in R0,0x3f
	st -y,R0
	sbiw R28,2
	.dbline -1
	.dbline 34
; }
; 
; 
; 
; #pragma interrupt_handler timer1_capt_isr:iv_TIM1_CAPT
; void timer1_capt_isr(void)
; {
	.dbline 35
;     TCNT1H = 0XF9; //
	ldi R24,249
	out 0x2d,R24
	.dbline 36
;     TCNT1L = 0XE6;
	ldi R24,230
	out 0x2c,R24
	.dbline 37
;     j = (float)(((float)((Vref/1023)))*( ADC&0X3FF))/1000.00;
	ldi R16,<L7
	ldi R17,>L7
	xcall lpm32
	movw R2,R16
	movw R4,R18
	in R16,0x4
	in R17,0x5
	andi R17,3
	xcall uint2fp
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	movw R16,R2
	movw R18,R4
	xcall fpmule2
	movw R2,R16
	movw R4,R18
	ldi R16,<L8
	ldi R17,>L8
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	movw R16,R2
	movw R18,R4
	xcall fpdiv2
	sts _j+1,R17
	sts _j,R16
	sts _j+2+1,R19
	sts _j+2,R18
	.dbline 38
;     count = j*100;					
	ldi R16,<L9
	ldi R17,>L9
	xcall lpm32
	ldi R24,<_j
	ldi R25,>_j
	st -y,R25
	st -y,R24
	xcall fpmule1
	xcall fpint
	sts _count+1,R17
	sts _count,R16
	.dbline 39
;     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 40
;     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 41
;     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 42
;     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 43
;     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 44
;     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 46
;       
;     LCD_Cursor(0,1);
	ldi R18,1
	clr R16
	xcall _LCD_Cursor
	.dbline 47
;     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:
	.dbline 0 ; func end
	adiw R28,2
	ld R0,y+
	out 0x3f,R0
	ld R31,y+
	ld R30,y+
	ld R27,y+
	ld R26,y+
	ld R25,y+
	ld R24,y+
	ld R19,y+
	ld R18,y+
	ld R17,y+
	ld R16,y+
	ld R9,y+
	ld R8,y+
	ld R7,y+
	ld R6,y+
	ld R5,y+
	ld R4,y+
	ld R3,y+
	ld R2,y+
	ld R1,y+
	ld R0,y+
	reti
	.dbend
	.area bss(ram, con, rel)
	.dbfile E:\新建文件夹\ADDA_ICC\cfile\init.c
_j::
	.blkb 4
	.dbsym e j _j D
_count::
	.blkb 2
	.dbsym e count _count I
	.area lit(rom, con, rel)
L9:
	.word 0x0,0x42c8
L8:
	.word 0x0,0x447a
L7:
	.word 0x0,0x41c8
	.area data(ram, con, rel)
	.dbfile E:\新建文件夹\ADDA_ICC\cfile\init.c
L2:
	.blkb 8
	.area idata
	.byte 48,46,48,48,48,32,'V,0
	.area data(ram, con, rel)
	.dbfile E:\新建文件夹\ADDA_ICC\cfile\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 E:\新建文件夹\ADDA_ICC\cfile\init.c
; }

⌨️ 快捷键说明

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