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

📄 6675.s

📁 基于AVR单片机的热电偶测量系统源码
💻 S
字号:
	.module _6675.c
	.area lit(rom, con, rel)
_arab_1:
	.byte 0,16
	.byte 16,248
	.byte 0,0
	.byte 0,0
	.byte 0,32
	.byte 32,63
	.byte 32,32
	.byte 0,0
	.dbfile D:\zhangyu\H2test\program/lcd.h
	.dbsym s arab_1 _arab_1 A[16:16]kc
_arab_2:
	.byte 0,'p
	.byte 8,8
	.byte 8,136
	.byte 'p,0
	.byte 0,48
	.byte 40,36
	.byte 34,33
	.byte 48,0
	.dbsym s arab_2 _arab_2 A[16:16]kc
_arab_3:
	.byte 0,48
	.byte 8,136
	.byte 136,'H
	.byte 48,0
	.byte 0,24
	.byte 32,32
	.byte 32,17
	.byte 14,0
	.dbsym s arab_3 _arab_3 A[16:16]kc
_arab_4:
	.byte 0,0
	.byte 192,32
	.byte 16,248
	.byte 0,0
	.byte 0,7
	.byte 4,36
	.byte 36,63
	.byte 36,0
	.dbsym s arab_4 _arab_4 A[16:16]kc
_arab_5:
	.byte 0,248
	.byte 8,136
	.byte 136,8
	.byte 8,0
	.byte 0,25
	.byte 33,32
	.byte 32,17
	.byte 14,0
	.dbsym s arab_5 _arab_5 A[16:16]kc
_arab_6:
	.byte 0,224
	.byte 16,136
	.byte 136,24
	.byte 0,0
	.byte 0,15
	.byte 17,32
	.byte 32,17
	.byte 14,0
	.dbsym s arab_6 _arab_6 A[16:16]kc
_arab_7:
	.byte 0,56
	.byte 8,8
	.byte 200,56
	.byte 8,0
	.byte 0,0
	.byte 0,63
	.byte 0,0
	.byte 0,0
	.dbsym s arab_7 _arab_7 A[16:16]kc
_arab_8:
	.byte 0,'p
	.byte 136,8
	.byte 8,136
	.byte 'p,0
	.byte 0,28
	.byte 34,33
	.byte 33,34
	.byte 28,0
	.dbsym s arab_8 _arab_8 A[16:16]kc
_arab_9:
	.byte 0,224
	.byte 16,8
	.byte 8,16
	.byte 224,0
	.byte 0,0
	.byte 49,34
	.byte 34,17
	.byte 15,0
	.dbsym s arab_9 _arab_9 A[16:16]kc
_arab_0:
	.byte 0,224
	.byte 16,8
	.byte 8,16
	.byte 224,0
	.byte 0,15
	.byte 16,32
	.byte 32,16
	.byte 15,0
	.dbsym s arab_0 _arab_0 A[16:16]kc
_T:
	.byte 24,8
	.byte 8,248
	.byte 8,8
	.byte 24,0
	.byte 0,0
	.byte 32,63
	.byte 32,0
	.byte 0,0
	.dbsym s T _T A[16:16]kc
_t:
	.byte 0,128
	.byte 128,224
	.byte 128,128
	.byte 0,0
	.byte 0,0
	.byte 0,31
	.byte 32,32
	.byte 0,0
	.dbsym s t _t A[16:16]kc
_maohao:
	.byte 0,0
	.byte 0,192
	.byte 192,0
	.byte 0,0
	.byte 0,0
	.byte 0,48
	.byte 48,0
	.byte 0,0
	.dbsym s maohao _maohao A[16:16]kc
_xiaoshudian:
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,48
	.byte 48,0
	.byte 0,0
	.byte 0,0
	.dbsym s xiaoshudian _xiaoshudian A[16:16]kc
_E:
	.byte 8,248
	.byte 136,136
	.byte 232,8
	.byte 16,0
	.byte 32,63
	.byte 32,32
	.byte 35,32
	.byte 24,0
	.dbsym s E _E A[16:16]kc
