📄 main.s
字号:
.module main.c
.area text(rom, con, rel)
.dbfile E:\刻录的\电子技术\项目\驱动程序\LCD1602四线接口应用范例\main.c
.dbfunc e main _main fV
.even
_main::
sbiw R28,9
.dbline -1
.dbline 22
; //项目名称:LCD1602四线接口应用范例
; //功能描述:测试4位数据线接口的LCD1602的驱动程序
; //外部模块:LCD1602
; //连接方法: 本例子的接线请参照LCD_1602.H中的定义
; //如果要更改端口,只要修改LCD_1602.H上的定义即可
; //外部时钟: 8MHz
; //开发人员:书生
; //开发日期:2006年2月13日凌晨
; //*********************************************************
; #include <iom8v.h>
; #include <macros.h>
; #include "LCD_1602.h"
;
; unsigned char hour,min,sec,time;
; unsigned int BT1_time,BT1_T,D882_P;
; void delay_nms(unsigned int n);
; void delay_nus(unsigned int n);
; /*----------------------------------
; 主程序
; -----------------------------------*/
; void main(void)
; {
.dbline 23
; delay_nms(20);
ldi R16,20
ldi R17,0
rcall _delay_nms
.dbline 24
; LCD_init();
rcall _LCD_init
.dbline 26
; //例如要写入以下数据
; BT1_time=545;
ldi R24,545
ldi R25,2
sts _BT1_time+1,R25
sts _BT1_time,R24
.dbline 27
; BT1_T=551;
ldi R24,39
sts _BT1_T+1,R25
sts _BT1_T,R24
.dbline 28
; D882_P=1050;
ldi R24,1050
ldi R25,4
sts _D882_P+1,R25
sts _D882_P,R24
.dbline 29
; hour=0;min=6;sec=12;//00:06:12
clr R2
sts _hour,R2
.dbline 29
ldi R24,6
sts _min,R24
.dbline 29
ldi R24,12
sts _sec,R24
.dbline 31
; //调用功能函数对数据进行处理并写入缓存
; LCD_write_time(7,1,hour,min,sec);
mov R2,R24
std y+4,R2
lds R2,_min
std y+2,R2
lds R2,_hour
std y+0,R2
ldi R18,1
ldi R16,7
rcall _LCD_write_time
.dbline 32
; LCD_write_number(7,0,0,BT1_time,"sec",10);
ldi R24,10
std y+8,R24
ldi R24,<L2
ldi R25,>L2
std y+7,R25
std y+6,R24
lds R2,_BT1_time
lds R3,_BT1_time+1
clr R4
clr R5
std y+2,R2
std y+3,R3
std y+4,R4
std y+5,R5
clr R2
std y+0,R2
clr R18
ldi R16,7
rcall _LCD_write_number
.dbline 33
; LCD_write_number(0,1,1,BT1_T,"C",0);
clr R2
std y+8,R2
ldi R24,<L3
ldi R25,>L3
std y+7,R25
std y+6,R24
lds R2,_BT1_T
lds R3,_BT1_T+1
clr R4
clr R5
std y+2,R2
std y+3,R3
std y+4,R4
std y+5,R5
ldi R24,1
std y+0,R24
ldi R18,1
clr R16
rcall _LCD_write_number
.dbline 34
; LCD_write_number(0,0,0,D882_P,"mW",0);
clr R2
std y+8,R2
ldi R24,<L4
ldi R25,>L4
std y+7,R25
std y+6,R24
lds R2,_D882_P
lds R3,_D882_P+1
clr R4
clr R5
std y+2,R2
std y+3,R3
std y+4,R4
std y+5,R5
clr R2
std y+0,R2
clr R18
clr R16
rcall _LCD_write_number
.dbline 36
;
; LCD_write_new();//把缓存里的数据写入LCD
rcall _LCD_write_new
rjmp L6
L5:
.dbline 38
.dbline 39
ldi R16,100
ldi R17,0
rcall _delay_nms
.dbline 40
L6:
.dbline 37
rjmp L5
X0:
.dbline -2
L1:
adiw R28,9
.dbline 0 ; func end
ret
.dbend
.area bss(ram, con, rel)
.dbfile E:\刻录的\电子技术\项目\驱动程序\LCD1602四线接口应用范例\main.c
_D882_P::
.blkb 2
.dbsym e D882_P _D882_P i
_BT1_T::
.blkb 2
.dbsym e BT1_T _BT1_T i
_BT1_time::
.blkb 2
.dbsym e BT1_time _BT1_time i
_time::
.blkb 1
.dbsym e time _time c
_sec::
.blkb 1
.dbsym e sec _sec c
_min::
.blkb 1
.dbsym e min _min c
_hour::
.blkb 1
.dbsym e hour _hour c
.area lit(rom, con, rel)
L4:
.byte 'm,'W,0
L3:
.byte 'C,0
L2:
.byte 's,'e,'c,0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -