📄 ylf240128a-final.s
字号:
; 0x60,0x00,//设
; 0x31,0xF8,
; 0x39,0x98,
; 0x31,0x98,
; 0x01,0x98,
; 0x01,0x98,
; 0xF3,0x0F,
; 0x37,0xFC,
; 0x31,0x8C,
; 0x31,0x8C,
; 0x30,0xD8,
; 0x30,0xD8,
; 0x3C,0x70,
; 0x38,0xD8,
; 0x33,0x8F,
; 0x0E,0x06};
;
; const uchar ding16[]={//定_16
; 0x03,0x00,//定
; 0x01,0x80,
; 0x3F,0xFF,
; 0x30,0x06,
; 0x60,0x0C,
; 0x1F,0xF8,
; 0x01,0x80,
; 0x19,0x80,
; 0x19,0x80,
; 0x19,0xF8,
; 0x19,0x80,
; 0x3D,0x80,
; 0x37,0x80,
; 0x63,0x80,
; 0xC1,0xFE,
; 0x00,0x00};
;
; const uchar xian16[]={//显_16
; 0x00,0x00,//显
; 0x1F,0xF8,
; 0x18,0x18,
; 0x1F,0xF8,
; 0x18,0x18,
; 0x1F,0xF8,
; 0x06,0x60,
; 0x06,0x60,
; 0x66,0x6C,
; 0x36,0x6C,
; 0x1E,0x78,
; 0x1E,0x70,
; 0x06,0x60,
; 0xFF,0xFF,
; 0x00,0x00,
; 0x00,0x00};
;
; const uchar shi16[]={//示_16
; 0x00,0x00,//示
; 0x1F,0xFC,
; 0x00,0x00,
; 0x00,0x00,
; 0x00,0x00,
; 0x7F,0xFF,
; 0x01,0x80,
; 0x01,0x80,
; 0x19,0xB0,
; 0x19,0x98,
; 0x31,0x8C,
; 0x61,0x8E,
; 0xC1,0x86,
; 0x01,0x80,
; 0x07,0x80,
; 0x03,0x00};
;
; const uchar su16[]={//速_16
; 0x00,0xC0,//速
; 0x60,0xC0,
; 0x3F,0xFE,
; 0x30,0xC0,
; 0x00,0xC0,
; 0x07,0xFC,
; 0xF6,0xCC,
; 0x36,0xCC,
; 0x37,0xFC,
; 0x31,0xF0,
; 0x33,0xDC,
; 0x3E,0xCC,
; 0x30,0xC0,
; 0x78,0xC0,
; 0xCF,0xFF,
; 0x00,0x00};
;
; const uchar du16[]={//度_16
; 0x01,0x80,//度
; 0x00,0xC0,
; 0x3F,0xFF,
; 0x33,0x30,
; 0x33,0x30,
; 0x3F,0xFE,
; 0x33,0x30,
; 0x33,0xF0,
; 0x30,0x00,
; 0x37,0xFC,
; 0x33,0x18,
; 0x31,0xB0,
; 0x30,0xE0,
; 0x61,0xB8,
; 0x67,0x0F,
; 0xDC,0x06};
;
; const uchar xing16[]={//行_16
; 0x0C,0x00,//行
; 0x1E,0x00,
; 0x39,0xFE,
; 0x60,0x00,
; 0xCC,0x00,
; 0x0E,0x00,
; 0x1F,0xFF,
; 0x38,0x30,
; 0x78,0x30,
; 0xD8,0x30,
; 0x18,0x30,
; 0x18,0x30,
; 0x18,0x30,
; 0x18,0x30,
; 0x18,0xF0,
; 0x18,0x60};
;
; const uchar cheng16[]={//程_16
; 0x0F,0xFC,//程
; 0x79,0x8C,
; 0x19,0x8C,
; 0x19,0x8C,
; 0xFF,0x8C,
; 0x19,0xFC,
; 0x38,0x00,
; 0x3F,0xFE,
; 0x7E,0x60,
; 0x78,0x60,
; 0xDB,0xFE,
; 0x18,0x60,
; 0x18,0x60,
; 0x18,0x60,
; 0x1F,0xFF,
; 0x18,0x00};
;
; const uchar qi16[]={//起_16
; 0x0C,0x00,//起
; 0x0C,0x00,
; 0x0C,0xFC,
; 0x7F,0x0C,
; 0x0C,0x0C,
; 0x0C,0x0C,
; 0xFF,0xFC,
; 0x0C,0xC0,
; 0x6C,0xC0,
; 0x6F,0xC6,
; 0x6C,0xC6,
; 0x6C,0x7E,
; 0x6C,0x00,
; 0xFC,0x00,
; 0xDF,0xFF,
; 0x00,0x00};
;
; const uchar sshi16[]={//始_16
; 0x18,0x30,//始
; 0x1C,0x38,
; 0x18,0x30,
; 0x18,0x6C,
; 0xFE,0xC6,
; 0x37,0xFF,
; 0x36,0xC6,
; 0x66,0x00,
; 0x66,0xFE,
; 0x3C,0xC6,
; 0x1C,0xC6,
; 0x1E,0xC6,
; 0x33,0xC6,
; 0x63,0xFE,
; 0xC0,0xC6,
; 0x00,0x00};
;
; const uchar zhong16[]={//终_16
; 0x18,0xC0,//终
; 0x18,0xC0,
; 0x30,0xFE,
; 0x3D,0x8C,
; 0x6D,0xCC,
; 0xFB,0x78,
; 0x18,0x30,
; 0x30,0x78,
; 0x60,0xCC,
; 0xFF,0xE7,
; 0x00,0x38,
; 0x00,0x18,
; 0x1C,0x60,
; 0xF0,0x38,
; 0x00,0x1C,
; 0x00,0x0C};
;
; const uchar dian16[]={//点_16
; 0x01,0x80,//点
; 0x01,0x80,
; 0x01,0xFC,
; 0x01,0x80,
; 0x01,0x98,
; 0x1F,0xFC,
; 0x18,0x18,
; 0x18,0x18,
; 0x18,0x18,
; 0x1F,0xF8,
; 0x18,0x18,
; 0x01,0x98,
; 0x3C,0xCC,
; 0x36,0x66,
; 0x66,0x66,
; 0x00,0x00};
;
; const uchar pen16[]={//喷_16
; 0x00,0x60,//喷
; 0x00,0x60,
; 0xFF,0xFE,
; 0xD9,0xF8,
; 0xD9,0xF8,
; 0xDF,0xFF,
; 0xD9,0x98,
; 0xDB,0xFC,
; 0xFB,0x6C,
; 0xDB,0x6C,
; 0xC3,0x6C,
; 0x03,0xFC,
; 0x00,0xD8,
; 0x01,0x8E,
; 0x03,0x07,
; 0x06,0x06};
;
; const uchar sshe16[]={//射_16
; 0x0C,0x0C,//射
; 0x18,0x0C,
; 0x3F,0x8C,
; 0x31,0x8C,
; 0x3F,0xFF,
; 0x31,0x8C,
; 0x3F,0x8C,
; 0x31,0xEC,
; 0x31,0xBC,
; 0x7F,0xBC,
; 0x07,0xBC,
; 0x0D,0x8C,
; 0x19,0x8C,
; 0x31,0x8C,
; 0x67,0xBC,
; 0x03,0x18};
;
; const uchar fen16[]={//分_16
; 0x0C,0xC0,//分
; 0x0E,0xC0,
; 0x0C,0x60,
; 0x18,0x30,
; 0x18,0x38,
; 0x30,0x1C,
; 0x60,0x0F,
; 0xDF,0xF6,
; 0x06,0x30,
; 0x06,0x30,
; 0x06,0x30,
; 0x06,0x30,
; 0x0C,0x30,
; 0x18,0xF0,
; 0x30,0x60,
; 0x60,0x00};
;
; const uchar miao16[]={//秒_16
; 0x0E,0x30,//秒
; 0xF8,0x30,
; 0x18,0x30,
; 0x19,0xBC,
; 0xFF,0xF6,
; 0x19,0xB3,
; 0x3B,0x33,
; 0x3F,0x30,
; 0x7E,0x33,
; 0x7E,0x33,
; 0xD8,0x06,
; 0x18,0x0C,
; 0x18,0x18,
; 0x18,0x70,
; 0x19,0xC0,
; 0x1F,0x00};
;
; const uchar dao16[]={//倒_16
; 0x18,0x06,//倒
; 0x1F,0xE6,
; 0x1B,0x06,
; 0x33,0x06,
; 0x3E,0x1E,
; 0x7C,0xDE,
; 0xFF,0xFE,
; 0x33,0xDE,
; 0x33,0x1E,
; 0x3F,0xFE,
; 0x33,0x1E,
; 0x33,0x1E,
; 0x33,0x06,
; 0x33,0xE6,
; 0x3F,0x1E,
; 0x30,0x0C};
;
; const uchar ji16[]={//计_16
; 0x60,0x30,//计
; 0x30,0x30,
; 0x38,0x30,
; 0x30,0x30,
; 0x00,0x30,
; 0xFB,0xFF,
; 0x18,0x30,
; 0x18,0x30,
; 0x18,0x30,
; 0x18,0x30,
; 0x18,0x30,
; 0x1B,0x30,
; 0x1E,0x30,
; 0x1C,0x30,
; 0x18,0x30,
; 0x00,0x30};
;
; const uchar tshi16[]={//时_16
; 0x00,0x18,//时
; 0x00,0x18,
; 0x7E,0x18,
; 0x66,0x18,
; 0x67,0xFF,
; 0x66,0x18,
; 0x7E,0x18,
; 0x67,0x98,
; 0x66,0xD8,
; 0x66,0xD8,
; 0x7E,0x18,
; 0x00,0x18,
; 0x00,0x18,
; 0x00,0x18,
; 0x00,0x78,
; 0x00,0x30};
;
; const uchar m16[]={//m_16
; 0x00,0x00,//m
; 0x00,0x00,
; 0x00,0x00,
; 0x00,0x00,
; 0x00,0x00,
; 0x00,0x00,
; 0x00,0x00,
; 0xFF,0x00,
; 0x6D,0x80,
; 0x6D,0x80,
; 0x6D,0x80,
; 0x6D,0x81,
; 0x6D,0x81,
; 0xFF,0x83,
; 0x00,0x03,
; 0x00,0x06};
;
; const uchar s16[]={//s_16
; 0x00,0x00,//s
; 0x00,0x00,
; 0x18,0x00,
; 0x30,0x00,
; 0x30,0x00,
; 0x60,0x00,
; 0x60,0x00,
; 0xC0,0x3F,
; 0xC0,0x63,
; 0x80,0x60,
; 0x80,0x3E,
; 0x00,0x03,
; 0x00,0x63,
; 0x00,0x7E,
; 0x00,0x00,
; 0x00,0x00};
;
;
; void McuInit()
; {//初始化后所有管脚为输出高电平
.dbline 1243
; PORTA=0xff;
ldi R24,255
out 0x1b,R24
.dbline 1244
; PORTB=0xff;
out 0x18,R24
.dbline 1245
; DDRA=0xff;
out 0x1a,R24
.dbline 1246
; DDRB=0xff;
out 0x17,R24
.dbline -2
L1:
.dbline 0 ; func end
ret
.dbend
.dbfunc e ReadState _ReadState fc
; state -> R16
.even
_ReadState::
.dbline -1
.dbline 1250
; }
;
; uchar ReadState()
; {//读取状态字
.dbline 1252
; uchar state;
; DDRB=0x00;
clr R2
out 0x17,R2
.dbline 1253
; CD_SET;
sbi 0x1b,2
.dbline 1254
; RD_CLR;
cbi 0x1b,1
.dbline 1255
; NOP();NOP();NOP();NOP();NOP();
nop
.dbline 1255
nop
.dbline 1255
nop
.dbline 1255
nop
.dbline 1255
nop
.dbline 1256
; state=datain;
in R16,0x16
.dbline 1257
; RD_SET;
sbi 0x1b,1
.dbline 1258
; DDRB=0xff;
ldi R24,255
out 0x17,R24
.dbline 1259
; return state;
.dbline -2
L2:
.dbline 0 ; func end
ret
.dbsym r state 16 c
.dbend
.dbfunc e STA01 _STA01 fV
.even
_STA01::
.dbline -1
.dbline 1263
; }
;
; void STA01()
; {//判断状态位是否0,1位为高,并等待置高
L4:
.dbline 1265
L5:
.dbline 1264
; while((ReadState()&0x03)!=0x03)
xcall _ReadState
mov R24,R16
andi R24,3
cpi R24,3
brne L4
.dbline -2
L3:
.dbline 0 ; func end
ret
.dbend
.dbfunc e STA3 _STA3 fV
.even
_STA3::
.dbline -1
.dbline 1269
; ;
; }
;
; void STA3()
; {//判断状态位是否3位为高,并等待置高
L8:
.dbline 1271
L9:
.dbline 1270
; while((ReadState()&0x08)!=0x08)
xcall _ReadState
mov R24,R16
andi R24,8
cpi R24,8
brne L8
.dbline -2
L7:
.dbline 0 ; func end
ret
.dbend
.dbfunc e WriteData _WriteData fV
; dat -> R16
.even
_WriteData::
.dbline -1
.dbline 1275
; ;
; }
;
; void WriteData(uchar dat)
; {//把一位数据写入数据总线
.dbline 1276
; CD_CLR;
cbi 0x1b,2
.dbline 1277
; NOP();NOP();NOP();NOP();NOP();
nop
.dbline 1277
nop
.dbline 1277
nop
.dbline 1277
nop
.dbline 1277
nop
.dbline 1278
; dataout=dat;
out 0x18,R16
.dbline 1279
; WR_CLR;
cbi 0x1b,0
.dbline 1280
; NOP();NOP();NOP();NOP();NOP();
nop
.dbline 1280
nop
.dbline 1280
nop
.dbline 1280
nop
.dbline 1280
nop
.dbline 1281
; WR_SET;
sbi 0x1b,0
.dbline -2
L11:
.dbline 0 ; func end
ret
.dbsym r dat 16 c
.dbend
.dbfunc e WriteCmd _WriteCmd fV
; cmd -> R16
.even
_WriteCmd::
.dbline -1
.dbline 1285
; }
;
; void WriteCmd(uchar cmd)
; {//把一位命令字写入数据总线
.dbline 1286
; CD_SET;
sbi 0x1b,2
.dbline 1287
; NOP();NOP();NOP();NOP();NOP();
nop
.dbline 1287
nop
.dbline 1287
nop
.dbline 1287
nop
.dbline 1287
nop
.dbline 1288
; dataout=cmd;
out 0x18,R16
.dbline 1289
; WR_CLR;
cbi 0x1b,0
.dbline 1290
; NOP();NOP();NOP();NOP();NOP();
nop
.dbline 1290
nop
.dbline 1290
nop
.dbline 1290
nop
.dbline 1290
nop
.dbline 1291
; WR_SET;
sbi 0x1b,0
.dbline -2
L12:
.dbline 0 ; func end
ret
.dbsym r cmd 16 c
.dbend
.dbfunc e WriteTwoData _WriteTwoData fV
; cmd -> y+4
; dat2 -> R20
; dat1 -> R22
.even
_WriteTwoData::
xcall push_gset2
mov R20,R18
mov R22,R16
.dbline -1
.dbline 1295
; }
;
; void WriteTwoData(uchar dat1,uchar dat2,uchar cmd)
; {//写入有两位数据的命令
.dbline 1296
; STA01();
xcall _STA01
.dbline 1297
; WriteData(dat1);
mov R16,R22
xcall _WriteData
.dbline 1298
; STA01();
xcall _STA01
.dbline 1299
; WriteData(dat2);
mov R16,R20
xcall _WriteData
.dbline 1300
; STA01();
xcall _STA01
.dbline 1301
; WriteCmd(cmd);
ldd R16,y+4
xcall _WriteCmd
.dbline -2
L13:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym l cmd 4 c
.dbsym r dat2 20 c
.dbsym r dat1 22 c
.dbend
.dbfunc e WriteOneData _WriteOneData fV
; cmd -> R20
; dat -> R22
.even
_WriteOneData::
xcall push_gset2
mov R20,R18
mov R22,R16
.dbline -1
.dbline 1305
; }
;
; void WriteOneData(uchar dat,uchar cmd)
; {//写入有一位数据的命令
.dbline 1306
; STA01();
xcall _STA01
.dbline 1307
; WriteData(dat);
mov R16,R22
xcall _WriteData
.dbline 1308
; STA01();
xcall _STA01
.dbline 1309
; WriteCmd(cmd);
mov R16,R20
xcall _WriteCmd
.dbline -2
L14:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r cmd 20 c
.dbsym r dat 22 c
.dbend
.dbfunc e LcdInit _LcdInit fV
; delay -> R20
.even
_LcdInit::
xcall push_gset1
sbiw R28,1
.dbline -1
.dbline 1313
; }
;
; void LcdInit()
; {//用于设置显示器的参数
.dbline 1315
; uchar delay;
; delay=255;
ldi R20,255
.dbline 1316
; RS_CLR;
cbi 0x1b,3
L16:
.dbline 1317
L17:
.dbline 1317
; while(delay--);
mov R2,R20
clr R3
subi R20,1
tst R2
brne L16
.dbline 1318
; RS_SET;
sbi 0x1b,3
.dbline 1320
;
; WriteTwoData(0x00,0x00,0x40);//设置文本显示区域首地址
ldi R24,64
std y+0,R24
clr R18
clr R16
xcall _WriteTwoData
.dbline 1321
; WriteTwoData(0x20,0x00,0x41);//设置文本显示区域宽度32
ldi R24,65
std y+0,R24
clr R18
ldi R16,32
xcall _WriteTwoData
.dbline 1322
; WriteTwoData(0x00,0x08,0x42);//设置图形显示区域首地址
ldi R24,66
std y+0,R24
ldi R18,8
clr R16
xcall _WriteTwoData
.dbline 1323
; WriteTwoData(0x20,0x00,0x43);//设置文本显示区域宽度32
ldi R24,67
std y+0,R24
clr R18
ldi R16,32
xcall _WriteTwoData
.dbline 1325
;
; STA01();
xcall _STA01
.dbline 1326
; WriteCmd(0xA7);//光标形状设置
ldi R16,167
xcall _WriteCmd
.dbline 1327
; STA01();
xcall _STA01
.dbline 1328
; WriteCmd(0x80);//显示方式设置,逻辑"或"合成
ldi R16,128
xcall _WriteCmd
.dbline 1329
; STA01();
xcall _STA01
.dbline 1330
; WriteCmd(0x9C);//显示开关设置,文本、图形显示启用
ldi R16,156
xcall _WriteCmd
.dbline 1332
;
; WriteTwoData(0x03,0x00,0x22);//设置CGRAM OFFSET地址 0000 0011
ldi R24,34
std y+0,R24
clr R18
ldi R16,3
xcall _WriteTwoData
.dbline -2
L15:
adiw R28,1
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r delay 20 c
.dbend
.dbfunc e ClearLcd _ClearLcd fV
; count -> R20,R21
.even
_ClearLcd::
xcall push_gset1
sbiw R28,1
.dbline -1
.dbline 1336
; }
;
; void ClearLcd()
; {//用于清空显示器
.dbline 1337
; uint count=512;
ldi R20,512
ldi R21,2
.dbline 1338
; WriteTwoData(0x00,0x00,0x24);//设置显示RAM指针
ldi R24,36
std y+0,R24
clr R18
clr R16
xcall _WriteTwoData
.dbline 1339
; WriteCmd(0xB0);//自动写方式
ldi R16,176
xcall _WriteCmd
xjmp L21
L20:
.dbline 1341
.dbline 1342
xcall _STA3
.dbline 1343
clr R16
xcall _WriteData
.dbline 1344
L21:
.dbline 1340
; while(count--)
movw R2,R20
subi R20,1
sbci R21,0
tst R2
brne L20
tst R3
brne L20
X0:
.dbline 1345
; {
; STA3();
; WriteData(0x00);
; }
; WriteCmd(0xB2);//结束自动写指令
ldi R16,178
xcall _WriteCmd
.dbline 1347
;
; count=4096;
ldi R20,4096
ldi R21,16
.dbline 1348
; WriteTwoData(0x00,0x08,0x24);//设置显示RAM首地址
ldi R24,36
std y+0,R24
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -