⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ks0108_12864lcd.s

📁 ks0108 avr单片机1284显示
💻 S
📖 第 1 页 / 共 3 页
字号:
	xjmp pop_xgsetF03C
	.dbsym r cl 20 c
	.dbsym l Video_Mode 11 c
	.dbsym r Char_Value 22 c
	.dbsym r Y 10 c
	.dbsym r X 12 c
	.dbend
	.dbfunc s LCD_Disp_String _LCD_Disp_String fV
;     Video_Mode -> y+11
;        pString -> R20,R21
;              Y -> R22
;              X -> R10
	.even
_LCD_Disp_String:
	xcall push_xgsetF00C
	mov R22,R18
	mov R10,R16
	sbiw R28,3
	ldd R20,y+9
	ldd R21,y+10
	.dbline -1
	.dbline 380
;    }
; 
; /*----------------------------------------------------------------------------*-
;    
;    LCD_Disp_String()
; 
;    Used to determine where we want to dispaly a string on the LCD panel 
;    and - thus - whether the text appears on Page 0, page 1, Column 0, 
;    Column 1, etc.
; 
;    Parameters: 
;    ---------------------------------------------------------------------------
;    X : range (Page 0 ~ Page 7)    
;    Y : range (0 ~ 127)
;    Params (X, Y) : The DDRAM address we wish to write to.
; 
;    pString    : The string pointer point out the string which's going to 
;                 be displayed on the LCD panel
; 
;    Video_Mode : If Video_Mode == INVERSE(1), inverse video mode			   
;                 If Video_Mode == NORMAL(0), normal video mode
; 				   		
; -*----------------------------------------------------------------------------*/
; static void LCD_Disp_String(uInt8 X, uInt8 Y, flash uInt8 * pString, 
;                             uInt8 Video_Mode)
;    {
	xjmp L71
L70:
	.dbline 382
;    while (* pString) 
;       {
	.dbline 383
;       LCD_Disp_a_Char(X, Y, * pString, Video_Mode);
	ldd R0,y+11
	std y+2,R0
	movw R30,R20
	lpm R2,Z
	std y+0,R2
	mov R18,R22
	mov R16,R10
	xcall _LCD_Disp_a_Char
	.dbline 384
; 	  Y += 6; // Characters are 6x8 pixel
	subi R22,250    ; addi 6
	.dbline 385
; 	  pString++;	  
	subi R20,255  ; offset = 1
	sbci R21,255
	.dbline 386
;       }
L71:
	.dbline 381
	movw R30,R20
	lpm R2,Z
	tst R2
	brne L70
X19:
	.dbline -2
L69:
	.dbline 0 ; func end
	adiw R28,3
	xjmp pop_xgsetF00C
	.dbsym l Video_Mode 11 c
	.dbsym r pString 20 pkc
	.dbsym r Y 22 c
	.dbsym r X 10 c
	.dbend
	.dbfunc s LCD_Disp_Chinese_String _LCD_Disp_Chinese_String fV
;             nm -> R10
;             cl -> R22
;     Video_Mode -> y+21
;     pCN_String -> y+19
;       Char_Gap -> y+17
;     Start_Char -> y+15
;    Char_Amount -> y+13
;    Char_Length -> R12
;              Y -> R14
;              X -> R20
	.even
_LCD_Disp_Chinese_String:
	xcall push_xgsetF0FC
	mov R14,R18
	mov R20,R16
	sbiw R28,1
	ldd R12,y+11
	.dbline -1
	.dbline 413
;    }   
; 
; /*----------------------------------------------------------------------------*-
; 
;    LCD_Disp_Chinese_String()
;   
;    Display a Chinese String on the LCD panel.
;   
;    Parameters: 
;    ---------------------------------------------------------------------------
;    X, Y        : The Chinese String start coordinates on the LCD panel
;     
;    Char_Length : The Chinese character's length (in pixel)
;    Char_Amount : The amount of Chinese characters 
;    Start_Char  : Which Chinese character should be display first in the array
;    Char_Gap    : The space between on characters to another (in pixel)
;    
;    Video_Mode  : If Video_Mode == INVERSE(1), inverse video mode			   
;                  If Video_Mode == NORMAL(0), normal video mode
; 	
; -*----------------------------------------------------------------------------*/                        
; static void LCD_Disp_Chinese_String (uInt8 X, uInt8 Y, 
;                                      uInt8 Char_Length, uInt8 Char_Amount,
;                                      uInt8 Start_Char, uInt8 Char_Gap,
; 									 flash uInt8 (* pCN_String)[32], 
; 									 uInt8 Video_Mode)
;    {
	.dbline 416
;    uInt8 cl, nm; 
;     
;    for (nm = 0; nm < Char_Amount; )
	clr R10
	xjmp L77
L74:
	.dbline 417
;       {
	.dbline 418
;       for (cl = 0; cl < Char_Length * 2; cl++) // Send a Chinese character
	clr R22
	xjmp L81
L78:
	.dbline 419
;          { 
	.dbline 420
;       	 if (cl >= Char_Length)  
	cp R22,R12
	brlo L82
X20:
	.dbline 421
;             { 
	.dbline 423
; 			// Send below part of a Chinese character
; 			LCD_Set_XY(X + 1, Y + cl - Char_Length);
	mov R18,R14
	add R18,R22
	sub R18,R12
	mov R16,R20
	subi R16,255    ; addi 1
	xcall _LCD_Set_XY
	.dbline 424
; 			}
	xjmp L83
L82:
	.dbline 426
;          else
; 		    {
	.dbline 428
; 		    // Set coordinates    
;             LCD_Set_XY(X, Y + cl);
	mov R18,R14
	add R18,R22
	mov R16,R20
	xcall _LCD_Set_XY
	.dbline 429
; 			}
L83:
	.dbline 431
;  
;       	 LCD_Send_Byte(* (* (pCN_String + Start_Char + nm)+ cl), 
	ldd R0,y+21
	std y+0,R0
	ldi R18,1
	ldi R24,32
	ldd R0,y+15
	mul R24,R0
	movw R2,R0
	ldd R0,y+19
	ldd R1,y+20
	add R2,R0
	adc R3,R1
	mul R24,R10
	movw R4,R0
	add R4,R2
	adc R5,R3
	mov R30,R22
	clr R31
	add R30,R4
	adc R31,R5
	lpm R16,Z
	xcall _LCD_Send_Byte
	.dbline 433
; 		                     D_DATA, Video_Mode);
;          }      
L79:
	.dbline 418
	inc R22
L81:
	.dbline 418
	mov R2,R12
	lsl R2
	cp R22,R2
	brlo L78
X21:
	.dbline 434
; 	  Y = Y + Char_Length + Char_Gap;
	mov R2,R14
	add R2,R12
	ldd R0,y+17
	add R2,R0
	mov R14,R2
	.dbline 435
; 	  nm++;
	inc R10
	.dbline 436
;       }
L75:
	.dbline 416
L77:
	.dbline 416
	ldd R0,y+13
	cp R10,R0
	brlo L74
X22:
	.dbline -2
L73:
	.dbline 0 ; func end
	adiw R28,1
	xjmp pop_xgsetF0FC
	.dbsym r nm 10 c
	.dbsym r cl 22 c
	.dbsym l Video_Mode 21 c
	.dbsym l pCN_String 19 pA[32:32]kc
	.dbsym l Char_Gap 17 c
	.dbsym l Start_Char 15 c
	.dbsym l Char_Amount 13 c
	.dbsym r Char_Length 12 c
	.dbsym r Y 14 c
	.dbsym r X 20 c
	.dbend
	.dbfunc s LCD_Disp_an_Image _LCD_Disp_an_Image fV
;           Page -> R20
;             pg -> R10
;             cl -> R14
;     Video_Mode -> y+21
;        Pixel_Y -> R12
;        Pixel_X -> R10
;         pImage -> y+15
;              Y -> R22
;              X -> y+11
	.even
_LCD_Disp_an_Image:
	xcall push_arg4
	xcall push_xgsetF0FC
	mov R22,R18
	sbiw R28,1
	ldd R10,y+17
	ldd R12,y+19
	.dbline -1
	.dbline 462
;    }
; 
; /*----------------------------------------------------------------------------*-
; 
;    LCD_Disp_an_Image() 
; 
;    Display an Image on the LCD panel.
; 
;    Parameters: 
;    ---------------------------------------------------------------------------
;    X, Y             : The Image start coordinates on the LCD panel
;     
;    pImage           : Image data pointer (Image stored in Flash area)
; 
;    pixel_X, pixel_Y : The Image's size
;    
;                       Pixel_X, the height of the Image (in pixel)
; 					  Pixel_Y, the length of the Image (in pixel)
; 					  
;    Video_Mode : If Video_Mode == INVERSE(1), inverse video mode			   
;                 If Video_Mode == NORMAL(0), normal video mode
; 
; -*----------------------------------------------------------------------------*/
; static void LCD_Disp_an_Image(uInt8 X, uInt8 Y, flash uInt8 * pImage,
;                               uInt8 Pixel_X, uInt8 Pixel_Y, uInt8 Video_Mode)
;    {   
	.dbline 468
;    uInt8 cl, pg;
;    uInt8 Page;
;    
;    // Figure out needs how many Pages
;    // to display the Image  
;    if (Pixel_X % 8 == 0) 
	ldi R17,8
	mov R16,R10
	xcall mod8u
	tst R16
	brne L85
X23:
	.dbline 469
;       Page = Pixel_X / 8;   
	mov R20,R10
	lsr R20
	lsr R20
	lsr R20
	xjmp L86
L85:
	.dbline 471
;    else
;       Page = Pixel_X / 8 + 1;  
	mov R20,R10
	lsr R20
	lsr R20
	lsr R20
	subi R20,255    ; addi 1
L86:
	.dbline 474
;       
;    // Now send the Image
;    for (pg = 0; pg < Page; pg++)
	clr R10
	xjmp L90
L87:
	.dbline 475
;       {  
	.dbline 477
; 	  // Send Image data
;       for(cl = 0; cl < Pixel_Y; cl++)
	clr R14
	xjmp L94
L91:
	.dbline 478
;          {
	.dbline 480
; 		 // Set coordinates
;          LCD_Set_XY(X + pg, Y + cl);
	mov R18,R22
	add R18,R14
	ldd R16,y+11
	add R16,R10
	xcall _LCD_Set_XY
	.dbline 482
; 		 	 
;          LCD_Send_Byte(pImage[cl + Pixel_Y * pg], D_DATA, Video_Mode);
	ldd R0,y+21
	std y+0,R0
	ldi R18,1
	mul R12,R10
	mov R30,R14
	clr R31
	add R30,R0
	adc R31,R1
	ldd R0,y+15
	ldd R1,y+16
	add R30,R0
	adc R31,R1
	lpm R16,Z
	xcall _LCD_Send_Byte
	.dbline 483
;          }                       
L92:
	.dbline 477
	inc R14
L94:
	.dbline 477
	cp R14,R12
	brlo L91
X24:
	.dbline 484
;       }      
L88:
	.dbline 474
	inc R10
L90:
	.dbline 474
	cp R10,R20
	brlo L87
X25:
	.dbline -2
L84:
	.dbline 0 ; func end
	adiw R28,1
	xcall pop_xgsetF0FC
	adiw R28,4
	ret
	.dbsym r Page 20 c
	.dbsym r pg 10 c
	.dbsym r cl 14 c
	.dbsym l Video_Mode 21 c
	.dbsym r Pixel_Y 12 c
	.dbsym r Pixel_X 10 c
	.dbsym l pImage 15 pkc
	.dbsym r Y 22 c
	.dbsym l X 11 c
	.dbend
	.dbfunc s LCD_Draw_a_Dot _LCD_Draw_a_Dot fV
;           Page -> R12
; Which_Bit_Should_be_Lit -> R10
;     Video_Mode -> y+7
;              Y -> R14
;              X -> R10
	.even
_LCD_Draw_a_Dot:
	xcall push_xgset00FC
	mov R14,R18
	mov R10,R16
	sbiw R28,1
	.dbline -1
	.dbline 501
;    }
;    
; /*----------------------------------------------------------------------------*-
; 
;    LCD_Draw_a_Dot() 
; 
;    Draw a dot (one pixel) on specific location of the LCD panel.
; 
;    Parameters: 
;    ---------------------------------------------------------------------------
;    X, Y             : The dot location on the LCD panel
;    
;    X range : (0 ~ 63), Y range : (0 ~ 127) 
; 
; -*----------------------------------------------------------------------------*/
; static void LCD_Draw_a_Dot(uInt8 X, uInt8 Y, uInt8 Video_Mode)
;    {   
	.dbline 505
;    uInt8 Page, Which_Bit_Should_be_Lit;
;    
;    // Figure out which Page the dot locate  
;    Page = X / 8;
	mov R12,R10
	lsr R12
	lsr R12
	lsr R12
	.dbline 508
;    
;    // Find which bit of the data should be lit up
;    Which_Bit_Should_be_Lit = (1 << (X % 8)); 
	ldi R17,8
	mov R16,R10
	xcall mod8u
	mov R17,R16
	ldi R16,1
	xcall lsl8
	mov R10,R16
	.dbline 510
;    
;    LCD_Set_XY(Page, Y);
	mov R18,R14
	mov R16,R12
	xcall _LCD_Set_XY
	.dbline 512
;  
;    LCD_DATA_PORT = 0xFF;  
	ldi R24,255
	out 0x1b,R24
	.dbline 513
;    LCD_DATA_PORT_DIR = INPUT; // Set data PORT direction
	clr R2
	out 0x1a,R2
	.dbline 515
; 
;    LCD_INSTR_PORT |=  LCD_DI; // Set data
	sbi 0x12,0
	.dbline 516
;    LCD_INSTR_PORT |=  LCD_RW; // Set read
	sbi 0x12,1
	.dbline 518
;    
;    LCD_INSTR_PORT |=  LCD_EN;
	sbi 0x12,2
	.dbline 519
;    asm("nop");	
	nop
	.dbline 520
;    asm("nop");
	nop
	.dbline 522
;     
;    LCD_INSTR_PORT &= ~LCD_EN; // Toggle enable
	cbi 0x12,2
	.dbline 523
;    asm("nop");	
	nop
	.dbline 524
;    asm("nop");
	nop
	.dbline 526
;     
;    if (Video_Mode) // Clear a dot on the panel
	ldd R0,y+7
	tst R0
	breq L96
X26:
	.dbline 527
;       Which_Bit_Should_be_Lit = (~Which_Bit_Should_be_Lit & LCD_DATA_PORT_VL);
	in R2,0x19
	mov R3,R10
	com R3
	and R3,R2
	mov R10,R3
	xjmp L97
L96:
	.dbline 530
; 	  
;    else            // Set a dot on the panel
;       Which_Bit_Should_be_Lit = (Which_Bit_Should_be_Lit | LCD_DATA_PORT_VL); 
	in R2,0x19
	or R10,R2
L97:
	.dbline 532
;   
;    LCD_DATA_PORT_DIR = OUTPUT; // Set data PORT direction back to an output
	ldi R24,255
	out 0x1a,R24
	.dbline 533
;    LCD_INSTR_PORT &= ~LCD_EN;
	cbi 0x12,2
	.dbline 535
;    
;    LCD_Set_XY(Page, Y);
	mov R18,R14
	mov R16,R12
	xcall _LCD_Set_XY
	.dbline 536
;    LCD_Send_Byte(Which_Bit_Should_be_Lit, D_DATA, NORMAL);     
	clr R2
	std y+0,R2
	ldi R18,1
	mov R16,R10
	xcall _LCD_Send_Byte
	.dbline -2
L95:
	.dbline 0 ; func end
	adiw R28,1
	xjmp pop_xgset00FC
	.dbsym r Page 12 c
	.dbsym r Which_Bit_Should_be_Lit 10 c
	.dbsym l Video_Mode 7 c
	.dbsym r Y 14 c
	.dbsym r X 10 c
	.dbend
;    }
; 
; /*----------------------------------------------------------------------------*-
;   ---- END OF FILE -----------------------------------------------------------
; -*----------------------------------------------------------------------------*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -