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

📄 lcd.s

📁 基于AVR单片机的热电偶测量系统源码
💻 S
📖 第 1 页 / 共 3 页
字号:
	.module lcd.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\lcd.c
	.dbfunc e Send_Byte _Send_Byte fV
;          bdata -> R16
	.even
_Send_Byte::
	.dbline -1
	.dbline 48
; /************************************************************
;   FileName: lcd.c
;   Description: 液晶显示模块初始化lcd,向lcd发送命令字和数据,显示指定大小的图像,清屏。                        
;   Function List:  
;     1.Send_Byte()
;       功能:向lcd的控制芯片发送数据
;       
;     2.Send_Commnad()
;       功能:向lcd的控制芯片发送命令字
;       
;     3.Gen_Column_MSB()
;       Gen_Column_MSB()
;       功能:生成设置高4位和低4位列地址的命令字
; 
;     4.Initial_LCD()
;       功能:初始化lcd
;       
;     5.Gen_Page()
;       功能:生成设置页地址的命令字
;       
;       
;     6.Clear_DDRAM()
;       功能:清除lcd指定页内显示的所有数据
;       
;     7.Bmp8x8()
;       功能:显示8个点乘8个点的图像
;       
;     9.Bmp8x16()
;       功能:显示8个点乘16个点的图像
;       
;       
;     10.Bmp8x16_Rev()_
;       功能:反白显示8个点乘16个点的图像
; 
;     11.Draw_NtoArab()
;       功能:将数值显示为阿拉伯数字
;       
;     12.Draw_NtoArab_rev()
;       功能:反白显示
; 
; ***********************************************************/
; #include <iom16v.h>
; #include <macros.h>
; #include "main.h"
; #include "lcd.h"
; 
; void Send_Byte(unsigned char bdata)
; {    
	.dbline 49
;      set_CS;    		//模拟时序信号
	sbi 0x15,1
	.dbline 50
;      set_CS;
	sbi 0x15,1
	.dbline 51
; 	 set_RS;
	sbi 0x15,7
	.dbline 52
; 	 set_WR;
	sbi 0x12,5
	.dbline 53
; 	 _nop;      		//开始发送数据
	nop
	.dbline 54
; 	 PORTA = bdata;    	//将显示数据放在端口A 
	out 0x1b,R16
	.dbline 55
;      set_RS;
	sbi 0x15,7
	.dbline 56
;      clr_CS;
	cbi 0x15,1
	.dbline 57
;      clr_WR;
	cbi 0x12,5
	.dbline 58
;      _nop;
	nop
	.dbline 59
;      clr_WR;
	cbi 0x12,5
	.dbline 60
;      _nop;
	nop
	.dbline 61
;      set_WR;
	sbi 0x12,5
	.dbline 62
;      _nop;
	nop
	.dbline 63
;      set_CS;
	sbi 0x15,1
	.dbline 64
;      set_RS;
	sbi 0x15,7
	.dbline -2
L1:
	.dbline 0 ; func end
	ret
	.dbsym r bdata 16 c
	.dbend
	.dbfunc e Send_Command _Send_Command fV
;          cdata -> R16
	.even
_Send_Command::
	.dbline -1
	.dbline 69
; }
; 
; 
; void Send_Command(unsigned char cdata)
; {    
	.dbline 70
;          set_CS;
	sbi 0x15,1
	.dbline 71
; 	 set_RS;
	sbi 0x15,7
	.dbline 72
; 	 set_WR;
	sbi 0x12,5
	.dbline 73
; 	 _nop;               //开始发送命令
	nop
	.dbline 74
; 	 PORTA = cdata;     //将命令字放在端口A
	out 0x1b,R16
	.dbline 75
; 	 clr_RS;
	cbi 0x15,7
	.dbline 76
; 	 clr_CS;
	cbi 0x15,1
	.dbline 77
; 	 _nop;
	nop
	.dbline 78
; 	 clr_WR;
	cbi 0x12,5
	.dbline 79
; 	 _nop;
	nop
	.dbline 80
; 	 set_WR;
	sbi 0x12,5
	.dbline 81
; 	 _nop;
	nop
	.dbline 82
; 	 set_CS;
	sbi 0x15,1
	.dbline 83
; 	 set_RS;
	sbi 0x15,7
	.dbline -2
L2:
	.dbline 0 ; func end
	ret
	.dbsym r cdata 16 c
	.dbend
	.dbfunc e Gen_Column_MSB _Gen_Column_MSB fc
;           temp -> R20
;         column -> R16
	.even
_Gen_Column_MSB::
	xcall push_gset1
	.dbline -1
	.dbline 89
; }
; 
; 
; 
; unsigned char Gen_Column_MSB(unsigned char column)
; {
	.dbline 91
;     unsigned char temp; //用于保存列数的高4bit命令字
;     temp = column+0x04 ;	
	mov R20,R16
	subi R20,252    ; addi 4
	.dbline 92
;     temp = temp >>4;  //右移4位,得到高4位的列数据
	mov R24,R20
	swap R24
	andi R24,#0x0F
	mov R20,R24
	.dbline 93
;     temp |=0x10;   //00010000,将列地址的DB4置1
	ori R20,16
	.dbline 94
;     return temp;
	mov R16,R20
	.dbline -2
L3:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r temp 20 c
	.dbsym r column 16 c
	.dbend
	.dbfunc e Gen_Column_LSB _Gen_Column_LSB fc
;           temp -> R20
;         column -> R16
	.even
_Gen_Column_LSB::
	xcall push_gset1
	.dbline -1
	.dbline 101
; }
; 
; 
; 
; 
; unsigned char Gen_Column_LSB(unsigned char column)
; {
	.dbline 102
;     unsigned char temp = column;
	mov R20,R16
	.dbline 103
;     temp = column+0x04 ;	
	subi R20,252    ; addi 4
	.dbline 104
;     temp &= 0x0f;	//取出column的低四位
	andi R20,15
	.dbline 105
;     return temp;
	mov R16,R20
	.dbline -2
L4:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r temp 20 c
	.dbsym r column 16 c
	.dbend
	.dbfunc e Gen_Page _Gen_Page fc
;           temp -> R20
;           page -> R16
	.even
_Gen_Page::
	xcall push_gset1
	.dbline -1
	.dbline 112
; }
; 
; 
; 
; 
; unsigned char Gen_Page(unsigned char page)
; {
	.dbline 114
;     unsigned char temp;
;     temp = page & 0x0f;
	mov R20,R16
	andi R20,15
	.dbline 115
;     temp |= 0xb0;   //得到显示数据页的控制字
	ori R20,176
	.dbline 116
;     return temp;
	mov R16,R20
	.dbline -2
L5:
	xcall pop_gset1
	.dbline 0 ; func end
	ret
	.dbsym r temp 20 c
	.dbsym r page 16 c
	.dbend
	.dbfunc e Initial_LCD _Initial_LCD fV
	.even
_Initial_LCD::
	.dbline -1
	.dbline 123
; }
; 
; 
; 
; 
; void Initial_LCD(void)
; {
	.dbline 124
; 	  Send_Command(0xe2);	//初始化内部功能(RESET),初始化初始显示线,列地址,页地址和普通
	ldi R16,226
	xcall _Send_Command
	.dbline 126
; 	  			//输出地址状态到初始状态,但是不能影响显示数据RAM的内容
;           wait;                 //等待2个时钟周期
	nop
	 nop
	.dbline 127
; 	  Send_Command(0xaf);	//Display on
	ldi R16,175
	xcall _Send_Command
	.dbline 128
; 	  Send_Command(0x23);	//internal voltage regulator resistor ratio,(4.5)0x23
	ldi R16,35
	xcall _Send_Command
	.dbline 129
; 	  Send_Command(0x2f);	//内部供电VC=VR=VF:111,使内部VC,VR,VF的电压控制电路工作
	ldi R16,47
	xcall _Send_Command
	.dbline 130
; 	  Send_Command(0x40);	//初始化显示线在line address 0
	ldi R16,64
	xcall _Send_Command
	.dbline 131
; 	  Send_Command(0x81);	//设置参考电压模式对比度共64级	
	ldi R16,129
	xcall _Send_Command
	.dbline 132
; 	  Send_Command(0xa1);	
	ldi R16,161
	xcall _Send_Command
	.dbline 133
; 	  Send_Command(0xa1);	
	ldi R16,161
	xcall _Send_Command
	.dbline 134
; 	  Send_Command(0xa3);	//选择LCD偏置电压比率以驱动LCD,bias=1
	ldi R16,163
	xcall _Send_Command
	.dbline 135
; 	  Send_Command(0xa4);	//全亮显示,EON=0,normal display(不管显示RAM中有何数据)
	ldi R16,164
	xcall _Send_Command
	.dbline 136
; 	  Send_Command(0xb0);	//设置页地址为0
	ldi R16,176
	xcall _Send_Command
	.dbline 137
; 	  Send_Command(0x0c);   //选择COM(行地址)输出扫描方向,决定LCD驱动器的输出状态。SHL=0,normal direction(COM0-COM63)
	ldi R16,12
	xcall _Send_Command
	.dbline 138
; 	  Send_Command(0xad);	//设置STATIC INDICATOR STATUS(SM=1,STATIC INDICATOR ON)
	ldi R16,173
	xcall _Send_Command
	.dbline 139
; 	  Send_Command(0x03);	//STATUS OF STATIC INDICATOR OUTPUT ALWAYS ON
	ldi R16,3
	xcall _Send_Command
	.dbline -2
L6:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e Clear_DDRAM _Clear_DDRAM fV
;   c_column_lsb -> R20
;   c_column_msb -> R20
;     start_page -> R22
;              j -> R20
;              i -> R12
;     c_page_end -> R10
;   c_page_start -> R12
	.even
_Clear_DDRAM::

⌨️ 快捷键说明

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