📄 160104_s6b0719.s
字号:
mov R16,R20
ori R16,32
xcall _write_comm
.dbline -2
L24:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r r 20 c
.dbend
.dbfunc e set_ref _set_ref fV
; ev -> R20
.even
_set_ref::
xcall push_gset1
mov R20,R16
.dbline -1
.dbline 197
; }
;
; void set_ref(uchar ev)//ev=0-63内部参考电压设置
; {
.dbline 198
; write_comm( 0x81 );
ldi R16,129
xcall _write_comm
.dbline 199
; write_comm( ev );
mov R16,R20
xcall _write_comm
.dbline -2
L25:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r ev 20 c
.dbend
.dbfunc e sel_LCD_bias _sel_LCD_bias fV
.even
_sel_LCD_bias::
.dbline -1
.dbline 203
; }
;
; void sel_LCD_bias(void)//设置偏压,bias=1/11
; {
.dbline 204
; write_comm( 0x57 );
ldi R16,87
xcall _write_comm
.dbline -2
L26:
.dbline 0 ; func end
ret
.dbend
.dbfunc e sel_shl _sel_shl fV
; shl -> R20
.even
_sel_shl::
xcall push_gset1
mov R20,R16
.dbline -1
.dbline 208
; }
;
; void sel_shl(uchar shl)//shl=0 normal;shl=1 reverse
; {
.dbline 209
; shl = shl<<3;
lsl R20
lsl R20
lsl R20
.dbline 210
; write_comm( 0xC0|shl );
mov R16,R20
ori R16,192
xcall _write_comm
.dbline -2
L27:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r shl 20 c
.dbend
.dbfunc e sel_adc _sel_adc fV
; adc -> R20
.even
_sel_adc::
xcall push_gset1
mov R20,R16
.dbline -1
.dbline 214
; }
;
; void sel_adc(uchar adc)//adc=0 normal;adc=1 reverse
; {
.dbline 215
; write_comm( 0xA0|adc );
mov R16,R20
ori R16,160
xcall _write_comm
.dbline -2
L28:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r adc 20 c
.dbend
.dbfunc e set_static_indicator _set_static_indicator fV
; s -> R20
; sm -> R22
.even
_set_static_indicator::
xcall push_gset2
mov R20,R18
mov R22,R16
.dbline -1
.dbline 219
; }
;
; void set_static_indicator(uchar sm,uchar s )//静态指令模式
; {
.dbline 220
; if (sm==0) s=0;
tst R22
brne L30
.dbline 220
clr R20
L30:
.dbline 221
; write_comm( 0xAC|sm );
mov R16,R22
ori R16,172
xcall _write_comm
.dbline 222
; write_comm( s );
mov R16,R20
xcall _write_comm
.dbline -2
L29:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r s 20 c
.dbsym r sm 22 c
.dbend
.dbfunc e osc_start _osc_start fV
.even
_osc_start::
.dbline -1
.dbline 226
; }
;
; void osc_start(void )//打开内部振荡器
; {
.dbline 227
; write_comm( 0xAB );
ldi R16,171
xcall _write_comm
.dbline -2
L32:
.dbline 0 ; func end
ret
.dbend
.dbfunc e lcd_reset _lcd_reset fV
.even
_lcd_reset::
.dbline -1
.dbline 231
; }
;
; void lcd_reset(void )//lcd复位
; {
.dbline 232
; write_comm( 0xE2 );
ldi R16,226
xcall _write_comm
.dbline -2
L33:
.dbline 0 ; func end
ret
.dbend
.dbfunc e lcd_power_save _lcd_power_save fV
; p -> R20
.even
_lcd_power_save::
xcall push_gset1
mov R20,R16
.dbline -1
.dbline 236
; }
;
; void lcd_power_save(uchar p)//P=1 sleep mode;p=0 standby
; {
.dbline 237
; write_comm( 0xA8|p );
mov R16,R20
ori R16,168
xcall _write_comm
.dbline -2
L34:
xcall pop_gset1
.dbline 0 ; func end
ret
.dbsym r p 20 c
.dbend
.dbfunc e lcd_rel_power_save _lcd_rel_power_save fV
.even
_lcd_rel_power_save::
.dbline -1
.dbline 241
; }
;
; void lcd_rel_power_save(void)
; {
.dbline 242
; write_comm( 0xE1 );
ldi R16,225
xcall _write_comm
.dbline -2
L35:
.dbline 0 ; func end
ret
.dbend
.dbfunc e lcd_clear _lcd_clear fV
; a -> R20
; b -> R22
.even
_lcd_clear::
xcall push_gset2
.dbline -1
.dbline 246
; }
;
; void lcd_clear(void)
; {
.dbline 248
; uchar a,b;
; for (a=0;a<14;a++)
clr R20
xjmp L40
L37:
.dbline 249
; { set_page_add( a );//set page
.dbline 249
mov R16,R20
xcall _set_page_add
.dbline 250
; set_column_add( 0 );
clr R16
xcall _set_column_add
.dbline 251
; for (b=0;b<160;b++)
clr R22
xjmp L44
L41:
.dbline 252
.dbline 252
clr R16
xcall _write_data
.dbline 252
L42:
.dbline 251
inc R22
L44:
.dbline 251
cpi R22,160
brlo L41
.dbline 253
L38:
.dbline 248
inc R20
L40:
.dbline 248
cpi R20,14
brlo L37
.dbline -2
L36:
xcall pop_gset2
.dbline 0 ; func end
ret
.dbsym r a 20 c
.dbsym r b 22 c
.dbend
.dbfunc e lcd_clear_part _lcd_clear_part fV
; i -> R20
; j -> R14
; h -> R22
; w -> R10
; add_y -> R12
; add_x -> y+10
.even
_lcd_clear_part::
xcall push_arg4
xcall push_gset5
mov R12,R18
ldd R10,y+14
ldd R22,y+16
.dbline -1
.dbline 257
; { write_data(0x00); }
; }
; }
;
; void lcd_clear_part(uchar add_x,uchar add_y,uchar w,uchar h)
; { uchar i,j;
.dbline 258
; for (i=0;i<h;i++)
clr R20
xjmp L49
L46:
.dbline 259
; { set_page_add(add_y);
.dbline 259
mov R16,R12
xcall _set_page_add
.dbline 260
; set_column_add(add_x);
ldd R16,y+10
xcall _set_column_add
.dbline 261
; for (j=0;j<w;j++)
clr R14
xjmp L53
L50:
.dbline 262
.dbline 262
clr R16
xcall _write_data
.dbline 263
L51:
.dbline 261
inc R14
L53:
.dbline 261
cp R14,R10
brlo L50
.dbline 264
inc R12
.dbline 265
L47:
.dbline 258
inc R20
L49:
.dbline 258
cp R20,R22
brlo L46
.dbline -2
L45:
xcall pop_gset5
adiw R28,4
.dbline 0 ; func end
ret
.dbsym r i 20 c
.dbsym r j 14 c
.dbsym r h 22 c
.dbsym r w 10 c
.dbsym r add_y 12 c
.dbsym l add_x 10 c
.dbend
.dbfunc e init_160104 _init_160104 fV
.even
_init_160104::
sbiw R28,1
.dbline -1
.dbline 269
; { write_data(0x00);
; }
; add_y++;
; }
; }
;
; void init_160104(void)
; {
.dbline 270
; DDRD = 0xff;
ldi R24,255
out 0x11,R24
.dbline 271
; delay_nms( 500 );
ldi R16,500
ldi R17,1
xcall _delay_nms
.dbline 272
; clr_RESET;
cbi 0x12,4
.dbline 273
; delay_nms(100);
ldi R16,100
ldi R17,0
xcall _delay_nms
.dbline 274
; set_RESET;
sbi 0x12,4
.dbline 275
; set_display_duty(105);//display duty select
ldi R16,105
xcall _set_display_duty
.dbline 276
; sel_adc( 0 );//adc select
clr R16
xcall _sel_adc
.dbline 277
; sel_shl( 1 );//shl select
ldi R16,1
xcall _sel_shl
.dbline 278
; set_com0( 0 );//com0 register select
clr R16
xcall _set_com0
.dbline 279
; osc_start();//oscillator on
xcall _osc_start
.dbline 280
; dc_setup();//DC-DC Step-up Register Select,6times boosting
xcall _dc_setup
.dbline 281
; power_control( 1, 0, 0 );//VC on
clr R2
std y+0,R2
clr R18
ldi R16,1
xcall _power_control
.dbline 282
; delay_nms(30);//delay 30ms
ldi R16,30
ldi R17,0
xcall _delay_nms
.dbline 283
; resistor_sel(7);//Regulator Resistor Select
ldi R16,7
xcall _resistor_sel
.dbline 284
; set_ref(63);//Electronic Volume Register Select
ldi R16,63
xcall _set_ref
.dbline 285
; power_control( 1, 1, 0 );//VR on
clr R2
std y+0,R2
ldi R18,1
ldi R16,1
xcall _power_control
.dbline 286
; delay_nms(5);//delay 5ms
ldi R16,5
ldi R17,0
xcall _delay_nms
.dbline 287
; sel_LCD_bias();//设置偏压//LCD Bias Register Select
xcall _sel_LCD_bias
.dbline 288
; power_control( 1, 1, 1 );//VF on
ldi R24,1
std y+0,R24
ldi R18,1
ldi R16,1
xcall _power_control
.dbline 289
; delay_nms(40);//delay 40ms
ldi R16,40
ldi R17,0
xcall _delay_nms
.dbline 291
;
; display_on(1);//开显示
ldi R16,1
xcall _display_on
.dbline 292
; set_init_line(0);
clr R16
xcall _set_init_line
.dbline 293
; lcd_clear();//清屏
xcall _lcd_clear
.dbline 294
; resistor_sel(5);
ldi R16,5
xcall _resistor_sel
.dbline 295
; set_ref(40);
ldi R16,40
xcall _set_ref
.dbline -2
L54:
adiw R28,1
.dbline 0 ; func end
ret
.dbend
.dbfunc e wri_asc_8x16_s _wri_asc_8x16_s fV
; P -> R20,R21
; i -> R22
; ascii_s -> R10,R11
; add_y -> R20
; add_x -> R12
.even
_wri_asc_8x16_s::
xcall push_gset4
mov R20,R18
mov R12,R16
sbiw R28,6
ldd R10,y+14
ldd R11,y+15
.dbline -1
.dbline 303
; }
;
; /*======================================
; 显示ascii码字符串
; add_x 0-13 add_y 0-159
; ======================================*/
; void wri_asc_8x16_s(uchar add_x,uchar add_y,uchar *ascii_s)
; { uchar i=0;
.dbline 303
clr R22
.dbline 305
; uchar const *P;
; lcd_currentX = add_x;
sts _lcd_currentX,R12
.dbline 306
; lcd_currentY = add_y;
sts _lcd_currentY,R20
xjmp L57
L56:
.dbline 308
; while (*ascii_s != 0)
; { i=0;
.dbline 308
clr R22
xjmp L60
L59:
.dbline 310
; while(i != ASCII_8x16_NUMBER)//查找字模
; {
.dbline 311
; if(*ascii_s == ascii_8x16_code[i])
ldi R24,<_ascii_8x16_code
ldi R25,>_ascii_8x16_code
mov R30,R22
clr R31
add R30,R24
adc R31,R25
lpm R30,Z
movw R26,R10
ld R2,x
cp R2,R30
brne L62
.dbline 312
; break;
xjmp L61
L62:
.dbline 313
inc R22
.dbline 314
L60:
.dbline 309
cpi R22,94
brne L59
L61:
.dbline 315
ldi R24,16
mul R24,R22
movw R20,R0
ldi R24,<_ascii_8x16_dot
ldi R25,>_ascii_8x16_dot
add R20,R24
adc R21,R25
.dbline 316
std y+5,R21
std y+4,R20
ldi R24,2
ldi R25,0
std y+3,R25
std y+2,R24
ldi R24,8
std y+1,R25
std y+0,R24
lds R18,_lcd_currentY
clr R19
lds R16,_lcd_currentX
clr R17
xcall _wri_image
.dbline 317
lds R24,_lcd_currentX
subi R24,248 ; addi 8
sts _lcd_currentX,R24
.dbline 318
movw R24,R10
adiw R24,1
movw R10,R24
.dbline 319
L57:
.dbline 307
movw R30,R10
ldd R2,z+0
tst R2
breq X0
xjmp L56
X0:
.dbline -2
L55:
adiw R28,6
xcall pop_gset4
.dbline 0 ; func end
ret
.dbsym r P 20 pkc
.dbsym r i 22 c
.dbsym r ascii_s 10 pc
.dbsym r add_y 20 c
.dbsym r add_x 12 c
.dbend
.dbfunc e wri_chinese_s _wri_chinese_s fV
; P -> R20,R21
; hz -> R12,R13
; i -> R22
; chinese_s -> R10,R11
; add_y -> R20
; add_x -> R12
.even
_wri_chinese_s::
xcall push_gset4
mov R20,R18
mov R12,R16
sbiw R28,6
ldd R10,y+14
ldd R11,y+15
.dbline -1
.dbline 327
; i++;
; }
; P = ascii_8x16_dot +i*16;
; wri_image(lcd_currentX,lcd_currentY,8,2,P);
; lcd_currentX+=8;
; ascii_s++;
; }
; }
;
; /*======================================
; 显示汉字(16x16)字符串
; add_x 0-159 add_y 0-13
; ======================================*/
; void wri_chinese_s(uchar add_x,uchar add_y,uchar *chinese_s)
; { uchar i=0;
.dbline 327
clr R22
.dbline 331
; uchar const *P;
; uint hz;
;
; lcd_currentX = add_x;
sts _lcd_currentX,R12
.dbline 332
; lcd_currentY = add_y;
sts _lcd_currentY,R20
xjmp L66
L65:
.dbline 335
;
; while (*chinese_s != 0)
; { i=0;
.dbline 335
clr R22
.dbline 336
; hz=*chinese_s;
movw R30,R10
ldd R12,z+0
clr R13
.dbline 337
; chinese_s++;
movw R24,R30
adiw R24,1
movw R10,R24
.dbline 338
; hz= (hz<<8)+*chinese_s;
movw R30,R24
ldd R2,z+0
mov R13,R12
mov R12,R2
xjmp L69
L68:
.dbline 340
; while(i != CHINESE_CHAR_NUMBER)//查找字模
; {
.dbline 341
; if(hz == chinese_16x16_code[i])
ldi R24,2
mul R24,R22
movw R30,R0
ldi R24,<_chinese_16x16_code
ldi R25,>_chinese_16x16_code
add R30,R24
adc R31,R25
lpm R0,Z+
lpm R1,Z
movw R30,R0
cp R12,R30
cpc R13,R31
brne L71
.dbline 342
; break;
xjmp L70
L71:
.dbline 343
inc R22
.dbline 344
L69:
.dbline 339
cpi R22,23
brne L68
L70:
.dbline 345
ldi R24,32
mul R24,R22
movw R20,R0
ldi R24,<_chinese_16x16_dot
ldi R25,>_chinese_16x16_dot
add R20,R24
adc R21,R25
.dbline 346
std y+5,R21
std y+4,R20
ldi R24,2
ldi R25,0
std y+3,R25
std y+2,R24
ldi R24,16
std y+1,R25
std y+0,R24
lds R18,_lcd_currentY
clr R19
lds R16,_lcd_currentX
clr R17
xcall _wri_image
.dbline 347
lds R24,_lcd_currentX
subi R24,240 ; addi 16
sts _lcd_currentX,R24
.dbline 348
movw R24,R10
adiw R24,1
movw R10,R24
.dbline 349
L66:
.dbline 334
movw R30,R10
ldd R2,z+0
tst R2
breq X1
xjmp L65
X1:
.dbline -2
L64:
adiw R28,6
xcall pop_gset4
.dbline 0 ; func end
ret
.dbsym r P 20 pkc
.dbsym r hz 12 i
.dbsym r i 22 c
.dbsym r chinese_s 10 pc
.dbsym r add_y 20 c
.dbsym r add_x 12 c
.dbend
.dbfunc e wri_asc_4x8_s _wri_asc_4x8_s fV
; P -> R20,R21
; i -> R22
; ascii_s -> R10,R11
; add_y -> R20
; add_x -> R12
.even
_wri_asc_4x8_s::
xcall push_gset4
mov R20,R18
mov R12,R16
sbiw R28,6
ldd R10,y+14
ldd R11,y+15
.dbline -1
.dbline 353
; i++;
; }
; P = chinese_16x16_dot +i*32;
; wri_image(lcd_currentX,lcd_currentY,16,2,P);
; lcd_currentX+=16;
; chinese_s++;
; }
; }
;
; void wri_asc_4x8_s(uchar add_x,uchar add_y,uchar *ascii_s)
; { uchar i=0;
.dbline 353
clr R22
.dbline 355
; uchar const *P;
; lcd_currentX = add_x;
sts _lcd_currentX,R12
.dbline 356
; lcd_currentY = add_y;
sts _lcd_currentY,R20
xjmp L75
L74:
.dbline 358
.dbline 358
movw R30,R10
ldd R22,z+0
subi R22,48
.dbline 359
ldi R24,4
mul R24,R22
movw R20,R0
ldi R24,<_ascii_4x8_dot
ldi R25,>_ascii_4x8_dot
add R20,R24
adc R21,R25
.dbline 360
std y+5,R21
std y+4,R20
ldi R24,1
ldi R25,0
std y+3,R25
std y+2,R24
ldi R24,4
std y+1,R25
std y+0,R24
lds R18,_lcd_currentY
clr R19
lds R16,_lcd_currentX
clr R17
xcall _wri_image
.dbline 361
lds R24,_lcd_currentX
subi R24,252 ; addi 4
sts _lcd_currentX,R24
.dbline 362
movw R24,R10
adiw R24,1
movw R10,R24
.dbline 363
L75:
.dbline 357
; while (*ascii_s != 0)
movw R30,R10
ldd R2,z+0
tst R2
brne L74
.dbline -2
L73:
adiw R28,6
xcall pop_gset4
.dbline 0 ; func end
ret
.dbsym r P 20 pkc
.dbsym r i 22 c
.dbsym r ascii_s 10 pc
.dbsym r add_y 20 c
.dbsym r add_x 12 c
.dbend
.dbfunc e wri_image _wri_image fV
; i -> R20
; j -> R14
; data -> R22,R23
; h -> R10
; w -> R12
; add_y -> y+12
; add_x -> y+10
.even
_wri_image::
xcall push_arg4
xcall push_gset5
ldd R12,y+14
ldd R10,y+16
ldd R22,y+18
ldd R23,y+19
.dbline -1
.dbline 372
; { i = *ascii_s-48;
; P = ascii_4x8_dot +i*4;
; wri_image(lcd_currentX,lcd_currentY,4,1,P);
; lcd_currentX+=4;
; ascii_s++;
; }
; }
;
; /*======================================
; add_x 0-159列地址; add_y 0-13页地址;
; w 宽度,像素为单位; h 显示高度,字节为单位;
; *data 显示数据;
; =======================================*/
; void wri_image(uchar add_x,uchar add_y,uchar w,uchar h,const uchar *data)
; { uchar i,j;
.dbline 373
; for (i=0;i<h;i++)
clr R20
xjmp L81
L78:
.dbline 374
; { set_page_add(add_y);
.dbline 374
ldd R16,y+12
xcall _set_page_add
.dbline 375
; set_column_add(add_x);
ldd R16,y+10
xcall _set_column_add
.dbline 376
; for (j=0;j<w;j++)
clr R14
xjmp L85
L82:
.dbline 377
.dbline 377
movw R30,R22
lpm R16,Z
xcall _write_data
.dbline 378
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -