📄 ks0108_12864lcd.lis
字号:
0318 .dbfunc s LCD_Set_XY _LCD_Set_XY fV
0318 ; Y -> R20
0318 ; X -> R22
.even
0318 _LCD_Set_XY:
0318 4A93 st -y,R20
031A 6A93 st -y,R22
031C 422F mov R20,R18
031E 602F mov R22,R16
0320 2197 sbiw R28,1
0322 .dbline -1
0322 .dbline 303
0322 ; }
0322 ;
0322 ; /*----------------------------------------------------------------------------*-
0322 ;
0322 ; LCD_Set_XY()
0322 ;
0322 ; Set the DDRAM to a particular address.
0322 ;
0322 ; Used to determine where we write to in the LCD RAM and - thus -
0322 ; whether the text appears on Page 0, page 1, Column 0, Column 1, etc.
0322 ;
0322 ; Params (X, Y) : The DDRAM address we wish to write to.
0322 ;
0322 ; X range : (Page 0 ~ Page 7), Y range : (0 ~ 127)
0322 ;
0322 ; -*----------------------------------------------------------------------------*/
0322 ; static void LCD_Set_XY(uInt8 X, uInt8 Y)
0322 ; {
0322 .dbline 304
0322 ; if (Y >= 64)
0322 4034 cpi R20,64
0324 80F0 brlo L62
0326 X17:
0326 .dbline 305
0326 ; {
0326 .dbline 306
0326 ; LCD_INSTR_PORT &= ~LCD_CS1; // Select right side
0326 9498 cbi 0x12,4
0328 .dbline 307
0328 ; LCD_INSTR_PORT |= LCD_CS2;
0328 959A sbi 0x12,5
032A .dbline 308
032A ; LCD_Send_Byte((DISPLAY_PAGE_SET + X), COMMAND, NORMAL); // Set page
032A 2224 clr R2
032C 2882 std y+0,R2
032E 2227 clr R18
0330 062F mov R16,R22
0332 0854 subi R16,72 ; addi 184
0334 CFDF xcall _LCD_Send_Byte
0336 .dbline 309
0336 ; LCD_Send_Byte((DISPLAY_COLUMN_SET + Y - 64), COMMAND, NORMAL); // Set column
0336 2224 clr R2
0338 2882 std y+0,R2
033A 2227 clr R18
033C 042F mov R16,R20
033E 005C subi R16,192 ; addi 64
0340 0054 subi R16,64
0342 C8DF xcall _LCD_Send_Byte
0344 .dbline 310
0344 ; }
0344 0EC0 xjmp L63
0346 L62:
0346 .dbline 312
0346 ; else
0346 ; {
0346 .dbline 313
0346 ; LCD_INSTR_PORT |= LCD_CS1; // Select left side
0346 949A sbi 0x12,4
0348 .dbline 314
0348 ; LCD_INSTR_PORT &= ~LCD_CS2;
0348 9598 cbi 0x12,5
034A .dbline 315
034A ; LCD_Send_Byte((DISPLAY_PAGE_SET + X), COMMAND, NORMAL); // Set page
034A 2224 clr R2
034C 2882 std y+0,R2
034E 2227 clr R18
0350 062F mov R16,R22
0352 0854 subi R16,72 ; addi 184
0354 BFDF xcall _LCD_Send_Byte
0356 .dbline 316
0356 ; LCD_Send_Byte((DISPLAY_COLUMN_SET + Y), COMMAND, NORMAL); // Set column
0356 2224 clr R2
0358 2882 std y+0,R2
035A 2227 clr R18
035C 042F mov R16,R20
035E 005C subi R16,192 ; addi 64
0360 B9DF xcall _LCD_Send_Byte
0362 .dbline 317
0362 ; }
0362 L63:
0362 .dbline -2
0362 L61:
0362 .dbline 0 ; func end
0362 2196 adiw R28,1
0364 6991 ld R22,y+
0366 4991 ld R20,y+
0368 0895 ret
036A .dbsym r Y 20 c
036A .dbsym r X 22 c
036A .dbend
036A .dbfunc s LCD_Disp_a_Char _LCD_Disp_a_Char fV
036A ; cl -> R20
036A ; Video_Mode -> y+11
036A ; Char_Value -> R22
036A ; Y -> R10
036A ; X -> R12
.even
036A _LCD_Disp_a_Char:
036A 0E940000 xcall push_xgsetF03C
036E A22E mov R10,R18
0370 C02E mov R12,R16
0372 2197 sbiw R28,1
0374 6985 ldd R22,y+9
0376 .dbline -1
0376 .dbline 343
0376 ; }
0376 ;
0376 ; /*----------------------------------------------------------------------------*-
0376 ;
0376 ; LCD_Disp_a_Char()
0376 ;
0376 ; Used to determine where we want to dispaly a char on the LCD panel
0376 ; and - thus - whether the text appears on Page 0, page 1, Column 0,
0376 ; Column 1, etc.
0376 ;
0376 ; Parameters:
0376 ; ---------------------------------------------------------------------------
0376 ; X : range (Page 0 ~ Page 7)
0376 ; Y : range (0 ~ 127)
0376 ; Params (X, Y) : The DDRAM address we wish to write to.
0376 ;
0376 ; Char_Value : The character value which's going to be displayed
0376 ; on the LCD panel
0376 ;
0376 ; Video_Mode : If Video_Mode == INVERSE(1), inverse video mode
0376 ; If Video_Mode == NORMAL(0), normal video mode
0376 ;
0376 ; -*----------------------------------------------------------------------------*/
0376 ; static void LCD_Disp_a_Char(uInt8 X, uInt8 Y, uInt8 Char_Value,
0376 ; uInt8 Video_Mode)
0376 ; {
0376 .dbline 348
0376 ; uInt8 cl;
0376 ;
0376 ; // Fine the char in the lookup table
0376 ; // See "FONT6x8.C" for details
0376 ; Char_Value -= 32;
0376 6052 subi R22,32
0378 .dbline 350
0378 ;
0378 ; for (cl = 0; cl < 6; cl++)
0378 4427 clr R20
037A 15C0 xjmp L68
037C L65:
037C .dbline 351
037C ; {
037C .dbline 352
037C ; LCD_Set_XY(X, Y + cl);
037C 2A2D mov R18,R10
037E 240F add R18,R20
0380 0C2D mov R16,R12
0382 CADF xcall _LCD_Set_XY
0384 .dbline 353
0384 ; LCD_Send_Byte(FONT6x8[Char_Value][cl], D_DATA, Video_Mode);
0384 0B84 ldd R0,y+11
0386 0882 std y+0,R0
0388 21E0 ldi R18,1
038A 86E0 ldi R24,6
038C 869F mul R24,R22
038E 1001 movw R2,R0
0390 80E0 ldi R24,<_FONT6x8
0392 90E0 ldi R25,>_FONT6x8
0394 280E add R2,R24
0396 391E adc R3,R25
0398 E42F mov R30,R20
039A FF27 clr R31
039C E20D add R30,R2
039E F31D adc R31,R3
03A0 0491 lpm R16,Z
03A2 98DF xcall _LCD_Send_Byte
03A4 .dbline 354
03A4 ; }
03A4 L66:
03A4 .dbline 350
03A4 4395 inc R20
03A6 L68:
03A6 .dbline 350
03A6 4630 cpi R20,6
03A8 48F3 brlo L65
03AA X18:
03AA .dbline -2
03AA L64:
03AA .dbline 0 ; func end
03AA 2196 adiw R28,1
03AC 0C940000 xjmp pop_xgsetF03C
03B0 .dbsym r cl 20 c
03B0 .dbsym l Video_Mode 11 c
03B0 .dbsym r Char_Value 22 c
03B0 .dbsym r Y 10 c
03B0 .dbsym r X 12 c
03B0 .dbend
03B0 .dbfunc s LCD_Disp_String _LCD_Disp_String fV
03B0 ; Video_Mode -> y+11
03B0 ; pString -> R20,R21
03B0 ; Y -> R22
03B0 ; X -> R10
.even
03B0 _LCD_Disp_String:
03B0 0E940000 xcall push_xgsetF00C
03B4 622F mov R22,R18
03B6 A02E mov R10,R16
03B8 2397 sbiw R28,3
03BA 4985 ldd R20,y+9
03BC 5A85 ldd R21,y+10
03BE .dbline -1
03BE .dbline 380
03BE ; }
03BE ;
03BE ; /*----------------------------------------------------------------------------*-
03BE ;
03BE ; LCD_Disp_String()
03BE ;
03BE ; Used to determine where we want to dispaly a string on the LCD panel
03BE ; and - thus - whether the text appears on Page 0, page 1, Column 0,
03BE ; Column 1, etc.
03BE ;
03BE ; Parameters:
03BE ; ---------------------------------------------------------------------------
03BE ; X : range (Page 0 ~ Page 7)
03BE ; Y : range (0 ~ 127)
03BE ; Params (X, Y) : The DDRAM address we wish to write to.
03BE ;
03BE ; pString : The string pointer point out the string which's going to
03BE ; be displayed on the LCD panel
03BE ;
03BE ; Video_Mode : If Video_Mode == INVERSE(1), inverse video mode
03BE ; If Video_Mode == NORMAL(0), normal video mode
03BE ;
03BE ; -*----------------------------------------------------------------------------*/
03BE ; static void LCD_Disp_String(uInt8 X, uInt8 Y, flash uInt8 * pString,
03BE ; uInt8 Video_Mode)
03BE ; {
03BE 0BC0 xjmp L71
03C0 L70:
03C0 .dbline 382
03C0 ; while (* pString)
03C0 ; {
03C0 .dbline 383
03C0 ; LCD_Disp_a_Char(X, Y, * pString, Video_Mode);
03C0 0B84 ldd R0,y+11
03C2 0A82 std y+2,R0
03C4 FA01 movw R30,R20
03C6 2490 lpm R2,Z
03C8 2882 std y+0,R2
03CA 262F mov R18,R22
03CC 0A2D mov R16,R10
03CE CDDF xcall _LCD_Disp_a_Char
03D0 .dbline 384
03D0 ; Y += 6; // Characters are 6x8 pixel
03D0 6A5F subi R22,250 ; addi 6
03D2 .dbline 385
03D2 ; pString++;
03D2 4F5F subi R20,255 ; offset = 1
03D4 5F4F sbci R21,255
03D6 .dbline 386
03D6 ; }
03D6 L71:
03D6 .dbline 381
03D6 FA01 movw R30,R20
03D8 2490 lpm R2,Z
03DA 2220 tst R2
03DC 89F7 brne L70
03DE X19:
03DE .dbline -2
03DE L69:
03DE .dbline 0 ; func end
03DE 2396 adiw R28,3
03E0 0C940000 xjmp pop_xgsetF00C
03E4 .dbsym l Video_Mode 11 c
03E4 .dbsym r pString 20 pkc
03E4 .dbsym r Y 22 c
03E4 .dbsym r X 10 c
03E4 .dbend
03E4 .dbfunc s LCD_Disp_Chinese_String _LCD_Disp_Chinese_String fV
03E4 ; nm -> R10
03E4 ; cl -> R22
03E4 ; Video_Mode -> y+21
03E4 ; pCN_String -> y+19
03E4 ; Char_Gap -> y+17
03E4 ; Start_Char -> y+15
03E4 ; Char_Amount -> y+13
03E4 ; Char_Length -> R12
03E4 ; Y -> R14
03E4 ; X -> R20
.even
03E4 _LCD_Disp_Chinese_String:
03E4 0E940000 xcall push_xgsetF0FC
03E8 E22E mov R14,R18
03EA 402F mov R20,R16
03EC 2197 sbiw R28,1
03EE CB84 ldd R12,y+11
03F0 .dbline -1
03F0 .dbline 413
03F0 ; }
03F0 ;
03F0 ; /*----------------------------------------------------------------------------*-
03F0 ;
03F0 ; LCD_Disp_Chinese_String()
03F0 ;
03F0 ; Display a Chinese String on the LCD panel.
03F0 ;
03F0 ; Parameters:
03F0 ; ---------------------------------------------------------------------------
03F0 ; X, Y : The Chinese String start coordinates on the LCD panel
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -