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

📄 mc_stm8s_lcd.ls

📁 STM8S105 BLDC源代码
💻 LS
📖 第 1 页 / 共 4 页
字号:
   1                     ; C Compiler for STM8 (COSMIC Software)
   2                     ; Parser V4.9.10 - 10 Feb 2011
   3                     ; Generator (Limited) V4.3.6 - 15 Feb 2011
   4                     ; Optimizer V4.3.5 - 15 Feb 2011
  19                     .const:	section	.text
  20  0000               _S_CGRAM:
  21  0000 03            	dc.b	3
  22  0001 ff            	dc.b	255
  23  0002 02            	dc.b	2
  24  0003 00            	dc.b	0
  25  0004 04            	dc.b	4
  26  0005 00            	dc.b	0
  27  0006 04            	dc.b	4
  28  0007 00            	dc.b	0
  29  0008 0c            	dc.b	12
  30  0009 7f            	dc.b	127
  31  000a 0c            	dc.b	12
  32  000b 7f            	dc.b	127
  33  000c 1c            	dc.b	28
  34  000d 3f            	dc.b	63
  35  000e 1e            	dc.b	30
  36  000f 1f            	dc.b	31
  37  0010 3f            	dc.b	63
  38  0011 0f            	dc.b	15
  39  0012 3f            	dc.b	63
  40  0013 87            	dc.b	135
  41  0014 7f            	dc.b	127
  42  0015 c3            	dc.b	195
  43  0016 7f            	dc.b	127
  44  0017 e3            	dc.b	227
  45  0018 00            	dc.b	0
  46  0019 03            	dc.b	3
  47  001a 00            	dc.b	0
  48  001b 03            	dc.b	3
  49  001c 00            	dc.b	0
  50  001d 07            	dc.b	7
  51  001e ff            	dc.b	255
  52  001f fe            	dc.b	254
  53  0020               _T_CGRAM:
  54  0020 ff            	dc.b	255
  55  0021 ff            	dc.b	255
  56  0022 00            	dc.b	0
  57  0023 00            	dc.b	0
  58  0024 00            	dc.b	0
  59  0025 00            	dc.b	0
  60  0026 00            	dc.b	0
  61  0027 00            	dc.b	0
  62  0028 f8            	dc.b	248
  63  0029 f8            	dc.b	248
  64  002a f0            	dc.b	240
  65  002b f8            	dc.b	248
  66  002c f0            	dc.b	240
  67  002d f0            	dc.b	240
  68  002e f0            	dc.b	240
  69  002f f0            	dc.b	240
  70  0030 e1            	dc.b	225
  71  0031 e0            	dc.b	224
  72  0032 e3            	dc.b	227
  73  0033 e0            	dc.b	224
  74  0034 c3            	dc.b	195
  75  0035 c0            	dc.b	192
  76  0036 c7            	dc.b	199
  77  0037 c0            	dc.b	192
  78  0038 87            	dc.b	135
  79  0039 c0            	dc.b	192
  80  003a 8f            	dc.b	143
  81  003b 80            	dc.b	128
  82  003c 0f            	dc.b	15
  83  003d 80            	dc.b	128
  84  003e 1f            	dc.b	31
  85  003f 00            	dc.b	0
 125                     ; 81 void LCD_Delay(u16 nCount)
 125                     ; 82 {
 127                     	switch	.text
 128  0000               _LCD_Delay:
 130  0000 89            	pushw	x
 131       00000000      OFST:	set	0
 134  0001 2003          	jra	L13
 135  0003               L72:
 136                     ; 86     nCount--;
 138  0003 5a            	decw	x
 139  0004 1f01          	ldw	(OFST+1,sp),x
 140  0006               L13:
 141                     ; 84   while (nCount != 0)
 143  0006 1e01          	ldw	x,(OFST+1,sp)
 144  0008 26f9          	jrne	L72
 145                     ; 88 }
 148  000a 85            	popw	x
 149  000b 81            	ret	
 174                     ; 101 void LCD_ReadStatus(void)
 174                     ; 102 {
 175                     	switch	.text
 176  000c               _LCD_ReadStatus:
 180                     ; 103   LCD_SendByte(STATUS_TYPE, 0x00);
 182  000c aefc00        	ldw	x,#64512
 183  000f ad25          	call	_LCD_SendByte
 185                     ; 104   LCD_Delay(200);
 187  0011 ae00c8        	ldw	x,#200
 189                     ; 105   return;
 192  0014 20ea          	jp	_LCD_Delay
 226                     ; 117 static void LCD_SPISendByte(u8 DataToSend)
 226                     ; 118 {
 227                     	switch	.text
 228  0016               L54_LCD_SPISendByte:
 232                     ; 121   SPI->DR = DataToSend;
 234  0016 c75204        	ld	20996,a
 236  0019               L17:
 237                     ; 123   while ((SPI->SR & SPI_SR_TXE) == 0)
 239  0019 72035203fb    	btjf	20995,#1,L17
 240                     ; 127 }
 243  001e 81            	ret	
 300                     ; 151 void LCD_ChipSelect(FunctionalState NewState)
 300                     ; 152 {
 301                     	switch	.text
 302  001f               _LCD_ChipSelect:
 306                     ; 153   if (NewState == DISABLE)
 308  001f 4d            	tnz	a
 309  0020 260a          	jrne	L321
 310                     ; 155     GPIO_WriteLow(LCD_CS_PORT, LCD_CS_PIN); /* CS pin low: LCD disabled */
 312  0022 4b01          	push	#1
 313  0024 ae5019        	ldw	x,#20505
 314  0027 cd0000        	call	_GPIO_WriteLow
 317  002a 2008          	jra	L521
 318  002c               L321:
 319                     ; 159     GPIO_WriteHigh(LCD_CS_PORT, LCD_CS_PIN); /* CS pin high: LCD enabled */
 321  002c 4b01          	push	#1
 322  002e ae5019        	ldw	x,#20505
 323  0031 cd0000        	call	_GPIO_WriteHigh
 325  0034               L521:
 326  0034 84            	pop	a
 327                     ; 161 }
 330  0035 81            	ret	
 333                     	switch	.ubsct
 334  0000               L721_i:
 335  0000 00            	ds.b	1
 387                     ; 178 void LCD_SendByte(u8 DataType, u8 DataToSend)
 387                     ; 179 {
 388                     	switch	.text
 389  0036               _LCD_SendByte:
 391  0036 89            	pushw	x
 392       00000000      OFST:	set	0
 395                     ; 181   LCD_ChipSelect(ENABLE); /* Enable access to LCD */
 397  0037 a601          	ld	a,#1
 398  0039 ade4          	call	_LCD_ChipSelect
 400                     ; 183   LCD_SPISendByte(DataType); /* Send Synchro/Mode byte */
 402  003b 7b01          	ld	a,(OFST+1,sp)
 403  003d add7          	call	L54_LCD_SPISendByte
 405                     ; 184   LCD_SPISendByte((u8)(DataToSend & (u8)0xF0)); /* Send byte high nibble */
 407  003f 7b02          	ld	a,(OFST+2,sp)
 408  0041 a4f0          	and	a,#240
 409  0043 add1          	call	L54_LCD_SPISendByte
 411                     ; 185   LCD_SPISendByte((u8)((u8)(DataToSend << 4) & (u8)0xF0)); /* Send byte low nibble */
 413  0045 7b02          	ld	a,(OFST+2,sp)
 414  0047 97            	ld	xl,a
 415  0048 a610          	ld	a,#16
 416  004a 42            	mul	x,a
 417  004b 9f            	ld	a,xl
 418  004c a4f0          	and	a,#240
 419  004e adc6          	call	L54_LCD_SPISendByte
 421                     ; 187 	for (i = 0; i<128; i++)
 423  0050 3f00          	clr	L721_i
 424  0052               L751:
 427  0052 3c00          	inc	L721_i
 430  0054 b600          	ld	a,L721_i
 431  0056 a180          	cp	a,#128
 432  0058 25f8          	jrult	L751
 433                     ; 190   LCD_ChipSelect(DISABLE); /* Disable access to LCD */
 435  005a 4f            	clr	a
 436  005b adc2          	call	_LCD_ChipSelect
 438                     ; 192 }
 441  005d 85            	popw	x
 442  005e 81            	ret	
 488                     ; 210 void LCD_SendBuffer(u8 *pTxBuffer, u8 *pRxBuffer, u8 NumByte)
 488                     ; 211 {
 489                     	switch	.text
 490  005f               _LCD_SendBuffer:
 492  005f 89            	pushw	x
 493       00000000      OFST:	set	0
 496                     ; 212   LCD_ChipSelect(ENABLE);
 498  0060 a601          	ld	a,#1
 499  0062 adbb          	call	_LCD_ChipSelect
 502  0064 200a          	jra	L112
 503  0066               L702:
 504                     ; 215     LCD_SPISendByte(*pTxBuffer);
 506  0066 1e01          	ldw	x,(OFST+1,sp)
 507  0068 f6            	ld	a,(x)
 508  0069 adab          	call	L54_LCD_SPISendByte
 510                     ; 216     pTxBuffer++;
 512  006b 1e01          	ldw	x,(OFST+1,sp)
 513  006d 5c            	incw	x
 514  006e 1f01          	ldw	(OFST+1,sp),x
 515  0070               L112:
 516                     ; 213   while (NumByte--) /* while there is data to be read */
 518  0070 7b07          	ld	a,(OFST+7,sp)
 519  0072 0a07          	dec	(OFST+7,sp)
 520  0074 4d            	tnz	a
 521  0075 26ef          	jrne	L702
 522                     ; 218   LCD_ChipSelect(DISABLE);
 524  0077 ada6          	call	_LCD_ChipSelect
 526                     ; 219 }
 529  0079 85            	popw	x
 530  007a 81            	ret	
 556                     ; 238 void LCD_Init(void)
 556                     ; 239 {
 557                     	switch	.text
 558  007b               _LCD_Init:
 562                     ; 241   GPIO_Init(LCD_CS_PORT, LCD_CS_PIN, GPIO_MODE_OUT_PP_LOW_FAST);
 564  007b 4bc0          	push	#192
 565  007d 4b01          	push	#1
 566  007f ae5019        	ldw	x,#20505
 567  0082 cd0000        	call	_GPIO_Init
 569  0085 85            	popw	x
 570                     ; 243   LCD_SendByte(COMMAND_TYPE, SET_TEXT_MODE); /* Set the LCD in TEXT mode */
 572  0086 aef830        	ldw	x,#63536
 573  0089 adab          	call	_LCD_SendByte
 575                     ; 244   LCD_SendByte(COMMAND_TYPE, DISPLAY_ON); /* Enable the display */
 577  008b aef80c        	ldw	x,#63500
 578  008e ada6          	call	_LCD_SendByte
 580                     ; 245   LCD_Clear(); /* Clear the LCD */
 582  0090 ad05          	call	_LCD_Clear
 584                     ; 246   LCD_SendByte(COMMAND_TYPE, ENTRY_MODE_SET_INC); /* Select the entry mode type */
 586  0092 aef806        	ldw	x,#63494
 588                     ; 248 }
 591  0095 209f          	jp	_LCD_SendByte
 626                     ; 264 void LCD_Clear(void)
 626                     ; 265 {
 627                     	switch	.text
 628  0097               _LCD_Clear:
 630  0097 89            	pushw	x
 631       00000002      OFST:	set	2
 634                     ; 269   LCD_SendByte(COMMAND_TYPE, DISPLAY_CLR); /* Clear the LCD */
 636  0098 aef801        	ldw	x,#63489
 637  009b ad99          	call	_LCD_SendByte
 639                     ; 272   for (i = 0; i < 5000; i++)
 641  009d 5f            	clrw	x
 642  009e               L342:
 645  009e 5c            	incw	x
 648  009f a31388        	cpw	x,#5000
 649  00a2 25fa          	jrult	L342
 650                     ; 277 }
 653  00a4 85            	popw	x
 654  00a5 81            	ret	
 679                     ; 294 void LCD_SetTextMode(void)
 679                     ; 295 {
 680                     	switch	.text
 681  00a6               _LCD_SetTextMode:
 685                     ; 296   LCD_SendByte(COMMAND_TYPE, SET_TEXT_MODE);
 687  00a6 aef830        	ldw	x,#63536
 688  00a9 ad8b          	call	_LCD_SendByte
 690                     ; 297   LCD_Clear();
 693                     ; 298 }
 696  00ab 20ea          	jp	_LCD_Clear
 721                     ; 315 void LCD_SetGraphicMode(void)
 721                     ; 316 {
 722                     	switch	.text
 723  00ad               _LCD_SetGraphicMode:
 727                     ; 317   LCD_Clear();
 729  00ad ade8          	call	_LCD_Clear
 731                     ; 318   LCD_SendByte(COMMAND_TYPE, SET_GRAPHIC_MODE);
 733  00af aef836        	ldw	x,#63542
 735                     ; 320 }
 738  00b2 2082          	jp	_LCD_SendByte
 782                     ; 335 void LCD_ClearLine(u8 Line)
 782                     ; 336 {
 783                     	switch	.text
 784  00b4               _LCD_ClearLine:
 786  00b4 88            	push	a
 787       00000001      OFST:	set	1
 790                     ; 341   LCD_SendByte(COMMAND_TYPE, Line);
 792  00b5 97            	ld	xl,a
 793  00b6 a6f8          	ld	a,#248
 794  00b8 95            	ld	xh,a
 795  00b9 cd0036        	call	_LCD_SendByte
 797                     ; 344   for (CharPos = 0; CharPos < LCD_LINE_MAX_CHAR; CharPos++)
 799  00bc 0f01          	clr	(OFST+0,sp)
 800  00be               L313:
 801                     ; 346     LCD_SendByte(DATA_TYPE, ' ');
 803  00be aefa20        	ldw	x,#64032
 804  00c1 cd0036        	call	_LCD_SendByte
 806                     ; 344   for (CharPos = 0; CharPos < LCD_LINE_MAX_CHAR; CharPos++)
 808  00c4 0c01          	inc	(OFST+0,sp)
 811  00c6 7b01          	ld	a,(OFST+0,sp)
 812  00c8 a10f          	cp	a,#15
 813  00ca 25f2          	jrult	L313
 814                     ; 349 }
 817  00cc 84            	pop	a
 818  00cd 81            	ret	
 862                     ; 365 void LCD_SetCursorPos(u8 Line, u8 Offset)
 862                     ; 366 {
 863                     	switch	.text
 864  00ce               _LCD_SetCursorPos:
 866  00ce 89            	pushw	x
 867       00000000      OFST:	set	0
 870                     ; 367   LCD_SendByte(COMMAND_TYPE, (u8)(Line + Offset));
 872  00cf 9e            	ld	a,xh
 873  00d0 1b02          	add	a,(OFST+2,sp)
 874  00d2 97            	ld	xl,a
 875  00d3 a6f8          	ld	a,#248
 876  00d5 95            	ld	xh,a
 877  00d6 cd0036        	call	_LCD_SendByte
 879                     ; 368 }
 882  00d9 85            	popw	x
 883  00da 81            	ret	
 918                     ; 384 void LCD_PrintChar(u8 Ascii)
 918                     ; 385 {
 919                     	switch	.text
 920  00db               _LCD_PrintChar:
 924                     ; 386   LCD_SendByte(DATA_TYPE, Ascii);
 926  00db 97            	ld	xl,a
 927  00dc a6fa          	ld	a,#250
 928  00de 95            	ld	xh,a
 930                     ; 387 }
 933  00df cc0036        	jp	_LCD_SendByte
1007                     ; 405 void LCD_PrintString(u8 Line, FunctionalState AutoComplete, FunctionalState Append, u8 *ptr)
1007                     ; 406 {
1008                     	switch	.text

⌨️ 快捷键说明

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