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

📄 ks0108_12864lcd.s

📁 ks0108 avr单片机1284显示
💻 S
📖 第 1 页 / 共 3 页
字号:
	.module KS0108_12864LCD.C
	.area text(rom, con, rel)
	.dbfile F:\Temp\KS0108_12864LCD\Source\KS0108_12864LCD.C
	.area lit(rom, con, rel)
_WELCOME:
	.byte 'H,'e,'l,'l,'o,44,32,'E,'m,'b,'e,'d,'d,'e,'d,'W
	.byte 'o,'r,'l,'d,33,0
	.dbsym s WELCOME _WELCOME A[22:22]kc
_WEBSITE:
	.byte 42,'w,'w,'w,46,'I,'C,'E,'w,'o,'r,'k,'s,'h,'o,'p
	.byte 46,'c,'o,'m,42,0
	.dbsym s WEBSITE _WEBSITE A[22:22]kc
	.area text(rom, con, rel)
	.dbfile F:\Temp\KS0108_12864LCD\Source\KS0108_12864LCD.C
	.dbfunc s Delay_1ms _Delay_1ms fV
;              i -> R16
	.even
_Delay_1ms:
	.dbline -1
	.dbline 82
; /*----------------------------------------------------------------------------*-
;    
;    Source Name    :  KS0108_12864LCD.C (v1.00)  
; 
;   ---------------------------------------------------------------------------- 
;    COPYRIGHT 
;    ---------	
; 
;    Created date  :  2008.03.01
;    Created By    :  HOCHIEN
;    Modified by   :
;    Modified Date :
;    Version       :  2.0  
;    Description   :  Simple KS0108 based 128 * 64 pixels LCD
;                     demonstration program. 
; 					   
;    LCD LIBRARY CODE
;    
;    Designed for SuperLoop operation, 
;    in this case for a 64 * 128 pixels matrix LCD display.
;    
;    * * * This program is from : www.ICEworksop.com * * *
; 
; -*----------------------------------------------------------------------------*/
; 
; #include "Main.H"
; #include "Port.H"
; 
; #include "KS0108_12864LCD.H"
; 
; // ------ Public variable declarations ---------------------------------------
; 
; // See 'FONT6x8.C' for details
; extern flash uInt8 FONT6x8[][6];
; 
; // See 'Chinese_Text.C' for details
; extern flash uInt8 CN_WELCOME[][32];
; extern flash uInt8 CN_EMBEDDED[][32];
; 
; // See 'Image_Test.C' for details
; extern flash uInt8 Image_Test[];
; 
; // ------ Private constants --------------------------------------------------
; 
; #define DISPLAY_ON   0x3F  // 0011 1111
; #define DISPLAY_OFF  0x3E  // 0011 1110
; #define DISPLAY_STARTLINE   0xC0  // 1100 0000
; #define DISPLAY_PAGE_SET    0xB8  // 1011 1000
; #define DISPLAY_COLUMN_SET  0x40  // 0100 0000
; #define LCD_BUSY 0x80 
; 
; #define INVERSE (1)
; #define NORMAL  (0)
; #define D_DATA  (1)
; #define COMMAND (0)
; 
; static flash uInt8 WELCOME[] = "Hello, EmbeddedWorld!";
; static flash uInt8 WEBSITE[] = "*www.ICEworkshop.com*";
; 
; // ------ Private function prototypes ----------------------------------------
; 
; static void Delay_1ms(void);
; static void Clear_Screen(uInt8);
; static void LCD_Send_Byte(uInt8, uInt8, uInt8);
; static void LCD_Set_XY(uInt8, uInt8);
; static void LCD_Disp_a_Char(uInt8, uInt8, uInt8, uInt8);
; static void LCD_Disp_String(uInt8, uInt8, flash uInt8 *,  uInt8);
; static void LCD_Disp_Chinese_String (uInt8, uInt8, uInt8, uInt8, uInt8, uInt8,
;                                      flash uInt8 (*)[32], uInt8);
; static void LCD_Disp_an_Image(uInt8, uInt8, flash uInt8 *, uInt8, uInt8, uInt8);
; static void LCD_Draw_a_Dot(uInt8, uInt8, uInt8);
; 
; /*----------------------------------------------------------------------------*-
; 
;    Delay_1ms()
; 
;    Software delay * approx * 1 millisecond @ 1MHz system clock.
; 
; -*----------------------------------------------------------------------------*/
; #pragma ctask Delay_1ms
; static void Delay_1ms(void)
;    {
	.dbline 84
;    uInt8 i;
;    for (i=0;i<143;i++);
	clr R16
	xjmp L5
L2:
	.dbline 84
L3:
	.dbline 84
	inc R16
L5:
	.dbline 84
	cpi R16,143
	brlo L2
X0:
	.dbline -2
L1:
	.dbline 0 ; func end
	ret
	.dbsym r i 16 c
	.dbend
	.dbfunc e KS0108_12864LCD_Init _KS0108_12864LCD_Init fV
	.even
_KS0108_12864LCD_Init::
	sbiw R28,1
	.dbline -1
	.dbline 95
;    }
; 
; /*----------------------------------------------------------------------------*-
; 
;    KS0108_12864LCD_Init()
; 
;    Set up LCD controller KS0108 before use it.
; 
; -*----------------------------------------------------------------------------*/
; void KS0108_12864LCD_Init(void)
;    {
	.dbline 97
;    // Set up the ports, see 'Port.H' for port pins details
;    LCD_DATA_PORT_DIR  = OUTPUT; // LED data PORT is an output
	ldi R24,255
	out 0x1a,R24
	.dbline 98
;    LCD_INSTR_PORT_DIR = OUTPUT; // LED instruction PORT is an output
	out 0x11,R24
	.dbline 99
;    LCD_DATA_PORT = 0x00;
	clr R2
	out 0x1b,R2
	.dbline 102
;    
;    // Toggle reset
;    LCD_INSTR_PORT |= LCD_RST;
	sbi 0x12,3
	.dbline 103
;    Delay_1ms();
	xcall _Delay_1ms
	.dbline 105
;    
;    LCD_INSTR_PORT &= ~LCD_RST;
	cbi 0x12,3
	.dbline 106
;    Delay_1ms();
	xcall _Delay_1ms
	.dbline 108
;    
;    LCD_INSTR_PORT |=  LCD_RST;
	sbi 0x12,3
	.dbline 109
;    Delay_1ms();
	xcall _Delay_1ms
	.dbline 112
;    
;    // Setup column select and initialize display
;    LCD_INSTR_PORT |=  LCD_CS1;
	sbi 0x12,4
	.dbline 113
;    LCD_INSTR_PORT &= ~LCD_CS2;
	cbi 0x12,5
	.dbline 115
; 
;    LCD_Send_Byte(DISPLAY_OFF, COMMAND, NORMAL); // Display OFF
	clr R2
	std y+0,R2
	clr R18
	ldi R16,62
	xcall _LCD_Send_Byte
	.dbline 116
;    LCD_Send_Byte(DISPLAY_STARTLINE, COMMAND, NORMAL);
	clr R2
	std y+0,R2
	clr R18
	ldi R16,192
	xcall _LCD_Send_Byte
	.dbline 117
;    LCD_Send_Byte(DISPLAY_PAGE_SET, COMMAND, NORMAL);
	clr R2
	std y+0,R2
	clr R18
	ldi R16,184
	xcall _LCD_Send_Byte
	.dbline 118
;    LCD_Send_Byte(DISPLAY_COLUMN_SET, COMMAND, NORMAL);
	clr R2
	std y+0,R2
	clr R18
	ldi R16,64
	xcall _LCD_Send_Byte
	.dbline 119
;    LCD_Send_Byte(DISPLAY_ON, COMMAND, NORMAL); // Display ON
	clr R2
	std y+0,R2
	clr R18
	ldi R16,63
	xcall _LCD_Send_Byte
	.dbline 121
;    
;    LCD_INSTR_PORT &= ~LCD_CS1;
	cbi 0x12,4
	.dbline 122
;    LCD_INSTR_PORT |=  LCD_CS2;
	sbi 0x12,5
	.dbline 124
; 
;    LCD_Send_Byte(DISPLAY_OFF, COMMAND, NORMAL); // Display OFF
	clr R2
	std y+0,R2
	clr R18
	ldi R16,62
	xcall _LCD_Send_Byte
	.dbline 125
;    LCD_Send_Byte(DISPLAY_STARTLINE, COMMAND, NORMAL);
	clr R2
	std y+0,R2
	clr R18
	ldi R16,192
	xcall _LCD_Send_Byte
	.dbline 126
;    LCD_Send_Byte(DISPLAY_PAGE_SET, COMMAND, NORMAL);
	clr R2
	std y+0,R2
	clr R18
	ldi R16,184
	xcall _LCD_Send_Byte
	.dbline 127
;    LCD_Send_Byte(DISPLAY_COLUMN_SET, COMMAND, NORMAL);
	clr R2
	std y+0,R2
	clr R18
	ldi R16,64
	xcall _LCD_Send_Byte
	.dbline 128
;    LCD_Send_Byte(DISPLAY_ON, COMMAND, NORMAL); // Display ON
	clr R2
	std y+0,R2
	clr R18
	ldi R16,63
	xcall _LCD_Send_Byte
	.dbline 130
;    
;    Clear_Screen(NORMAL);
	clr R16
	xcall _Clear_Screen
	.dbline -2
L6:
	.dbline 0 ; func end
	adiw R28,1
	ret
	.dbend
	.dbfunc e KS0108_12864LCD_Update _KS0108_12864LCD_Update fV
;              i -> R20,R21
;              j -> R22,R23
	.even
_KS0108_12864LCD_Update::
	xcall push_xgsetF000
	sbiw R28,11
	.dbline -1
	.dbline 141
;    }
;    
; /*----------------------------------------------------------------------------*-
; 
;    PCD8544_LCD_Update()        
; 
;    This function updates data on the LCD panel (if it requires update).
; 
; -*----------------------------------------------------------------------------*/
; void KS0108_12864LCD_Update(void)
;    {
	.dbline 144
;    uInt16 i, j;
;    
;    LCD_Disp_an_Image(0, 0, Image_Test, 64, 128, NORMAL);
	clr R2
	std y+6,R2
	ldi R24,128
	std y+4,R24
	ldi R24,64
	std y+2,R24
	ldi R24,<_Image_Test
	ldi R25,>_Image_Test
	std y+1,R25
	std y+0,R24
	clr R18
	clr R16
	xcall _LCD_Disp_an_Image
	.dbline 145
;    for(i = 0; i < 1000; i++)
	clr R20
	clr R21
	xjmp L11
L8:
	.dbline 146
; 	  for(j = 0; j < 400; j++);
	clr R22
	clr R23
	xjmp L15
L12:
	.dbline 146
L13:
	.dbline 146
	subi R22,255  ; offset = 1
	sbci R23,255
L15:
	.dbline 146
	cpi R22,144
	ldi R30,1
	cpc R23,R30
	brlo L12
X1:
L9:
	.dbline 145
	subi R20,255  ; offset = 1
	sbci R21,255
L11:
	.dbline 145
	cpi R20,232
	ldi R30,3
	cpc R21,R30
	brlo L8
X2:
	.dbline 148
; 
;    Clear_Screen(NORMAL);  
	clr R16
	xcall _Clear_Screen
	.dbline 149
;    LCD_Disp_String(0, 1, WELCOME, NORMAL); 
	clr R2
	std y+2,R2
	ldi R24,<_WELCOME
	ldi R25,>_WELCOME
	std y+1,R25
	std y+0,R24
	ldi R18,1
	clr R16
	xcall _LCD_Disp_String
	.dbline 150
;    LCD_Disp_String(7, 1, WEBSITE, NORMAL); 
	clr R2
	std y+2,R2
	ldi R24,<_WEBSITE
	ldi R25,>_WEBSITE
	std y+1,R25
	std y+0,R24
	ldi R18,1
	ldi R16,7
	xcall _LCD_Disp_String
	.dbline 151
;    LCD_Disp_Chinese_String(2, 32, 16, 4, 0, 0, CN_WELCOME, NORMAL);
	clr R2
	std y+10,R2
	ldi R24,<_CN_WELCOME
	ldi R25,>_CN_WELCOME
	std y+9,R25
	std y+8,R24
	std y+6,R2
	std y+4,R2
	ldi R24,4
	std y+2,R24
	ldi R24,16
	std y+0,R24
	ldi R18,32
	ldi R16,2
	xcall _LCD_Disp_Chinese_String
	.dbline 152
;    LCD_Disp_Chinese_String(4, 24, 16, 5, 0, 0, CN_EMBEDDED, NORMAL);     
	clr R2
	std y+10,R2
	ldi R24,<_CN_EMBEDDED
	ldi R25,>_CN_EMBEDDED
	std y+9,R25
	std y+8,R24
	std y+6,R2
	std y+4,R2
	ldi R24,5
	std y+2,R24
	ldi R24,16
	std y+0,R24
	ldi R18,24
	ldi R16,4
	xcall _LCD_Disp_Chinese_String
	.dbline 153
;    for(i = 0; i < 1000; i++)
	clr R20
	clr R21
	xjmp L19
L16:
	.dbline 154
; 	  for(j = 0; j < 400; j++);
	clr R22
	clr R23
	xjmp L23
L20:
	.dbline 154
L21:
	.dbline 154
	subi R22,255  ; offset = 1
	sbci R23,255
L23:
	.dbline 154
	cpi R22,144
	ldi R30,1
	cpc R23,R30
	brlo L20
X3:
L17:
	.dbline 153
	subi R20,255  ; offset = 1
	sbci R21,255
L19:
	.dbline 153
	cpi R20,232
	ldi R30,3
	cpc R21,R30
	brlo L16
X4:
	.dbline 156
; 	  
;    LCD_Disp_an_Image(0, 0, Image_Test, 64, 128, INVERSE);
	ldi R24,1
	std y+6,R24
	ldi R24,128
	std y+4,R24
	ldi R24,64
	std y+2,R24
	ldi R24,<_Image_Test
	ldi R25,>_Image_Test
	std y+1,R25
	std y+0,R24
	clr R18
	clr R16
	xcall _LCD_Disp_an_Image
	.dbline 157
;    for(i = 0; i < 1000; i++)
	clr R20
	clr R21
	xjmp L27
L24:
	.dbline 158
; 	  for(j = 0; j < 400; j++);
	clr R22
	clr R23
	xjmp L31
L28:
	.dbline 158
L29:
	.dbline 158
	subi R22,255  ; offset = 1
	sbci R23,255
L31:
	.dbline 158
	cpi R22,144
	ldi R30,1
	cpc R23,R30
	brlo L28
X5:
L25:
	.dbline 157
	subi R20,255  ; offset = 1
	sbci R21,255
L27:
	.dbline 157
	cpi R20,232
	ldi R30,3
	cpc R21,R30
	brlo L24
X6:
	.dbline 160
; 
;    Clear_Screen(INVERSE);  
	ldi R16,1
	xcall _Clear_Screen
	.dbline 161
;    LCD_Disp_String(0, 1, WELCOME, INVERSE); 
	ldi R24,1
	std y+2,R24
	ldi R24,<_WELCOME
	ldi R25,>_WELCOME
	std y+1,R25
	std y+0,R24
	ldi R18,1
	clr R16
	xcall _LCD_Disp_String
	.dbline 162
;    LCD_Disp_String(7, 1, WEBSITE, INVERSE); 
	ldi R24,1
	std y+2,R24
	ldi R24,<_WEBSITE
	ldi R25,>_WEBSITE
	std y+1,R25
	std y+0,R24
	ldi R18,1
	ldi R16,7
	xcall _LCD_Disp_String
	.dbline 163
;    LCD_Disp_Chinese_String(2, 32, 16, 4, 0, 0, CN_WELCOME, INVERSE);
	ldi R24,1
	std y+10,R24
	ldi R24,<_CN_WELCOME
	ldi R25,>_CN_WELCOME
	std y+9,R25
	std y+8,R24
	clr R2
	std y+6,R2
	std y+4,R2
	ldi R24,4
	std y+2,R24
	ldi R24,16
	std y+0,R24
	ldi R18,32
	ldi R16,2
	xcall _LCD_Disp_Chinese_String
	.dbline 164
;    LCD_Disp_Chinese_String(4, 24, 16, 5, 0, 0, CN_EMBEDDED, INVERSE); 
	ldi R24,1
	std y+10,R24
	ldi R24,<_CN_EMBEDDED
	ldi R25,>_CN_EMBEDDED
	std y+9,R25
	std y+8,R24
	clr R2
	std y+6,R2
	std y+4,R2
	ldi R24,5
	std y+2,R24
	ldi R24,16
	std y+0,R24
	ldi R18,24
	ldi R16,4
	xcall _LCD_Disp_Chinese_String
	.dbline 165
;    for(i = 0; i < 1000; i++)
	clr R20
	clr R21
	xjmp L35
L32:
	.dbline 166
; 	  for(j = 0; j < 400; j++); 
	clr R22
	clr R23
	xjmp L39
L36:
	.dbline 166
L37:

⌨️ 快捷键说明

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