_l:
	.byte 0,8
	.byte 8,248
	.byte 0,0
	.byte 0,0
	.byte 0,32
	.byte 32,63
	.byte 32,32
	.byte 0,0
	.dbsym s l _l A[16:16]kc
_g:
	.byte 0,0
	.byte 128,128
	.byte 128,128
	.byte 128,0
	.byte 0,'k
	.byte 148,148
	.byte 148,147
	.byte 96,0
	.dbsym s g _g A[16:16]kc
_P:
	.byte 8,248
	.byte 8,8
	.byte 8,8
	.byte 240,0
	.byte 32,63
	.byte 33,1
	.byte 1,1
	.byte 0,0
	.dbsym s P _P A[16:16]kc
_H:
	.byte 0,126
	.byte 16,126
	.byte 0,'P
	.byte 'p,64
	.dbsym s H _H A[8:8]kc
_ll:
	.byte 0,0
	.byte 'B,126
	.byte 'B,0
	.byte 0,0
	.dbsym s ll _ll A[8:8]kc
_lll:
	.byte 0,0
	.byte 'B,126
	.byte 'B,126
	.byte 'B,0
	.dbsym s lll _lll A[8:8]kc
_zhenghao:
	.byte 0,0
	.byte 0,240
	.byte 0,0
	.byte 0,0
	.byte 1,1
	.byte 1,31
	.byte 1,1
	.byte 1,0
	.dbsym s zhenghao _zhenghao A[16:16]kc
_fuhao:
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,0
	.byte 0,1
	.byte 1,1
	.byte 1,1
	.byte 1,1
	.dbsym s fuhao _fuhao A[16:16]kc
	.area text(rom, con, rel)
	.dbfile D:\zhangyu\H2test\program/lcd.h
	.dbfile D:\zhangyu\H2test\program\6675.c
	.dbfunc e Delay10ms _Delay10ms fV
;      TimeCount -> R20
;              j -> R22,R23
;          count -> R16
	.even
_Delay10ms::
	xcall push_gset2
	.dbline -1
	.dbline 17
