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

📄 mc_stm8s_lcd.ls

📁 STM8S105 BLDC源代码
💻 LS
📖 第 1 页 / 共 4 页
字号:
2131  0314 cd0036        	call	_LCD_SendByte
2133                     ; 805 }
2136  0317 85            	popw	x
2137  0318 81            	ret	
2191                     ; 821 void LCD_DisplayCGRAM1(u8 address, u8 *ptrTable)
2191                     ; 822 {
2192                     	switch	.text
2193  0319               _LCD_DisplayCGRAM1:
2195  0319 88            	push	a
2196  031a 88            	push	a
2197       00000001      OFST:	set	1
2200                     ; 827   LCD_SendByte(COMMAND_TYPE, (u8)((u8)0x40 | (u8)0x10));
2202  031b aef850        	ldw	x,#63568
2203  031e cd0036        	call	_LCD_SendByte
2205                     ; 829   u = 32; /* Nb byte in the table */
2207  0321 a620          	ld	a,#32
2208  0323 6b01          	ld	(OFST+0,sp),a
2209  0325               L3401:
2210                     ; 832     LCD_SendByte(DATA_TYPE, ptrTable[32 - u]);
2212  0325 4f            	clr	a
2213  0326 97            	ld	xl,a
2214  0327 a620          	ld	a,#32
2215  0329 1001          	sub	a,(OFST+0,sp)
2216  032b 2401          	jrnc	L472
2217  032d 5a            	decw	x
2218  032e               L472:
2219  032e 02            	rlwa	x,a
2220  032f 72fb05        	addw	x,(OFST+4,sp)
2221  0332 f6            	ld	a,(x)
2222  0333 97            	ld	xl,a
2223  0334 a6fa          	ld	a,#250
2224  0336 95            	ld	xh,a
2225  0337 cd0036        	call	_LCD_SendByte
2227                     ; 833     u--;
2227                     ; 834   }
2227                     ; 835 
2227                     ; 836   /* Setup Display Address */
2227                     ; 837   LCD_SendByte(COMMAND_TYPE, (u8)(address + 1));
2227                     ; 838   LCD_SendByte(DATA_TYPE, (u8)0x00);
2227                     ; 839   LCD_SendByte(DATA_TYPE, (u8)0x02);
2227                     ; 840 
2227                     ; 841 }
2227                     ; 842 
2227                     ; 843 /**
2227                     ; 844   * @brief Display ST logo
2227                     ; 845   * @param[in] address Display address (LINE1:0x80-0x87 and LINE2:0x90-0x97)
2227                     ; 846   * @retval void None
2227                     ; 847   * @par Required preconditions:
2227                     ; 848   * - LCD must be enabled
2227                     ; 849   * @par Functions called:
2227                     ; 850   * - LCD_SendByte
2227                     ; 851   * @par Example:
2227                     ; 852   * @code
2227                     ; 853   * LCD_DisplayLogo(0x80);
2227                     ; 854   * @endcode
2227                     ; 855   */
2227                     ; 856 void LCD_DisplayLogo(u8 address)
2227                     ; 857 {
2227                     ; 858   LCD_DisplayCGRAM0(address, S_CGRAM);
2227                     ; 859   LCD_DisplayCGRAM1(address, T_CGRAM);
2227                     ; 860 }
2227                     ; 861 
2227                     ; 862 /**
2227                     ; 863   * @brief Display a string in rolling mode
2227                     ; 864   * @param[in] Line Line used for displaying the text (LCD_LINE1 or LCD_LINE2)
2227                     ; 865   * @param[in] ptr Pointer to the text to display
2227                     ; 866   * @param[in] speed Rolling speed
2227                     ; 867   * @retval void None
2227                     ; 868   * @par Required preconditions:
2227                     ; 869   * - LCD must be enabled
2227                     ; 870   * @par Functions called:
2227                     ; 871   * - LCD_SendByte
2227                     ; 872   * - LCD_ClearLine
2227                     ; 873   * - LCD_Delay
2227                     ; 874   * @par Example:
2227                     ; 875   * @code
2227                     ; 876   * u8 *pText;
2227                     ; 877   * pText = "Welcome into the fabulous world of STM8...";
2227                     ; 878   * LCD_RollString(LCD_LINE2, pText, 0xC000);
2227                     ; 879   * @endcode
2227                     ; 880   */
2227                     ; 881 void LCD_RollString(u8 Line, u8 *ptr, u16 speed)
2227                     ; 882 {
2227                     ; 883 
2227                     ; 884   u8 CharPos = 0;
2227                     ; 885   u8 *ptr2;
2227                     ; 886   
2227                     ; 887   /* Set cursor position at beginning of line */
2227                     ; 888   LCD_SendByte(COMMAND_TYPE, Line);
2227                     ; 889   
2227                     ; 890   ptr2 = ptr;
2227                     ; 891   
2227                     ; 892   /* Display each character of the string */
2227                     ; 893   while (*ptr2 != 0)
2227                     ; 894   {
2227                     ; 895    
2227                     ; 896     if (*ptr != 0)
2227                     ; 897     {
2227                     ; 898       LCD_SendByte(DATA_TYPE, *ptr);
2227                     ; 899       ptr++;
2227                     ; 900     }
2227                     ; 901     else
2227                     ; 902     {
2227                     ; 903       LCD_SendByte(DATA_TYPE, ' ');
2227                     ; 904     }
2227                     ; 905     
2227                     ; 906     CharPos++;
2227                     ; 907    
2227                     ; 908     if (CharPos == LCD_LINE_MAX_CHAR)
2227                     ; 909     {
2227                     ; 910       LCD_Delay(speed);
2227                     ; 911       LCD_ClearLine(Line);
2227                     ; 912       LCD_SendByte(COMMAND_TYPE, Line);
2227                     ; 913       CharPos = 0;
2227                     ; 914       ptr2++;
2227                     ; 915       ptr = ptr2;
2227                     ; 916     }
2227                     ; 917     
2227                     ; 918   }
2227                     ; 919 
2227                     ; 920 }
2227                     ; 921 /**
2227                     ; 922   * @brief Display a string from current position of the LCD cursor
2227                     ; 923   * @param[in] ptr Pointer to the string to display
2227                     ; 924   * @retval void None
2227                     ; 925   * @par Required preconditions:
2227                     ; 926   * - LCD must be enabled
2227                     ; 927   * @par Functions called:
2227                     ; 928   * - LCD_SendByte
2227                     ; 929   * @par Example:
2227                     ; 930   * @code
2227                     ; 931   * LCD_Print("Hello");
2227                     ; 932   * @endcode
2227                     ; 933   */
2227                     ; 934 void LCD_Print(u8 *ptr) {
2227                     ; 935   while (*ptr) 					// Display the string */
2227                     ; 936   LCD_SendByte(DATA_TYPE, *ptr++);
2227                     ; 937 }
2227                     ; 938 /**
2227                     ; 939   * @}
2227                     ; 940   */
2227                     ; 941 
2227                     ; 942 /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
2229  033a 0a01          	dec	(OFST+0,sp)
2230                     ; 830   while (u)
2230                     ; 831   {
2230                     ; 832     LCD_SendByte(DATA_TYPE, ptrTable[32 - u]);
2230                     ; 833     u--;
2232  033c 26e7          	jrne	L3401
2233                     ; 837   LCD_SendByte(COMMAND_TYPE, (u8)(address + 1));
2235  033e 7b02          	ld	a,(OFST+1,sp)
2236  0340 4c            	inc	a
2237  0341 97            	ld	xl,a
2238  0342 a6f8          	ld	a,#248
2239  0344 95            	ld	xh,a
2240  0345 cd0036        	call	_LCD_SendByte
2242                     ; 838   LCD_SendByte(DATA_TYPE, (u8)0x00);
2244  0348 aefa00        	ldw	x,#64000
2245  034b cd0036        	call	_LCD_SendByte
2247                     ; 839   LCD_SendByte(DATA_TYPE, (u8)0x02);
2249  034e aefa02        	ldw	x,#64002
2250  0351 cd0036        	call	_LCD_SendByte
2252                     ; 841 }
2255  0354 85            	popw	x
2256  0355 81            	ret	
2294                     ; 856 void LCD_DisplayLogo(u8 address)
2294                     ; 857 {
2295                     	switch	.text
2296  0356               _LCD_DisplayLogo:
2298  0356 88            	push	a
2299       00000000      OFST:	set	0
2302                     ; 858   LCD_DisplayCGRAM0(address, S_CGRAM);
2304  0357 ae0000        	ldw	x,#_S_CGRAM
2305  035a 89            	pushw	x
2306  035b ad80          	call	_LCD_DisplayCGRAM0
2308  035d 85            	popw	x
2309                     ; 859   LCD_DisplayCGRAM1(address, T_CGRAM);
2311  035e ae0020        	ldw	x,#_T_CGRAM
2312  0361 89            	pushw	x
2313  0362 7b03          	ld	a,(OFST+3,sp)
2314  0364 adb3          	call	_LCD_DisplayCGRAM1
2316  0366 85            	popw	x
2317                     ; 860 }
2320  0367 84            	pop	a
2321  0368 81            	ret	
2396                     ; 881 void LCD_RollString(u8 Line, u8 *ptr, u16 speed)
2396                     ; 882 {
2397                     	switch	.text
2398  0369               _LCD_RollString:
2400  0369 88            	push	a
2401  036a 5203          	subw	sp,#3
2402       00000003      OFST:	set	3
2405                     ; 884   u8 CharPos = 0;
2407  036c 0f01          	clr	(OFST-2,sp)
2408                     ; 888   LCD_SendByte(COMMAND_TYPE, Line);
2410  036e 97            	ld	xl,a
2411  036f a6f8          	ld	a,#248
2412  0371 95            	ld	xh,a
2413  0372 cd0036        	call	_LCD_SendByte
2415                     ; 890   ptr2 = ptr;
2417  0375 1e07          	ldw	x,(OFST+4,sp)
2418  0377 1f02          	ldw	(OFST-1,sp),x
2420  0379 203d          	jra	L1311
2421  037b               L5211:
2422                     ; 896     if (*ptr != 0)
2424  037b 1e07          	ldw	x,(OFST+4,sp)
2425  037d f6            	ld	a,(x)
2426  037e 270e          	jreq	L5311
2427                     ; 898       LCD_SendByte(DATA_TYPE, *ptr);
2429  0380 97            	ld	xl,a
2430  0381 a6fa          	ld	a,#250
2431  0383 95            	ld	xh,a
2432  0384 cd0036        	call	_LCD_SendByte
2434                     ; 899       ptr++;
2436  0387 1e07          	ldw	x,(OFST+4,sp)
2437  0389 5c            	incw	x
2438  038a 1f07          	ldw	(OFST+4,sp),x
2440  038c 2006          	jra	L7311
2441  038e               L5311:
2442                     ; 903       LCD_SendByte(DATA_TYPE, ' ');
2444  038e aefa20        	ldw	x,#64032
2445  0391 cd0036        	call	_LCD_SendByte
2447  0394               L7311:
2448                     ; 906     CharPos++;
2450  0394 0c01          	inc	(OFST-2,sp)
2451                     ; 908     if (CharPos == LCD_LINE_MAX_CHAR)
2453  0396 7b01          	ld	a,(OFST-2,sp)
2454  0398 a10f          	cp	a,#15
2455  039a 261c          	jrne	L1311
2456                     ; 910       LCD_Delay(speed);
2458  039c 1e09          	ldw	x,(OFST+6,sp)
2459  039e cd0000        	call	_LCD_Delay
2461                     ; 911       LCD_ClearLine(Line);
2463  03a1 7b04          	ld	a,(OFST+1,sp)
2464  03a3 cd00b4        	call	_LCD_ClearLine
2466                     ; 912       LCD_SendByte(COMMAND_TYPE, Line);
2468  03a6 7b04          	ld	a,(OFST+1,sp)
2469  03a8 97            	ld	xl,a
2470  03a9 a6f8          	ld	a,#248
2471  03ab 95            	ld	xh,a
2472  03ac cd0036        	call	_LCD_SendByte
2474                     ; 913       CharPos = 0;
2476  03af 0f01          	clr	(OFST-2,sp)
2477                     ; 914       ptr2++;
2479  03b1 1e02          	ldw	x,(OFST-1,sp)
2480  03b3 5c            	incw	x
2481  03b4 1f02          	ldw	(OFST-1,sp),x
2482                     ; 915       ptr = ptr2;
2484  03b6 1f07          	ldw	(OFST+4,sp),x
2485  03b8               L1311:
2486                     ; 893   while (*ptr2 != 0)
2488  03b8 1e02          	ldw	x,(OFST-1,sp)
2489  03ba f6            	ld	a,(x)
2490  03bb 26be          	jrne	L5211
2491                     ; 920 }
2494  03bd 5b04          	addw	sp,#4
2495  03bf 81            	ret	
2531                     ; 934 void LCD_Print(u8 *ptr) {
2532                     	switch	.text
2533  03c0               _LCD_Print:
2535  03c0 89            	pushw	x
2536       00000000      OFST:	set	0
2539  03c1 200a          	jra	L3611
2540  03c3               L1611:
2541                     ; 936   LCD_SendByte(DATA_TYPE, *ptr++);
2543  03c3 5c            	incw	x
2544  03c4 1f01          	ldw	(OFST+1,sp),x
2545  03c6 97            	ld	xl,a
2546  03c7 a6fa          	ld	a,#250
2547  03c9 95            	ld	xh,a
2548  03ca cd0036        	call	_LCD_SendByte
2550  03cd               L3611:
2551                     ; 935   while (*ptr) 					// Display the string */
2553  03cd 1e01          	ldw	x,(OFST+1,sp)
2554  03cf f6            	ld	a,(x)
2555  03d0 26f1          	jrne	L1611
2556                     ; 937 }
2559  03d2 85            	popw	x
2560  03d3 81            	ret	
2595                     	xdef	_LCD_Delay
2596                     	xdef	_T_CGRAM
2597                     	xdef	_S_CGRAM
2598                     	xdef	_LCD_RollString
2599                     	xdef	_LCD_DisplayLogo
2600                     	xdef	_LCD_DisplayCGRAM1
2601                     	xdef	_LCD_DisplayCGRAM0
2602                     	xdef	_LCD_PrintBin4
2603                     	xdef	_LCD_PrintBin2
2604                     	xdef	_LCD_PrintHex3
2605                     	xdef	_LCD_PrintHex2
2606                     	xdef	_LCD_PrintHex1
2607                     	xdef	_LCD_PrintDec4
2608                     	xdef	_LCD_PrintDec3
2609                     	xdef	_LCD_PrintDec2
2610                     	xdef	_LCD_PrintDec1
2611                     	xdef	_LCD_Print
2612                     	xdef	_LCD_PrintMsg
2613                     	xdef	_LCD_PrintString
2614                     	xdef	_LCD_PrintChar
2615                     	xdef	_LCD_SetCursorPos
2616                     	xdef	_LCD_ClearLine
2617                     	xdef	_LCD_SetGraphicMode
2618                     	xdef	_LCD_SetTextMode
2619                     	xdef	_LCD_Clear
2620                     	xdef	_LCD_Init
2621                     	xdef	_LCD_SendBuffer
2622                     	xdef	_LCD_SendByte
2623                     	xdef	_LCD_ChipSelect
2624                     	xdef	_LCD_ReadStatus
2625                     	xref	_GPIO_WriteLow
2626                     	xref	_GPIO_WriteHigh
2627                     	xref	_GPIO_Init
2628                     	xref.b	c_x
2647                     	xref	c_imul
2648                     	end

⌨️ 快捷键说明

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