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

📄 lm1602.s

📁 ds18b20+1602液晶显示 基于atmega16l单片机的编程
💻 S
📖 第 1 页 / 共 2 页
字号:
	subi R16,64    ; addi 192
	xcall _WriteCmd
L41:
	.dbline -2
L37:
	xcall pop_gset2
	.dbline 0 ; func end
	ret
	.dbsym r ucol 20 c
	.dbsym r urow 22 c
	.dbend
	.dbfunc e DisCGRAM _DisCGRAM fV
;             ch -> y+4
;           ucol -> R22
;           urow -> R20
	.even
_DisCGRAM::
	xcall push_gset2
	mov R22,R18
	mov R20,R16
	.dbline -1
	.dbline 184
; 	else
; 		WriteCmd( 0xc0+ucol);	
; }
; 
; void DisCGRAM(byte urow, byte ucol, char ch)
; {
	.dbline 185
;     SetDisAddr(urow, ucol);
	mov R18,R22
	mov R16,R20
	xcall _SetDisAddr
	.dbline 186
; 	WriteData(ch);
	ldd R16,y+4
	xcall _WriteData
	.dbline -2
L42:
	xcall pop_gset2
	.dbline 0 ; func end
	ret
	.dbsym l ch 4 c
	.dbsym r ucol 22 c
	.dbsym r urow 20 c
	.dbend
	.dbfunc e DisString _DisString fV
;              i -> R20
;            str -> R22,R23
;           ucol -> R12
;           urow -> R10
	.even
_DisString::
	xcall push_gset4
	mov R12,R18
	mov R10,R16
	ldd R22,y+8
	ldd R23,y+9
	.dbline -1
	.dbline 196
; }
; /*
; void DisChar(byte row, byte line, char ch)
; {
;     SetDisAddr(row, line);
; 	WriteData(ch);
; }
; */
; void DisString(byte urow, byte ucol, char *str)
; {
	.dbline 197
;      byte i = 0;
	clr R20
	.dbline 199
; 		
; 	SetDisAddr(urow, ucol);
	mov R18,R12
	mov R16,R10
	xcall _SetDisAddr
	xjmp L45
L44:
	.dbline 201
	.dbline 202
	mov R30,R20
	clr R31
	add R30,R22
	adc R31,R23
	ldd R16,z+0
	xcall _WriteData
	.dbline 203
	inc R20
	.dbline 204
L45:
	.dbline 200
; 	while (i < strlen(str))
	movw R16,R22
	xcall _strlen
	mov R2,R20
	clr R3
	cp R2,R16
	cpc R3,R17
	brlo L44
	.dbline -2
L43:
	xcall pop_gset4
	.dbline 0 ; func end
	ret
	.dbsym r i 20 c
	.dbsym r str 22 pc
	.dbsym r ucol 12 c
	.dbsym r urow 10 c
	.dbend
	.dbfunc e DisNum _DisNum fV
;            num -> y+4
;           ucol -> R22
;           urow -> R20
	.even
_DisNum::
	xcall push_gset2
	mov R22,R18
	mov R20,R16
	.dbline -1
	.dbline 209
; 	{
; 		WriteData(*(str + i));
; 		i++;
; 	}
; }
; 
; 
; void DisNum(byte urow, byte ucol, byte num)
; {
	.dbline 210
;  		SetDisAddr(urow, ucol);
	mov R18,R22
	mov R16,R20
	xcall _SetDisAddr
	.dbline 211
; 		 WriteData('0'+ num);
	ldd R16,y+4
	subi R16,208    ; addi 48
	xcall _WriteData
	.dbline -2
L47:
	xcall pop_gset2
	.dbline 0 ; func end
	ret
	.dbsym l num 4 c
	.dbsym r ucol 22 c
	.dbsym r urow 20 c
	.dbend
	.dbfunc e DisplayTime _DisplayTime fV
;         second -> y+6
;         minute -> R20
;           hour -> R22
	.even
_DisplayTime::
	xcall push_gset2
	mov R20,R18
	mov R22,R16
	sbiw R28,2
	.dbline -1
	.dbline 216
; }
; 
; 
; void DisplayTime(byte hour,byte minute,byte second)
; {
	.dbline 217
; 	 DisNum(1, 3, hour/16);
	mov R24,R22
	swap R24
	andi R24,#0x0F
	std y+0,R24
	ldi R18,3
	ldi R16,1
	xcall _DisNum
	.dbline 218
; 	 DisNum(1, 4, hour%16);
	ldi R17,16
	mov R16,R22
	xcall mod8u
	std y+0,R16
	ldi R18,4
	ldi R16,1
	xcall _DisNum
	.dbline 219
; 	 DisString(1, 5,":");
	ldi R24,<L49
	ldi R25,>L49
	std y+1,R25
	std y+0,R24
	ldi R18,5
	ldi R16,1
	xcall _DisString
	.dbline 220
; 	 DisNum(1, 6, minute/16);
	mov R24,R20
	swap R24
	andi R24,#0x0F
	std y+0,R24
	ldi R18,6
	ldi R16,1
	xcall _DisNum
	.dbline 221
; 	 DisNum(1, 7, minute%16);
	ldi R17,16
	mov R16,R20
	xcall mod8u
	std y+0,R16
	ldi R18,7
	ldi R16,1
	xcall _DisNum
	.dbline 222
; 	 DisString(1, 8,":");
	ldi R24,<L49
	ldi R25,>L49
	std y+1,R25
	std y+0,R24
	ldi R18,8
	ldi R16,1
	xcall _DisString
	.dbline 224
; 	 
; 	 DisNum(1, 10, second & 0x0f);
	ldd R24,y+6
	andi R24,15
	std y+0,R24
	ldi R18,10
	ldi R16,1
	xcall _DisNum
	.dbline 225
; 	 DisNum(1, 9, (second >> 4) &0x07);
	ldd R24,y+6
	swap R24
	andi R24,#0x0F
	andi R24,7
	std y+0,R24
	ldi R18,9
	ldi R16,1
	xcall _DisNum
	.dbline -2
L48:
	adiw R28,2
	xcall pop_gset2
	.dbline 0 ; func end
	ret
	.dbsym l second 6 c
	.dbsym r minute 20 c
	.dbsym r hour 22 c
	.dbend
	.dbfunc e LCD_Dis_Float _LCD_Dis_Float fV
;       tempdata -> y+1
;              i -> R20
;         bvalue -> y+11
;           ucol -> R22
;           urow -> R10
	.even
_LCD_Dis_Float::
	xcall push_gset3
	mov R22,R18
	mov R10,R16
	sbiw R28,5
	.dbline -1
	.dbline 230
; }
; 
; 
; void LCD_Dis_Float(byte urow,byte ucol,byte bvalue)
; {
	.dbline 234
;    byte i;
;    byte tempdata[4];
;    
;    tempdata[0] = (bvalue)/100;
	ldi R17,100
	ldd R16,y+11
	xcall div8u
	std y+1,R16
	.dbline 235
;    if(tempdata[0]== 0) tempdata[0]= ' '-'0';
	tst R16
	brne L51
	.dbline 235
	ldi R24,240
	std y+1,R24
L51:
	.dbline 236
;    tempdata[1] = (bvalue)%100/10;
	ldi R17,100
	ldd R16,y+11
	xcall mod8u
	ldi R17,10
	xcall div8u
	std y+2,R16
	.dbline 237
;    if((tempdata[0] == 0x00)&&(tempdata[1] == 0x00))
	ldd R2,y+1
	tst R2
	brne L54
	tst R16
	brne L54
	.dbline 238
;    {
	.dbline 239
;       tempdata[1] = ' '-'0';
	ldi R24,240
	std y+2,R24
	.dbline 240
;    }
L54:
	.dbline 241
;    tempdata[2] = (bvalue)%10;
	ldi R17,10
	ldd R16,y+11
	xcall mod8u
	std y+3,R16
	.dbline 242
;    tempdata[3] = '.'-'0';
	ldi R24,254
	std y+4,R24
	.dbline 244
; 
;     for(i = 0;i<4;i++) 
	clr R20
	xjmp L63
L60:
	.dbline 245
	movw R24,R28
	adiw R24,1
	mov R30,R20
	clr R31
	add R30,R24
	adc R31,R25
	ldd R2,z+0
	std y+0,R2
	mov R18,R22
	add R18,R20
	mov R16,R10
	xcall _DisNum
L61:
	.dbline 244
	inc R20
L63:
	.dbline 244
	cpi R20,4
	brlo L60
	.dbline -2
L50:
	adiw R28,5
	xcall pop_gset3
	.dbline 0 ; func end
	ret
	.dbsym l tempdata 1 A[4:4]c
	.dbsym r i 20 c
	.dbsym l bvalue 11 c
	.dbsym r ucol 22 c
	.dbsym r urow 10 c
	.dbend
	.dbfunc e LCD_Dis_Temperature _LCD_Dis_Temperature fV
;         rValue -> R10,R11
;           ucol -> R22
;           urow -> R20
	.even
_LCD_Dis_Temperature::
	xcall push_gset3
	mov R22,R18
	mov R20,R16
	sbiw R28,2
	ldd R10,y+8
	ldd R11,y+9
	.dbline -1
	.dbline 249
;       DisNum(urow,ucol+i,tempdata[i]);
; }
; 
;  void LCD_Dis_Temperature(byte urow,byte ucol, unsigned int rValue)	//温度数据转换和显示函数
; {
	.dbline 250
;     ClearLcd();
	xcall _ClearLcd
	.dbline 251
; 	DisString(0,1,"Temperature is:");
	ldi R24,<L65
	ldi R25,>L65
	std y+1,R25
	std y+0,R24
	ldi R18,1
	clr R16
	xcall _DisString
	.dbline 252
;    if((rValue &0xf800) == 0xf800)
	movw R24,R10
	andi R24,0
	andi R25,248
	cpi R24,0
	ldi R30,248
	cpc R25,R30
	brne L66
	.dbline 253
;    {
	.dbline 254
;    	   DisString(urow,ucol,"-");
	ldi R24,<L68
	ldi R25,>L68
	std y+1,R25
	std y+0,R24
	mov R18,R22
	mov R16,R20
	xcall _DisString
	.dbline 255
;        LCD_Dis_Float(urow,ucol+1,((byte)(~((rValue>>3)-1)))>>1);
	movw R24,R10
	lsr R25
	ror R24
	lsr R25
	ror R24
	lsr R25
	ror R24
	sbiw R24,1
	com R24
	com R25
	lsr R24
	std y+0,R24
	mov R18,R22
	subi R18,255    ; addi 1
	mov R16,R20
	xcall _LCD_Dis_Float
	.dbline 256
;    }
	xjmp L67
L66:
	.dbline 258
;    else 
;    {
	.dbline 259
;      DisString(urow,ucol," ");
	ldi R24,<L69
	ldi R25,>L69
	std y+1,R25
	std y+0,R24
	mov R18,R22
	mov R16,R20
	xcall _DisString
	.dbline 260
;       LCD_Dis_Float(urow,ucol+1,(rValue>>4)&0xff);
	movw R24,R10
	lsr R25
	ror R24
	lsr R25
	ror R24
	lsr R25
	ror R24
	lsr R25
	ror R24
	andi R25,0
	std y+0,R24
	mov R18,R22
	subi R18,255    ; addi 1
	mov R16,R20
	xcall _LCD_Dis_Float
	.dbline 261
;     }
L67:
	.dbline 262
; 	 if((rValue&0x08)==0x08)
	movw R24,R10
	andi R24,8
	andi R25,0
	cpi R24,8
	ldi R30,0
	cpc R25,R30
	brne L70
	.dbline 263
;       DisString(urow,ucol+5,"5");
	ldi R24,<L72
	ldi R25,>L72
	std y+1,R25
	std y+0,R24
	mov R18,R22
	subi R18,251    ; addi 5
	mov R16,R20
	xcall _DisString
	xjmp L71
L70:
	.dbline 265
;      else
;       DisString(urow,ucol+5,"0");
	ldi R24,<L73
	ldi R25,>L73
	std y+1,R25
	std y+0,R24
	mov R18,R22
	subi R18,251    ; addi 5
	mov R16,R20
	xcall _DisString
L71:
	.dbline 266
; 	  DisCGRAM(urow, ucol+6, 0x00);
	clr R2
	std y+0,R2
	mov R18,R22
	subi R18,250    ; addi 6
	mov R16,R20
	xcall _DisCGRAM
	.dbline -2
L64:
	adiw R28,2
	xcall pop_gset3
	.dbline 0 ; func end
	ret
	.dbsym r rValue 10 i
	.dbsym r ucol 22 c
	.dbsym r urow 20 c
	.dbend
	.dbfunc e LcdInit _LcdInit fV
	.even
_LcdInit::
	sbiw R28,1
	.dbline -1
	.dbline 272
; }
; 
; 
; 
; void LcdInit(void)
; {
	.dbline 273
;  	ClearLcd();	
	xcall _ClearLcd
	.dbline 274
; 	CurReturn(); 
	xcall _CurReturn
	.dbline 275
; 	SetInputMode(1, 0); 
	clr R18
	ldi R16,1
	xcall _SetInputMode
	.dbline 276
; 	SetDisMode(1, 0, 0); 
	clr R2
	std y+0,R2
	clr R18
	ldi R16,1
	xcall _SetDisMode
	.dbline 278
; //	SetShift(0, 0);
; 	SetFunction(1, 1, 1);
	ldi R24,1
	std y+0,R24
	ldi R18,1
	ldi R16,1
	xcall _SetFunction
	.dbline 280
; //	SetCGRAMAddr();
;     LCD_WriteCGRAM(CGRAMtab,8);
	ldi R18,8
	ldi R16,<_CGRAMtab
	ldi R17,>_CGRAMtab
	xcall _LCD_WriteCGRAM
	.dbline -2
L74:
	adiw R28,1
	.dbline 0 ; func end
	ret
	.dbend
	.area data(ram, con, rel)
	.dbfile F:\avr最小系统板\程序代码\ex15_ds18b20_1602\lm1602.c
L73:
	.blkb 2
	.area idata
	.byte 48,0
	.area data(ram, con, rel)
	.dbfile F:\avr最小系统板\程序代码\ex15_ds18b20_1602\lm1602.c
L72:
	.blkb 2
	.area idata
	.byte 53,0
	.area data(ram, con, rel)
	.dbfile F:\avr最小系统板\程序代码\ex15_ds18b20_1602\lm1602.c
L69:
	.blkb 2
	.area idata
	.byte 32,0
	.area data(ram, con, rel)
	.dbfile F:\avr最小系统板\程序代码\ex15_ds18b20_1602\lm1602.c
L68:
	.blkb 2
	.area idata
	.byte 45,0
	.area data(ram, con, rel)
	.dbfile F:\avr最小系统板\程序代码\ex15_ds18b20_1602\lm1602.c
L65:
	.blkb 16
	.area idata
	.byte 'T,'e,'m,'p,'e,'r,'a,'t,'u,'r,'e,32,'i,'s,58,0
	.area data(ram, con, rel)
	.dbfile F:\avr最小系统板\程序代码\ex15_ds18b20_1602\lm1602.c
L49:
	.blkb 2
	.area idata
	.byte 58,0
	.area data(ram, con, rel)
	.dbfile F:\avr最小系统板\程序代码\ex15_ds18b20_1602\lm1602.c

⌨️ 快捷键说明

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