; /************************************************************
;   FileName: 6675.c
;   Description: 温度函数,读取并且显示温度                      
;   Function List:  
; 1. read_max6675()  读取6675的转换结果
; 2. max6675_display()  显示6675的转换结果
; 3. show_temperature()  读取并显示6675的转换结果
; 4. Delay10ms()  延时函数 
; ***********************************************************/
; #include <iom16v.h>
; #include <macros.h>
; #include "6675.h"
; #include "main.h"
; #include "lcd.h"
; 
; void Delay10ms(unsigned char count)
; {
	.dbline 20
;      unsigned char TimeCount;
; 	 unsigned int j;
;      TimeCount = count;
	mov R20,R16
	xjmp L3
L2:
	.dbline 22
; 	 while(TimeCount > 0)
; 	 {
	.dbline 23
; 	     for(j=0;j<200;j++)
	clr R22
	clr R23
	xjmp L8
L5:
	.dbline 24
	.dbline 24
	.dbline 24
	.dbline 24
L6:
	.dbline 23
	subi R22,255  ; offset = 1
	sbci R23,255
L8:
	.dbline 23
	cpi R22,200
	ldi R30,0
	cpc R23,R30
	brlo L5
	.dbline 25
	dec R20
	.dbline 26
L3:
	.dbline 21
	clr R2
	cp R2,R20
	brlo L2
	.dbline -2
L1:
	xcall pop_gset2
	.dbline 0 ; func end
	ret
	.dbsym r TimeCount 20 c
	.dbsym r j 22 i
	.dbsym r count 16 c
	.dbend
	.dbfunc e read_max6675 _read_max6675 fi
;              x -> R20,R21
;              i -> R22
	.even
_read_max6675::
	xcall push_gset2
	.dbline -1
	.dbline 30
; 		 {;;}
; 		 TimeCount--;
; 	 }
; }
; 
; unsigned int read_max6675(void)
; {
	.dbline 32
;      unsigned char i;
;      unsigned int  x=0; 
	clr R20
	clr R21
	.dbline 33
; 	 clr_sck;
	cbi 0x18,1
	.dbline 34
;      wait;
	nop
	 nop
	.dbline 35
;      clr_cs6675;
	cbi 0x18,0
	.dbline 36
;      wait; 
	nop
	 nop
	.dbline 37
;      set_sck; 
	sbi 0x18,1
	.dbline 38
;      wait;
	nop
	 nop
	.dbline 39
; 	 for(i=0;i<16;i++)   //读取转换结果的12位
	clr R22
	xjmp L13
L10:
	.dbline 40
;      {
	.dbline 41
;         wait;
	nop
	 nop
	.dbline 42
; 	    clr_sck;
	cbi 0x18,1
	.dbline 43
;         if(so)
	sbis 0x16,6
	rjmp L14
	.dbline 44
;         x|=(1<<(15-i));
	mov R2,R22
	clr R3
	ldi R18,15
	ldi R19,0
	sub R18,R2
	sbc R19,R3
	ldi R16,1
	ldi R17,0
	xcall lsl16
	or R20,R16
	or R21,R17
L14:
	.dbline 45
	nop
	 nop
	.dbline 46
	sbi 0x18,1
	.dbline 47
L11:
	.dbline 39
	inc R22
L13:
	.dbline 39
	cpi R22,16
	brlo L10
	.dbline 49
;         wait;
; 	    set_sck;
;      }
; 	
; 	 x=(x&0x7fff)>>3; 
	andi R21,127
	lsr R21
	ror R20
	lsr R21
	ror R20
	lsr R21
	ror R20
	.dbline 50
; 	 set_cs6675;  
	sbi 0x18,0
	.dbline 51
;      return x; 
	movw R16,R20
	.dbline -2
L9:
	xcall pop_gset2
	.dbline 0 ; func end
	ret
	.dbsym r x 20 i
	.dbsym r i 22 c
	.dbend
	.area lit(rom, con, rel)
L17:
	.word 0
	.word 0
	.word 0
	.word 0
	.word 0
	.area text(rom, con, rel)
	.dbfile D:\zhangyu\H2test\program\6675.c
	.dbfunc e max6675_display _max6675_display fV
;              m -> R22,R23
;              n -> R20,R21
;           temp -> y+1
;              x -> R10,R11
	.even
_max6675_display::
	xcall push_gset3
	movw R10,R16
	sbiw R28,15
	.dbline -1
	.dbline 55
; }
; 
; void max6675_display(unsigned int x)
; {      
	.dbline 56
;        unsigned int temp[5]={0,0,0,0,0};
	ldi R24,<L17
	ldi R25,>L17
	movw R30,R28
	adiw R30,1
	ldi R16,10
	ldi R17,0
	st -y,R31
	st -y,R30
	st -y,R25
	st -y,R24
	xcall asgncblk
	.dbline 57
;        unsigned int n=0,m=0;
	clr R20
	clr R21
	.dbline 57
	clr R22
	clr R23
	.dbline 58
;        m=10237.5*x/4095;
	ldi R16,<L20
	ldi R17,>L20
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	ldi R16,<L21
	ldi R17,>L21
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	movw R16,R10
	lsr R17
	ror R16
	xcall int2fp
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall empy32fs
	movw R16,R10
	andi R16,1
	andi R17,0
	xcall int2fp
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall add32fs
	xcall empy32fs
	ldi R16,<L22
	ldi R17,>L22
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall div32f
	movw R30,R28
	std z+11,R16
	std z+12,R17
	std z+13,R18
	std z+14,R19
	movw R30,R28
	ldd R2,z+11
	ldd R3,z+12
	ldd R4,z+13
	ldd R5,z+14
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L23
	ldi R17,>L23
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall cmp32f
	brlt L18
	movw R30,R28
	ldd R2,z+11
	ldd R3,z+12
	ldd R4,z+13
	ldd R5,z+14
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	ldi R16,<L23
	ldi R17,>L23
	xcall lpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall sub32f
	xcall fp2int
	movw R24,R16
	subi R24,0  ; offset = 32768
	sbci R25,128
	movw R10,R24
	xjmp L19
L18:
	movw R30,R28
	ldd R16,z+11
	ldd R17,z+12
	ldd R18,z+13
	ldd R19,z+14
	xcall fp2int
	movw R10,R16
L19:
	movw R22,R10
	.dbline 59
;        temp[0]=m/10000;
	ldi R18,10000
	ldi R19,39
	movw R16,R22
	xcall div16u
	std y+2,R17
	std y+1,R16
	.dbline 60
;        n=m-temp[0]*10000;
	movw R18,R16
	ldi R16,10000
	ldi R17,39
	xcall empy16s
	movw R20,R22
	sub R20,R16
	sbc R21,R17
	.dbline 61
;        temp[1]=n/1000;
	ldi R18,1000
	ldi R19,3
	movw R16,R20
	xcall div16u
	std y+4,R17
	std y+3,R16
	.dbline 62
;        n=n-temp[1]*1000;
	movw R18,R16
	ldi R16,1000
	ldi R17,3
	xcall empy16s
	sub R20,R16
	sbc R21,R17
	.dbline 63
;        temp[2]=n/100;
	ldi R18,100
	ldi R19,0
	movw R16,R20
	xcall div16u
	std y+6,R17
	std y+5,R16
	.dbline 64
;        n=n-temp[2]*100;
	movw R18,R16
	ldi R16,100
	ldi R17,0
	xcall empy16s
	sub R20,R16
	sbc R21,R17
	.dbline 65
;        temp[3]=n/10;
	ldi R18,10
	ldi R19,0
	movw R16,R20
	xcall div16u
	std y+8,R17
	std y+7,R16
	.dbline 66
;        n=n-temp[3]*10;
	movw R18,R16
	ldi R16,10
	ldi R17,0
	xcall empy16s
	sub R20,R16
	sbc R21,R17
	.dbline 67
;        temp[4]=n/1;
	std y+10,R21
	std y+9,R20
	.dbline 68
;        Draw_NtoArab(0x02,0x10,temp[0]);
	ldd R2,y+1
	ldd R3,y+2
	std y+0,R2
	ldi R18,16
	ldi R16,2
	xcall _Draw_NtoArab
	.dbline 69
;        Draw_NtoArab(0x02,0x18,temp[1]);
	ldd R2,y+3
	ldd R3,y+4
	std y+0,R2
	ldi R18,24
	ldi R16,2
	xcall _Draw_NtoArab
	.dbline 70
;        Draw_NtoArab(0x02,0x20,temp[2]);
	ldd R2,y+5
	ldd R3,y+6
	std y+0,R2
	ldi R18,32
	ldi R16,2
	xcall _Draw_NtoArab
	.dbline 71
;        Draw_NtoArab(0x02,0x28,temp[3]);
	ldd R2,y+7
	ldd R3,y+8
	std y+0,R2
	ldi R18,40
	ldi R16,2
	xcall _Draw_NtoArab
	.dbline 72
;        Draw_NtoArab(0x02,0x38,temp[4]);
	ldd R2,y+9
	ldd R3,y+10
	std y+0,R2
	ldi R18,56
	ldi R16,2
	xcall _Draw_NtoArab
	.dbline -2
L16:
	adiw R28,15
	xcall pop_gset3
	.dbline 0 ; func end
	ret
	.dbsym r m 22 i
	.dbsym r n 20 i
	.dbsym l temp 1 A[10:5]i
	.dbsym r x 10 i
	.dbend
	.dbfunc e show_temperature _show_temperature fV
;              t -> R20,R21
	.even
_show_temperature::
	xcall push_gset1
	.dbline -1
	.dbline 76
; }
; 
; void show_temperature(void)
; {     unsigned int t;
	.dbline 77
;       Delay10ms(100);
	ldi R16,100
	xcall _Delay10ms
	.dbline 78
;  	  t=read_max6675();
	xcall _read_max6675
	movw R20,R16
	.dbline 79
;       max6675_display(t);
	xcall _max6675_display
	.dbline 80
; 	  Delay10ms(100);
	ldi R16,100
	xcall _Delay10ms
	.dbline -2
L35:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r t 20 i
	.dbend
	.area lit(rom, con, rel)
L23:
	.word 0x0,0x4700
L22:
	.word 0xf000,0x457f
L21:
	.word 0x0,0x4000
L20:
	.word 0xf600,0x461f

⌨️ 快捷键说明

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