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

📄 display.s

📁 已经上传的YF-320240-3.5寸彩屏(可由单片机控制)的测试程序。主CPU为MEGA128
💻 S
📖 第 1 页 / 共 5 页
字号:
	.module display.c
	.area text(rom, con, rel)
	.dbfile F:\Relations\sf6_system\measure\LCDtest\display.c
	.dbfunc e Dis_Int _Dis_Int fV
;           flag -> y+6
;             tt -> R20
;           back -> R14
;          front -> y+25
;          point -> y+23
;           temp -> y+21
;              y -> y+19
;              x -> y+17
	.even
_Dis_Int::
	xcall push_arg4
	xcall push_gset5
	sbiw R28,7
	ldd R14,y+27
	.dbline -1
	.dbline 56
; #include <iom128v.h>
; #include <macros.h>
; #include <math.h>
; #include "lcd.h"
; #include "touch.h"
; #include "display.h"
; #include "stdio.h"
; /*
;      功能:轮换一个有符号的整数
; 	 输入,目标数组,需要显示的数,小数点位数,
; 	 输出:无
; 	 编者:赫树开
; 	 日期:二○○六年二月二十四日
; */
; /*void Convert_SignedInt(unsigned char *str,int temp, unsigned char point)
; {
;     unsigned char tt[8];
;     unsigned char i;
; 	sprintf(tt,"%6d",temp);//右-左,遇见" "证明字符串结束
; 	for(i = 0;i< point;i++)
; 	{
; 	    tt[6-i] = tt[5-i];
; 		if(tt[6-i] == ' ')
; 		{
; 		    tt[6-i] = '0';
; 		}
; 	}
; 	if(point)
; 	{
; 	   tt[6-point] = '.';
; 	   if(tt[6-point-1] == ' ')//如果前面为空格,证明没有只有小数,而没有整数
; 	   {
; 	       tt[5-point] = '0';
; 	   }
; 	}  
; 	if(tt[6-point-1] == ' ')//如果不是小数,又全部为空格,所以该数只能是0
; 	{
; 	    tt[5-point] = '0';
; 	} 
; 	else if(tt[5 - point] =='-')
; 	{
; 	    tt[4-point] = '-';
; 		tt[5-point] = '0';
; 	}
; 	tt[7] = 0;
; 	StringCat(str,tt,6);
; }*/
; /*
;      功能:显示一个无符号的整数
; 	 输入,显示坐标,需要显示的数,小数点位数,字和背景色
; 	 输出:无
; 	 编者:赫树开
; 	 日期:二○○六年二月二十四日
; */
; void Dis_Int(unsigned int x,unsigned char y,unsigned int temp, unsigned char point,unsigned char front,unsigned char back)
; {
	.dbline 58
;     unsigned char tt;
;     unsigned char flag=0;
	clr R0
	std y+6,R0
	.dbline 60
; 	
;     if(point>4) point=4;
	ldi R24,4
	ldd R0,y+23
	cp R24,R0
	brsh L2
	.dbline 60
	std y+23,R24
L2:
	.dbline 61
;     tt=temp/10000;
	ldi R18,10000
	ldi R19,39
	ldd R16,y+21
	ldd R17,y+22
	xcall div16u
	mov R20,R16
	.dbline 62
;     temp%=10000;
	ldi R18,10000
	ldi R19,39
	ldd R16,y+21
	ldd R17,y+22
	xcall mod16u
	std y+22,R17
	std y+21,R16
	.dbline 63
;     if((tt==0)&(flag==0)&(point!=4))
	tst R20
	brne L6
	ldi R24,1
	ldi R25,0
	movw R12,R24
	xjmp L7
L6:
	clr R12
	clr R13
L7:
	ldd R0,y+6
	tst R0
	brne L8
	ldi R24,1
	ldi R25,0
	movw R10,R24
	xjmp L9
L8:
	clr R10
	clr R11
L9:
	ldd R24,y+23
	cpi R24,4
	breq L10
	ldi R22,1
	ldi R23,0
	xjmp L11
L10:
	clr R22
	clr R23
L11:
	movw R2,R12
	and R2,R10
	and R3,R11
	and R2,R22
	and R3,R23
	tst R2
	brne X0
	tst R3
	breq L4
X0:
	.dbline 64
;     {
	.dbline 65
;        tt=' ';
	ldi R20,32
	.dbline 66
;     }
	xjmp L5
L4:
	.dbline 68
;     else
;     {
	.dbline 69
;        flag=1;
	clr R0
	inc R0
	std y+6,R0
	.dbline 70
;        tt+=0x30;
	subi R20,208    ; addi 48
	.dbline 71
;     }
L5:
	.dbline 72
;     Dis_Ascii(x,y,tt,front,back);
	mov R2,R14
	clr R3
	std y+5,R3
	std y+4,R2
	ldd R0,y+25
	std y+2,R0
	std y+0,R20
	ldd R18,y+19
	ldd R16,y+17
	ldd R17,y+18
	xcall _Dis_Ascii
	.dbline 73
;     if(point==4)
	ldd R24,y+23
	cpi R24,4
	brne L12
	.dbline 74
;     {
	.dbline 75
;        x+=8;
	ldd R24,y+17
	ldd R25,y+18
	adiw R24,8
	std y+18,R25
	std y+17,R24
	.dbline 76
;        Dis_Ascii(x,y,'.',front,back);
	mov R2,R14
	clr R3
	std y+5,R3
	std y+4,R2
	ldd R0,y+25
	std y+2,R0
	ldi R24,46
	std y+0,R24
	ldd R18,y+19
	ldd R16,y+17
	ldd R17,y+18
	xcall _Dis_Ascii
	.dbline 77
;     }
L12:
	.dbline 78
;     tt=temp/1000;
	ldi R18,1000
	ldi R19,3
	ldd R16,y+21
	ldd R17,y+22
	xcall div16u
	mov R20,R16
	.dbline 79
;     temp%=1000;
	ldi R18,1000
	ldi R19,3
	ldd R16,y+21
	ldd R17,y+22
	xcall mod16u
	std y+22,R17
	std y+21,R16
	.dbline 80
;     if((tt==0)&(flag==0)&(point!=3))
	tst R20
	brne L16
	ldi R24,1
	ldi R25,0
	movw R12,R24
	xjmp L17
L16:
	clr R12
	clr R13
L17:
	ldd R0,y+6
	tst R0
	brne L18
	ldi R24,1
	ldi R25,0
	movw R10,R24
	xjmp L19
L18:
	clr R10
	clr R11
L19:
	ldd R24,y+23
	cpi R24,3
	breq L20
	ldi R22,1
	ldi R23,0
	xjmp L21
L20:
	clr R22
	clr R23
L21:
	movw R2,R12
	and R2,R10
	and R3,R11
	and R2,R22
	and R3,R23
	tst R2
	brne X1
	tst R3
	breq L14
X1:
	.dbline 81
;     {
	.dbline 82
;         tt=' ';
	ldi R20,32
	.dbline 83
;     }
	xjmp L15
L14:
	.dbline 85
;     else
;     {
	.dbline 86
;        flag=1;
	clr R0
	inc R0
	std y+6,R0
	.dbline 87
;        tt+=0x30;
	subi R20,208    ; addi 48
	.dbline 88
;     }
L15:
	.dbline 89
;     x+=8;
	ldd R24,y+17
	ldd R25,y+18
	adiw R24,8
	std y+18,R25
	std y+17,R24
	.dbline 90
;     Dis_Ascii(x,y,tt,front,back);
	mov R2,R14
	clr R3
	std y+5,R3
	std y+4,R2
	ldd R0,y+25
	std y+2,R0
	std y+0,R20
	ldd R18,y+19
	movw R16,R24
	xcall _Dis_Ascii
	.dbline 91
;     if(point==3)
	ldd R24,y+23
	cpi R24,3
	brne L22
	.dbline 92
;     {
	.dbline 93
;        x+=8;
	ldd R24,y+17
	ldd R25,y+18
	adiw R24,8
	std y+18,R25
	std y+17,R24
	.dbline 94
;        Dis_Ascii(x,y,'.',front,back);
	mov R2,R14
	clr R3
	std y+5,R3
	std y+4,R2
	ldd R0,y+25
	std y+2,R0
	ldi R24,46
	std y+0,R24
	ldd R18,y+19
	ldd R16,y+17
	ldd R17,y+18
	xcall _Dis_Ascii
	.dbline 95
;     }
L22:
	.dbline 96
;     tt = temp/100;
	ldi R18,100
	ldi R19,0
	ldd R16,y+21
	ldd R17,y+22
	xcall div16u
	mov R20,R16
	.dbline 97
;     temp %= 100;
	ldi R18,100
	ldi R19,0
	ldd R16,y+21
	ldd R17,y+22
	xcall mod16u
	std y+22,R17
	std y+21,R16
	.dbline 98
;     if((tt==0)&(flag==0)&(point!=2))
	tst R20
	brne L26
	ldi R24,1
	ldi R25,0
	movw R12,R24
	xjmp L27
L26:
	clr R12
	clr R13
L27:
	ldd R0,y+6
	tst R0
	brne L28
	ldi R24,1
	ldi R25,0
	movw R10,R24
	xjmp L29
L28:
	clr R10
	clr R11
L29:
	ldd R24,y+23
	cpi R24,2
	breq L30
	ldi R22,1
	ldi R23,0
	xjmp L31
L30:
	clr R22
	clr R23
L31:
	movw R2,R12
	and R2,R10
	and R3,R11
	and R2,R22
	and R3,R23
	tst R2
	brne X2
	tst R3
	breq L24
X2:
	.dbline 99
;     {
	.dbline 100
;         tt=' ';
	ldi R20,32
	.dbline 101
;     }
	xjmp L25
L24:
	.dbline 103
;     else
;     {
	.dbline 104
;         flag=1;
	clr R0
	inc R0
	std y+6,R0
	.dbline 105
;         tt+=0x30;
	subi R20,208    ; addi 48
	.dbline 106
;     }
L25:
	.dbline 107
;     x+=8;
	ldd R24,y+17
	ldd R25,y+18
	adiw R24,8
	std y+18,R25
	std y+17,R24
	.dbline 108
;     Dis_Ascii(x,y,tt,front,back);
	mov R2,R14
	clr R3
	std y+5,R3
	std y+4,R2
	ldd R0,y+25
	std y+2,R0
	std y+0,R20
	ldd R18,y+19
	movw R16,R24
	xcall _Dis_Ascii
	.dbline 109
;     if(point==2)
	ldd R24,y+23
	cpi R24,2
	brne L32
	.dbline 110
;     {
	.dbline 111
;        x+=8;
	ldd R24,y+17
	ldd R25,y+18
	adiw R24,8
	std y+18,R25
	std y+17,R24
	.dbline 112
;        Dis_Ascii(x,y,'.',front,back);
	mov R2,R14
	clr R3
	std y+5,R3
	std y+4,R2
	ldd R0,y+25
	std y+2,R0
	ldi R24,46
	std y+0,R24
	ldd R18,y+19
	ldd R16,y+17
	ldd R17,y+18
	xcall _Dis_Ascii
	.dbline 113
;     }
L32:
	.dbline 114
;     tt=temp/10;
	ldi R18,10
	ldi R19,0
	ldd R16,y+21
	ldd R17,y+22
	xcall div16u
	mov R20,R16
	.dbline 115
;     temp%=10;
	ldi R18,10
	ldi R19,0
	ldd R16,y+21
	ldd R17,y+22
	xcall mod16u
	std y+22,R17
	std y+21,R16
	.dbline 116
;     if((tt==0)&(flag==0)&(point!=1))
	tst R20
	brne L36
	ldi R24,1
	ldi R25,0
	movw R12,R24
	xjmp L37
L36:
	clr R12
	clr R13
L37:
	ldd R0,y+6
	tst R0
	brne L38
	ldi R24,1
	ldi R25,0
	movw R10,R24
	xjmp L39
L38:
	clr R10
	clr R11
L39:
	ldd R24,y+23
	cpi R24,1
	breq L40
	ldi R22,1
	ldi R23,0
	xjmp L41
L40:
	clr R22
	clr R23
L41:
	movw R2,R12
	and R2,R10
	and R3,R11
	and R2,R22
	and R3,R23
	tst R2
	brne X3
	tst R3
	breq L34
X3:
	.dbline 117
;     {
	.dbline 118
;        tt=' ';
	ldi R20,32
	.dbline 119
;     }
	xjmp L35
L34:
	.dbline 121
;     else
;     {
	.dbline 122
;        flag=1;
	clr R0
	inc R0
	std y+6,R0
	.dbline 123
;        tt+=0x30;
	subi R20,208    ; addi 48
	.dbline 124
;     }
L35:
	.dbline 125
;     x+=8;
	ldd R24,y+17
	ldd R25,y+18
	adiw R24,8
	std y+18,R25
	std y+17,R24
	.dbline 126
;     Dis_Ascii(x,y,tt,front,back);
	mov R2,R14
	clr R3
	std y+5,R3
	std y+4,R2
	ldd R0,y+25
	std y+2,R0
	std y+0,R20
	ldd R18,y+19
	movw R16,R24
	xcall _Dis_Ascii
	.dbline 127
;     if(point==1)
	ldd R24,y+23
	cpi R24,1
	brne L42
	.dbline 128
;     {
	.dbline 129
;        x+=8;
	ldd R24,y+17
	ldd R25,y+18
	adiw R24,8
	std y+18,R25
	std y+17,R24
	.dbline 130
;        Dis_Ascii(x,y,'.',front,back);
	mov R2,R14
	clr R3
	std y+5,R3
	std y+4,R2
	ldd R0,y+25
	std y+2,R0
	ldi R24,46
	std y+0,R24
	ldd R18,y+19
	ldd R16,y+17
	ldd R17,y+18
	xcall _Dis_Ascii
	.dbline 131
;     }
L42:
	.dbline 132
;     x+=8;
	ldd R24,y+17
	ldd R25,y+18
	adiw R24,8
	std y+18,R25
	std y+17,R24
	.dbline 133
;     Dis_Ascii(x,y,temp+0x30,front,back);
	mov R2,R14
	clr R3
	std y+5,R3
	std y+4,R2
	ldd R0,y+25
	std y+2,R0
	ldd R24,y+21
	ldd R25,y+22
	adiw R24,48
	std y+0,R24
	ldd R18,y+19
	ldd R16,y+17
	ldd R17,y+18
	xcall _Dis_Ascii
	.dbline -2
L1:
	adiw R28,7
	xcall pop_gset5
	adiw R28,4
	.dbline 0 ; func end
	ret
	.dbsym l flag 6 c
	.dbsym r tt 20 c
	.dbsym r back 14 c
	.dbsym l front 25 c
	.dbsym l point 23 c
	.dbsym l temp 21 i
	.dbsym l y 19 c
	.dbsym l x 17 i
	.dbend
	.dbfunc e DrawLine _DrawLine fV
;             ey -> y+12
;             ex -> y+8
;             sy -> y+4
;             sx -> y+0
;              y -> R10
;              x -> R12,R13
;          color -> y+36
;             y2 -> y+34
;             x2 -> R20,R21
;             y1 -> y+30
;             x1 -> R10,R11
	.even
_DrawLine::
	st -y,r19
	st -y,r18
	xcall push_gset5
	movw R10,R16
	sbiw R28,20
	ldd R20,y+32
	ldd R21,y+33
	.dbline -1
	.dbline 144
; }
; /*
;     功能:画直线
;   参数:(x1,y1) 为起点坐标
;      (x2,y2) 为终点坐标
;      color 为线的颜色
;      编写者:赫树开
;      日期:2005.12.1
; */
; void DrawLine(unsigned int x1,unsigned char y1,unsigned int x2,unsigned char y2,unsigned char color)
; {
	.dbline 148
;      float sx,sy,ex,ey;
; 	 unsigned int x;
; 	 unsigned char y;
; 	 sx = x1;
	ldi R16,<L45
	ldi R17,>L45
	xcall elpm32
	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 add32f
	movw R30,R28
	std z+0,R16
	std z+1,R17
	std z+2,R18
	std z+3,R19
	.dbline 149
; 	 sy = y1;
	ldd R16,y+30
	clr R17
	xcall int2fp
	movw R30,R28
	std z+4,R16
	std z+5,R17
	std z+6,R18
	std z+7,R19
	.dbline 150
; 	 ex = x2;
	ldi R16,<L45
	ldi R17,>L45
	xcall elpm32
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	movw R16,R20
	lsr R17
	ror R16
	xcall int2fp
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall empy32fs
	movw R16,R20
	andi R16,1
	andi R17,0
	xcall int2fp
	st -y,R19
	st -y,R18
	st -y,R17
	st -y,R16
	xcall add32f
	movw R30,R28
	std z+8,R16
	std z+9,R17
	std z+10,R18
	std z+11,R19
	.dbline 151
; 	 ey = y2;
	ldd R16,y+34
	clr R17
	xcall int2fp
	movw R30,R28
	std z+12,R16
	std z+13,R17
	std z+14,R18
	std z+15,R19
	.dbline 152
; 	 if(fabs(sx-ex)>=fabs(sy-ey))
	movw R30,R28
	ldd R2,z+0
	ldd R3,z+1
	ldd R4,z+2
	ldd R5,z+3
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	movw R30,R28
 ; stack offset 4
	ldd R2,z+12
	ldd R3,z+13
	ldd R4,z+14
	ldd R5,z+15
	st -y,R5
	st -y,R4
	st -y,R3
	st -y,R2
	xcall sub32f
	xcall _fabs
	movw R2,R16
	movw R4,R18
	movw R30,R28
	ldd R6,z+4
	ldd R7,z+5
	ldd R8,z+6
	ldd R9,z+7
	st -y,R9
	st -y,R8
	st -y,R7
	st -y,R6
	movw R30,R28
 ; stack offset 4
	ldd R6,z+16
	ldd R7,z+17
	ldd R8,z+18
	ldd R9,z+19
	st -y,R9
	st -y,R8
	st -y,R7
	st -y,R6
	xcall sub32f
	push R2
	push R3
	push R4
	push R5
	xcall _fabs
	pop R5
	pop R4
	pop R3
	pop R2

⌨️ 快捷键说明

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