📄 lcd1602pbpd.s
字号:
.module Lcd1602PBPD.C
.area text(rom, con, rel)
.dbfile D:\ICC_H\Software.H
.dbfunc e speaData _speaData fV
; y -> y+4
; j -> y+0
; i -> R10
; len -> R12
; dat -> y+16
.even
_speaData::
xcall push_arg4
xcall push_gset4
sbiw R28,8
ldd R12,y+20
.dbline -1
.dbline 116
; /*********************************************************************
; 微 雪 电 子 WaveShare http://www.waveShare.net
;
; 功能目的: 建立使用LCD1602的示例程序
;
; 目标系统: 基于AVR单片机
;
; 应用软件: ICCAVR
;
; 版 本: Version 1.0
;
; 圆版时间: 2005-03-01
;
; 开发人员: SEE
;
; 说 明: 若用于商业用途,请保留此段文字或注明代码来源
;
; 深 圳 市 微 雪 电 子 有 限 公 司 保 留 所 有 的 版 权
; *********************************************************************/
;
; /*01010101010101010101010101010101010101010101010101010101010101010101
; ----------------------------------------------------------------------
; 版本更新记录:
;
; ----------------------------------------------------------------------
; 实验内容:
; 初始化、读写Lcd1602。
; ----------------------------------------------------------------------
; 硬件连接:
; 将Lcd1602插入主板的Lcd1602插槽,
; 使用连接线将LCD1602的引针接口连接到MCU:
; //LCD1602,4位接口,即使用D4-D7数据口,D0-D3不接入MCU
; //PIN1 --- GND
; //PIN2 --- VCC
; //PIN3 --- V0
; //PIN4 --- RS --- PB5
; //PIN5 --- R/W --- PB6
; //PIN6 --- E --- PB7
; //PIN7 --- D0
; //PIN8 --- D1
; //PIN9 --- D2
; //PIN10 --- D3
; //PIN11 --- D4 --- PD4
; //PIN12 --- D5 --- PD5
; //PIN13 --- D6 --- PD6
; //PIN14 --- D7 --- PD7
; //PIN15 --- VCC
; //PIN16 --- GND
; ----------------------------------------------------------------------
; 注意事项:
; (1)若有加载库函数,请将光盘根目录下的“库函数”下的“ICC_H”文件夹拷到D盘
; (2)请详细阅读:光盘根目录下的“产品资料\开发板实验板\SMK系列\SMK1632\说明资料”
; ----------------------------------------------------------------------
; 10101010101010101010101010101010101010101010101010101010101010101010*/
;
; #include <iom16v.h>
; #include "D:\ICC_H\CmmICC.H"
;
; /* control port */
; #define SET_RS sbi(PORTB,5)
; #define CLR_RS cbi(PORTB,5)
; #define OUT_RS sbi(DDRB,5)
;
; #define SET_RW sbi(PORTB,6)
; #define CLR_RW cbi(PORTB,6)
; #define OUT_RW sbi(DDRB,6)
;
; #define SET_E sbi(PORTB,7)
; #define CLR_E cbi(PORTB,7)
; #define OUT_E sbi(DDRB,7)
;
; /* data port */
; #define SET_D4 sbi(PORTD,4)
; #define CLR_D4 cbi(PORTD,4)
; #define OUT_D4 sbi(DDRD,4)
;
; #define SET_D5 sbi(PORTD,5)
; #define CLR_D5 cbi(PORTD,5)
; #define OUT_D5 sbi(DDRD,5)
;
; #define SET_D6 sbi(PORTD,6)
; #define CLR_D6 cbi(PORTD,6)
; #define OUT_D6 sbi(DDRD,6)
;
; #define SET_D7 sbi(PORTD,7)
; #define CLR_D7 cbi(PORTD,7)
; #define OUT_D7 sbi(DDRD,7)
;
; /* busy port */
; #define GET_BF gbi(PIND,7)
; #define OUT_BF sbi(DDRD,7)
; #define IN_BF cbi(DDRD,7)
;
; #include "D:\ICC_H\LCD1602_.H"
;
; const uint8 userCh0[8]={0x10,0x1f,0x01,0x02,0x04,0x08,0x10,0x1f};
; const uint8 userCh1[8]={0x00,0x08,0x0f,0x01,0x02,0x04,0x08,0x0f};
; const uint8 userCh2[8]={0x00,0x00,0x04,0x07,0x01,0x02,0x04,0x07};
;
; /*--------------------------------------------------------------------
; 函数全称:
; 函数功能:
; 注意事项:
; 提示说明:
; 输 入:
; 返 回:
; --------------------------------------------------------------------*/
; void main()
; {
;
; LCD1602_init();
;
; while(1)
; {
; LCD1602_puts(0xC6,"Sleeping");
; delay50ms(5);
.dbline 119
; LCD1602_setCmd("CLR_SCR");
; delay50ms(5);
; LCD1602_puts(0xC6,"Sleeping");
clr R10
ldi R20,1
ldi R21,0
ldi R22,0
ldi R23,0
movw R30,R28
std z+0,R20
std z+1,R21
std z+2,R22
std z+3,R23
xjmp L5
L2:
.dbline 120
.dbline 121
movw R30,R28
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
movw R30,R28
ldd R6,z+16
ldd R7,z+17
ldd R8,z+18
ldd R9,z+19
st -y,R5
st -y,R4
st -y,R3
st -y,R2
movw R16,R6
movw R18,R8
xcall div32u
movw R30,R28
std z+4,R16
std z+5,R17
std z+6,R18
std z+7,R19
.dbline 122
ldi R20,10
ldi R21,0
ldi R22,0
ldi R23,0
movw R30,R28
ldd R2,z+4
ldd R3,z+5
ldd R4,z+6
ldd R5,z+7
st -y,R23
st -y,R22
st -y,R21
st -y,R20
movw R16,R2
movw R18,R4
xcall mod32u
ldi R24,<_dataElem
ldi R25,>_dataElem
mov R30,R10
clr R31
add R30,R24
adc R31,R25
std z+0,R16
.dbline 123
movw R30,R28
ldd R2,z+0
ldd R3,z+1
ldd R4,z+2
ldd R5,z+3
ldi R20,10
ldi R21,0
ldi R22,0
ldi R23,0
st -y,R5
st -y,R4
st -y,R3
st -y,R2
movw R16,R20
movw R18,R22
xcall empy32u
movw R30,R28
std z+0,R16
std z+1,R17
std z+2,R18
std z+3,R19
.dbline 124
L3:
.dbline 119
inc R10
L5:
.dbline 119
cp R10,R12
brsh X0
xjmp L2
X0:
.dbline -2
L1:
adiw R28,8
xcall pop_gset4
adiw R28,4
.dbline 0 ; func end
ret
.dbsym l y 4 l
.dbsym l j 0 l
.dbsym r i 10 c
.dbsym r len 12 C
.dbsym l dat 16 l
.dbend
.dbfile D:\ICC_H\I2C.H
.dbfunc e I2C_Start _I2C_Start fc
.even
_I2C_Start::
.dbline -1
.dbline 128
; delay50ms(5);
; LCD1602_setCmd("CLR_SCR");
; delay50ms(5);
; LCD1602_puts(0xC6,"Sleeping");
; delay50ms(5);
;
; LCD1602_setCGRAM(CGRAM0,userCh0); //Set CGRAM0' data
; LCD1602_setCGRAM(CGRAM1,userCh1); //Set CGRAM1' data
; LCD1602_setCGRAM(CGRAM2,userCh2); //Set CGRAM2' data
.dbline 129
;
ldi R24,164
out 0x36,R24
.dbline 130
L7:
.dbline 130
L8:
.dbline 130
; LCD1602_putc(0x84,CGRAM2); //putc to 0x84 by CGRAM2' data
in R2,0x36
sbrs R2,7
rjmp L7
.dbline 130
.dbline 130
.dbline 131
; delay50ms(10);
in R24,0x1
andi R24,248
cpi R24,8
breq L10
.dbline 132
; LCD1602_putc(0x83,CGRAM1); //putc to 0x83 by CGRAM1' data
clr R16
xjmp L6
L10:
.dbline 133
; delay50ms(12);
ldi R16,1
.dbline -2
L6:
.dbline 0 ; func end
ret
.dbend
.dbfunc e I2C_Restart _I2C_Restart fc
.even
_I2C_Restart::
.dbline -1
.dbline 144
; LCD1602_putc(0x82,CGRAM0); //putc to 0x84 by CGRAM0' data
; delay50ms(14);
;
; LCD1602_setCmd("CLR_SCR");
; }
; }
; }
; }
; }
; }
; }
.dbline 145
; }
ldi R24,164
out 0x36,R24
.dbline 146
L13:
.dbline 146
L14:
.dbline 146
; }
in R2,0x36
sbrs R2,7
rjmp L13
.dbline 146
.dbline 146
.dbline 147
; }
in R24,0x1
andi R24,248
cpi R24,16
breq L16
.dbline 148
; }
clr R16
xjmp L12
L16:
.dbline 149
; }
ldi R16,1
.dbline -2
L12:
.dbline 0 ; func end
ret
.dbend
.dbfunc e I2C_SendWrDAdr _I2C_SendWrDAdr fc
; wrDAdr -> R16
.even
_I2C_SendWrDAdr::
.dbline -1
.dbline 160
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
; }
.dbline 161
; }
.dbline 161
out 0x3,R16
.dbline 161
ldi R24,132
out 0x36,R24
.dbline 161
.dbline 161
.dbline 162
L19:
.dbline 162
L20:
.dbline 162
; }
in R2,0x36
sbrs R2,7
rjmp L19
.dbline 162
.dbline 162
.dbline 163
; }
in R24,0x1
andi R24,248
cpi R24,24
breq L22
.dbline 164
; }
clr R16
xjmp L18
L22:
.dbline 165
; }
ldi R16,1
.dbline -2
L18:
.dbline 0 ; func end
ret
.dbsym r wrDAdr 16 c
.dbend
.dbfunc e I2C_SendWrDAdr_ _I2C_SendWrDAdr_ fc
; wrDAdr -> R20,R21
.even
_I2C_SendWrDAdr_::
xcall push_gset1
movw R20,R16
.dbline -1
.dbline 176
;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -