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

📄 lcd_19264.ls

📁 按键是比较复杂。可以用状态机表示。 每10mS执行一次键盘扫描任务 0、无键
💻 LS
📖 第 1 页 / 共 3 页
字号:
3159  0064 85            	popw	x
3160  0065 7210501e      	bset	_PG_ODR,#0
3161  0069 81            	ret	
3210                     ; 77 void LCD_WriteData(u8 Data, u8 ChipSel)
3210                     ; 78 {
3211                     	switch	.text
3212  006a               _LCD_WriteData:
3214       00000000      OFST:	set	0
3217                     ; 79 	LCD_E_L();	
3219  006a 72195000      	bres	_PA_ODR,#4
3220  006e 89            	pushw	x
3221                     ; 80 	LCD_RW_L();
3223  006f 721b5000      	bres	_PA_ODR,#5
3224                     ; 81     if( ChipSel == LCD_LEFT )
3226  0073 9f            	ld	a,xl
3227  0074 4d            	tnz	a
3228  0075 2606          	jrne	L1271
3229                     ; 83         LCD_CSB_L();
3231  0077 7213501e      	bres	_PG_ODR,#1
3232                     ; 84 		LCD_CSA_L();
3234  007b 2013          	jp	LC002
3235  007d               L1271:
3236                     ; 86 	else if( ChipSel == LCD_MID )
3238  007d 7b02          	ld	a,(OFST+2,sp)
3239  007f 4a            	dec	a
3240  0080 260a          	jrne	L5271
3241                     ; 89 		LCD_CSB_L();
3243  0082 7213501e      	bres	_PG_ODR,#1
3244                     ; 90         LCD_CSA_H();
3246  0086 7210501e      	bset	_PG_ODR,#0
3248  008a 2008          	jra	L3271
3249  008c               L5271:
3250                     ; 94         LCD_CSB_H();
3252  008c 7212501e      	bset	_PG_ODR,#1
3253                     ; 95 		LCD_CSA_L();
3255  0090               LC002:
3257  0090 7211501e      	bres	_PG_ODR,#0
3258  0094               L3271:
3259                     ; 97 	LCD_RS_H();	// Data signal
3261  0094 721c5000      	bset	_PA_ODR,#6
3262                     ; 98 	delay_us(3);
3264  0098 a603          	ld	a,#3
3265  009a cd0000        	call	_delay_us
3267                     ; 99 	LCD_E_H();
3269  009d 72185000      	bset	_PA_ODR,#4
3270                     ; 101 	LCD_SET_DATA(Data);
3272  00a1 7b01          	ld	a,(OFST+1,sp)
3273  00a3 a4f0          	and	a,#240
3274  00a5 c75005        	ld	_PB_ODR,a
3275  00a8 7b01          	ld	a,(OFST+1,sp)
3276  00aa 97            	ld	xl,a
3277  00ab a610          	ld	a,#16
3278  00ad 42            	mul	x,a
3279  00ae 9f            	ld	a,xl
3280  00af c7500a        	ld	_PC_ODR,a
3281  00b2 7b01          	ld	a,(OFST+1,sp)
3282  00b4 a401          	and	a,#1
3283  00b6 c75014        	ld	_PE_ODR,a
3284                     ; 105     delay_us(3);
3286  00b9 a603          	ld	a,#3
3287  00bb cd0000        	call	_delay_us
3289                     ; 107 	LCD_E_L();
3291  00be 72195000      	bres	_PA_ODR,#4
3292                     ; 108 	LCD_RW_H();
3294  00c2 721a5000      	bset	_PA_ODR,#5
3295                     ; 109     LCD_E_H();
3297  00c6 72185000      	bset	_PA_ODR,#4
3298                     ; 110 	LCD_CSB_H();
3300  00ca 7212501e      	bset	_PG_ODR,#1
3301                     ; 111 	LCD_CSA_H();
3303                     ; 113 }
3306  00ce 85            	popw	x
3307  00cf 7210501e      	bset	_PG_ODR,#0
3308  00d3 81            	ret	
3347                     ; 115 u8 LCD_ReadData(void)
3347                     ; 116 {
3348                     	switch	.text
3349  00d4               _LCD_ReadData:
3351       00000001      OFST:	set	1
3354                     ; 119 	LCD_E_L();
3356  00d4 72195000      	bres	_PA_ODR,#4
3357                     ; 120 	LCD_RW_H();
3359  00d8 721a5000      	bset	_PA_ODR,#5
3360                     ; 122     LCD_CSA_L();
3362  00dc 7211501e      	bres	_PG_ODR,#0
3363                     ; 123     LCD_CSB_L();
3365  00e0 7213501e      	bres	_PG_ODR,#1
3366                     ; 125 	LCD_RS_H();
3368  00e4 721c5000      	bset	_PA_ODR,#6
3369  00e8 88            	push	a
3370                     ; 127 	LCD_E_H();
3372  00e9 72185000      	bset	_PA_ODR,#4
3373                     ; 128 	delay_us(1);
3375  00ed a601          	ld	a,#1
3376  00ef cd0000        	call	_delay_us
3378                     ; 130 	LCD_DATA_INPUT_MODE();
3380  00f2 4b00          	push	#0
3381  00f4 4bf8          	push	#248
3382  00f6 ae5005        	ldw	x,#20485
3383  00f9 cd0000        	call	_GPIO_Init
3385  00fc 85            	popw	x
3386                     ; 131 	rData = LCD_READ_DATA();
3388  00fd ae5005        	ldw	x,#20485
3389  0100 cd0000        	call	_GPIO_ReadInputData
3391  0103 6b01          	ld	(OFST+0,sp),a
3392                     ; 132 	LCD_DATA_OUTPUT_MODE();
3394  0105 4bd0          	push	#208
3395  0107 4bf8          	push	#248
3396  0109 ae5005        	ldw	x,#20485
3397  010c cd0000        	call	_GPIO_Init
3399  010f 721b5000      	bres	_PA_ODR,#5
3400  0113 72185000      	bset	_PA_ODR,#4
3401  0117 7210501e      	bset	_PG_ODR,#0
3402  011b 7212501e      	bset	_PG_ODR,#1
3403  011f 85            	popw	x
3404                     ; 134 	LCD_RW_L();
3406                     ; 135 	LCD_E_H();
3408                     ; 136 	LCD_CSA_H();
3410                     ; 137 	LCD_CSB_H();
3412                     ; 139 	return rData;
3414  0120 7b01          	ld	a,(OFST+0,sp)
3417  0122 5b01          	addw	sp,#1
3418  0124 81            	ret	
3457                     ; 143 u8 LCD_ReadCommand(void)
3457                     ; 144 {
3458                     	switch	.text
3459  0125               _LCD_ReadCommand:
3461       00000001      OFST:	set	1
3464                     ; 147 	LCD_E_L();
3466  0125 72195000      	bres	_PA_ODR,#4
3467                     ; 148 	LCD_RW_H();
3469  0129 721a5000      	bset	_PA_ODR,#5
3470                     ; 150 	LCD_CSA_L();
3472  012d 7211501e      	bres	_PG_ODR,#0
3473                     ; 151 	LCD_CSB_L();
3475  0131 7213501e      	bres	_PG_ODR,#1
3476                     ; 153 	LCD_RS_L();
3478  0135 721d5000      	bres	_PA_ODR,#6
3479  0139 88            	push	a
3480                     ; 155 	LCD_E_H();
3482  013a 72185000      	bset	_PA_ODR,#4
3483                     ; 156 	delay_us(1);
3485  013e a601          	ld	a,#1
3486  0140 cd0000        	call	_delay_us
3488                     ; 158 	LCD_DATA_INPUT_MODE();
3490  0143 4b00          	push	#0
3491  0145 4bf8          	push	#248
3492  0147 ae5005        	ldw	x,#20485
3493  014a cd0000        	call	_GPIO_Init
3495  014d 85            	popw	x
3496                     ; 159 	rData = LCD_READ_DATA();
3498  014e ae5005        	ldw	x,#20485
3499  0151 cd0000        	call	_GPIO_ReadInputData
3501  0154 6b01          	ld	(OFST+0,sp),a
3502                     ; 160 	LCD_DATA_OUTPUT_MODE();
3504  0156 4bd0          	push	#208
3505  0158 4bf8          	push	#248
3506  015a ae5005        	ldw	x,#20485
3507  015d cd0000        	call	_GPIO_Init
3509  0160 721b5000      	bres	_PA_ODR,#5
3510  0164 72185000      	bset	_PA_ODR,#4
3511  0168 7210501e      	bset	_PG_ODR,#0
3512  016c 7212501e      	bset	_PG_ODR,#1
3513  0170 85            	popw	x
3514                     ; 162 	LCD_RW_L();
3516                     ; 163 	LCD_E_H();
3518                     ; 164 	LCD_CSA_H();
3520                     ; 165 	LCD_CSB_H();
3522                     ; 167 	return rData;
3524  0171 7b01          	ld	a,(OFST+0,sp)
3527  0173 5b01          	addw	sp,#1
3528  0175 81            	ret	
3590                     ; 171 void LCD_Init(void)
3590                     ; 172 {
3591                     	switch	.text
3592  0176               _LCD_Init:
3594  0176 5204          	subw	sp,#4
3595       00000004      OFST:	set	4
3598                     ; 175     p = (u8*)DisplayBuffer;
3600  0178 ae0000        	ldw	x,#L5361_DisplayBuffer
3601  017b 1f03          	ldw	(OFST-1,sp),x
3602                     ; 184     PB_DDR = 0xf0;
3604  017d 35f05007      	mov	_PB_DDR,#240
3605                     ; 185     PB_CR1 = 0xf0;
3607  0181 35f05008      	mov	_PB_CR1,#240
3608                     ; 186     PB_CR2 = 0xf0;
3610  0185 35f05009      	mov	_PB_CR2,#240
3611                     ; 188     PC_DDR = 0xe0;                              // pc5\6\7
3613  0189 35e0500c      	mov	_PC_DDR,#224
3614                     ; 189     PC_CR1 = 0xe0;
3616  018d 35e0500d      	mov	_PC_CR1,#224
3617                     ; 190     PC_CR2 = 0xe0;
3619  0191 35e0500e      	mov	_PC_CR2,#224
3620                     ; 192     PA_DDR |= (1<<4)|(1<<5)|(1<<6);              /* Output.                   */
3622  0195 c65002        	ld	a,_PA_DDR
3623  0198 aa70          	or	a,#112
3624  019a c75002        	ld	_PA_DDR,a
3625                     ; 193     PA_CR1 |= (1<<4)|(1<<5)|(1<<6);              /* PushPull.                 */
3627  019d c65003        	ld	a,_PA_CR1
3628  01a0 aa70          	or	a,#112
3629  01a2 c75003        	ld	_PA_CR1,a
3630                     ; 194     PA_CR2 |= (1<<4)|(1<<5)|(1<<6);              /* Output speed up to 10MHz. */
3632  01a5 c65004        	ld	a,_PA_CR2
3633  01a8 aa70          	or	a,#112
3634  01aa c75004        	ld	_PA_CR2,a
3635                     ; 196     PG_DDR |= 0X03;
3637  01ad c65020        	ld	a,_PG_DDR
3638  01b0 aa03          	or	a,#3
3639  01b2 c75020        	ld	_PG_DDR,a
3640                     ; 197     PG_CR1 |= 0X03;
3642  01b5 c65021        	ld	a,_PG_CR1
3643  01b8 aa03          	or	a,#3
3644  01ba c75021        	ld	_PG_CR1,a
3645                     ; 198     PG_CR2 |= 0X03;
3647  01bd c65022        	ld	a,_PG_CR2
3648  01c0 aa03          	or	a,#3
3649  01c2 c75022        	ld	_PG_CR2,a
3650                     ; 200     PE_DDR |= 0X01;
3652  01c5 72105016      	bset	_PE_DDR,#0
3653                     ; 201     PE_CR1 |= 0X01;
3655  01c9 72105017      	bset	_PE_CR1,#0
3656                     ; 202     PE_CR2 |= 0X01;
3658  01cd 72105018      	bset	_PE_CR2,#0
3659                     ; 203     PE_ODR |= 0X01;
3661                     ; 205     for(i = 0; i < 192*8; ++i, ++p)
3663  01d1 5f            	clrw	x
3664  01d2 72105014      	bset	_PE_ODR,#0
3665  01d6 1f01          	ldw	(OFST-3,sp),x
3666  01d8               L7002:
3667                     ; 206         *p = 0;
3669  01d8 1e03          	ldw	x,(OFST-1,sp)
3670  01da 7f            	clr	(x)
3671                     ; 205     for(i = 0; i < 192*8; ++i, ++p)
3673  01db 1e01          	ldw	x,(OFST-3,sp)
3674  01dd 5c            	incw	x
3675  01de 1f01          	ldw	(OFST-3,sp),x
3676  01e0 1e03          	ldw	x,(OFST-1,sp)
3677  01e2 5c            	incw	x
3678  01e3 1f03          	ldw	(OFST-1,sp),x
3681  01e5 1e01          	ldw	x,(OFST-3,sp)
3682  01e7 a30600        	cpw	x,#1536
3683  01ea 2fec          	jrslt	L7002
3684                     ; 207     LCD_WriteCommand(LCD_DISPLAY_ON, LCD_LEFT);
3686  01ec 5f            	clrw	x
3687  01ed a63f          	ld	a,#63
3688  01ef 95            	ld	xh,a
3689  01f0 cd0000        	call	_LCD_WriteCommand
3691                     ; 208     LCD_WriteCommand(LCD_DISPLAY_ON, LCD_MID);
3693  01f3 ae0001        	ldw	x,#1
3694  01f6 a63f          	ld	a,#63
3695  01f8 95            	ld	xh,a
3696  01f9 cd0000        	call	_LCD_WriteCommand
3698                     ; 209     LCD_WriteCommand(LCD_DISPLAY_ON, LCD_RIGHT);
3700  01fc ae0002        	ldw	x,#2
3701  01ff a63f          	ld	a,#63
3702  0201 95            	ld	xh,a
3703  0202 cd0000        	call	_LCD_WriteCommand
3705                     ; 210     LCD_WriteCommand(LCD_START_LINE+0, LCD_LEFT);
3707  0205 5f            	clrw	x
3708  0206 a6c0          	ld	a,#192
3709  0208 95            	ld	xh,a
3710  0209 cd0000        	call	_LCD_WriteCommand
3712                     ; 212 }
3715  020c 5b04          	addw	sp,#4
3716  020e 81            	ret	
3826                     ; 214 void LCD_BufferDrawPixel(u8 x, u8 y, DrawMode mode)
3826                     ; 215 {
3827                     	switch	.text
3828  020f               _LCD_BufferDrawPixel:
3830  020f 89            	pushw	x
3831  0210 5203          	subw	sp,#3
3832       00000003      OFST:	set	3
3835                     ; 216 	char DX = (y >> 3);                 // 璁$畻鍑哄睘浜庡摢涓

⌨️ 快捷键说明

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