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

📄 mc_stm8s_lcd.ls

📁 STM8S105 BLDC源代码
💻 LS
📖 第 1 页 / 共 4 页
字号:
1670  0264 1e05          	ldw	x,(OFST-1,sp)
1671  0266 72f001        	subw	x,(OFST-5,sp)
1672  0269 1f05          	ldw	(OFST-1,sp),x
1673                     ; 647     LCD_PrintChar((u8)(Nbre1Tmp + (u8)0x30));
1675  026b 7b06          	ld	a,(OFST+0,sp)
1676  026d ab30          	add	a,#48
1677  026f cd00db        	call	_LCD_PrintChar
1679  0272               L146:
1680                     ; 650 }
1683  0272 5b08          	addw	sp,#8
1684  0274 81            	ret	
1719                     ; 667 void LCD_PrintHex1(u8 Number)
1719                     ; 668 {
1720                     	switch	.text
1721  0275               _LCD_PrintHex1:
1723  0275 88            	push	a
1724       00000000      OFST:	set	0
1727                     ; 669   if (Number < (u8)0x0A)
1729  0276 a10a          	cp	a,#10
1730  0278 2404          	jruge	L166
1731                     ; 671     LCD_PrintChar((u8)(Number + (u8)0x30));
1733  027a ab30          	add	a,#48
1736  027c 200c          	jra	L366
1737  027e               L166:
1738                     ; 674     if (Number < (u8)0x10)
1740  027e 7b01          	ld	a,(OFST+1,sp)
1741  0280 a110          	cp	a,#16
1742  0282 2404          	jruge	L566
1743                     ; 676       LCD_PrintChar((u8)(Number + (u8)0x37));
1745  0284 ab37          	add	a,#55
1748  0286 2002          	jra	L366
1749  0288               L566:
1750                     ; 680       LCD_PrintChar('-');
1752  0288 a62d          	ld	a,#45
1754  028a               L366:
1755  028a cd00db        	call	_LCD_PrintChar
1756                     ; 682 }
1759  028d 84            	pop	a
1760  028e 81            	ret	
1795                     ; 699 void LCD_PrintHex2(u8 Number)
1795                     ; 700 {
1796                     	switch	.text
1797  028f               _LCD_PrintHex2:
1799  028f 88            	push	a
1800       00000000      OFST:	set	0
1803                     ; 701   LCD_PrintHex1((u8)(Number >> (u8)4));
1805  0290 4e            	swap	a
1806  0291 a40f          	and	a,#15
1807  0293 ade0          	call	_LCD_PrintHex1
1809                     ; 702   LCD_PrintHex1((u8)(Number & (u8)0x0F));
1811  0295 7b01          	ld	a,(OFST+1,sp)
1812  0297 a40f          	and	a,#15
1813  0299 adda          	call	_LCD_PrintHex1
1815                     ; 703 }
1818  029b 84            	pop	a
1819  029c 81            	ret	
1854                     ; 720 void LCD_PrintHex3(u16 Number)
1854                     ; 721 {
1855                     	switch	.text
1856  029d               _LCD_PrintHex3:
1858  029d 89            	pushw	x
1859       00000000      OFST:	set	0
1862                     ; 722   LCD_PrintHex1((u8)(Number >> (u8)8)); 
1864  029e 9e            	ld	a,xh
1865  029f add4          	call	_LCD_PrintHex1
1867                     ; 723   LCD_PrintHex1((u8)((u8)(Number) >> (u8)4));
1869  02a1 7b02          	ld	a,(OFST+2,sp)
1870  02a3 4e            	swap	a
1871  02a4 a40f          	and	a,#15
1872  02a6 adcd          	call	_LCD_PrintHex1
1874                     ; 724   LCD_PrintHex1((u8)((u8)(Number) & (u8)0x0F));
1876  02a8 7b02          	ld	a,(OFST+2,sp)
1877  02aa a40f          	and	a,#15
1878  02ac adc7          	call	_LCD_PrintHex1
1880                     ; 725 }
1883  02ae 85            	popw	x
1884  02af 81            	ret	
1919                     ; 742 void LCD_PrintBin2(u8 Number)
1919                     ; 743 {
1920                     	switch	.text
1921  02b0               _LCD_PrintBin2:
1923  02b0 88            	push	a
1924       00000000      OFST:	set	0
1927                     ; 744   LCD_PrintHex1((u8)((u8)(Number & (u8)0x02) >> (u8)1));
1929  02b1 a402          	and	a,#2
1930  02b3 44            	srl	a
1931  02b4 adbf          	call	_LCD_PrintHex1
1933                     ; 745   LCD_PrintHex1((u8)(Number & (u8)0x01));
1935  02b6 7b01          	ld	a,(OFST+1,sp)
1936  02b8 a401          	and	a,#1
1937  02ba adb9          	call	_LCD_PrintHex1
1939                     ; 746 }
1942  02bc 84            	pop	a
1943  02bd 81            	ret	
1978                     ; 763 void LCD_PrintBin4(u8 Number)
1978                     ; 764 {
1979                     	switch	.text
1980  02be               _LCD_PrintBin4:
1982  02be 88            	push	a
1983       00000000      OFST:	set	0
1986                     ; 765   LCD_PrintHex1((u8)((u8)(Number & (u8)0x08) >> (u8)3));
1988  02bf a408          	and	a,#8
1989  02c1 44            	srl	a
1990  02c2 44            	srl	a
1991  02c3 44            	srl	a
1992  02c4 adaf          	call	_LCD_PrintHex1
1994                     ; 766   LCD_PrintHex1((u8)((u8)(Number & (u8)0x04) >> (u8)2));
1996  02c6 7b01          	ld	a,(OFST+1,sp)
1997  02c8 a404          	and	a,#4
1998  02ca 44            	srl	a
1999  02cb 44            	srl	a
2000  02cc ada7          	call	_LCD_PrintHex1
2002                     ; 767   LCD_PrintHex1((u8)((u8)(Number & (u8)0x02) >> (u8)1));
2004  02ce 7b01          	ld	a,(OFST+1,sp)
2005  02d0 a402          	and	a,#2
2006  02d2 44            	srl	a
2007  02d3 ada0          	call	_LCD_PrintHex1
2009                     ; 768   LCD_PrintHex1((u8)(Number & (u8)0x01));
2011  02d5 7b01          	ld	a,(OFST+1,sp)
2012  02d7 a401          	and	a,#1
2013  02d9 ad9a          	call	_LCD_PrintHex1
2015                     ; 769 }
2018  02db 84            	pop	a
2019  02dc 81            	ret	
2073                     ; 785 void LCD_DisplayCGRAM0(u8 address, u8 *ptrTable)
2073                     ; 786 {
2074                     	switch	.text
2075  02dd               _LCD_DisplayCGRAM0:
2077  02dd 88            	push	a
2078  02de 88            	push	a
2079       00000001      OFST:	set	1
2082                     ; 791   LCD_SendByte(COMMAND_TYPE, (u8)0x40);
2084  02df aef840        	ldw	x,#63552
2085  02e2 cd0036        	call	_LCD_SendByte
2087                     ; 793   u = 32; /* Nb byte in the table */
2089  02e5 a620          	ld	a,#32
2090  02e7 6b01          	ld	(OFST+0,sp),a
2091  02e9               L7001:
2092                     ; 796     LCD_SendByte(DATA_TYPE, ptrTable[32 - u]);
2094  02e9 4f            	clr	a
2095  02ea 97            	ld	xl,a
2096  02eb a620          	ld	a,#32
2097  02ed 1001          	sub	a,(OFST+0,sp)
2098  02ef 2401          	jrnc	L652
2099  02f1 5a            	decw	x
2100  02f2               L652:
2101  02f2 02            	rlwa	x,a
2102  02f3 72fb05        	addw	x,(OFST+4,sp)
2103  02f6 f6            	ld	a,(x)
2104  02f7 97            	ld	xl,a
2105  02f8 a6fa          	ld	a,#250
2106  02fa 95            	ld	xh,a
2107  02fb cd0036        	call	_LCD_SendByte
2109                     ; 797     u--;
2109                     ; 798   }
2109                     ; 799 
2109                     ; 800   /* Setup Display Address */
2109                     ; 801   LCD_SendByte(COMMAND_TYPE, address);
2109                     ; 802   LCD_SendByte(DATA_TYPE, (u8)0x00);
2109                     ; 803   LCD_SendByte(DATA_TYPE, (u8)0x00);
2109                     ; 804 
2109                     ; 805 }
2109                     ; 806 
2109                     ; 807 /**
2109                     ; 808   * @brief Display CGRAM on odd address
2109                     ; 809   * @param[in] address Display address
2109                     ; 810   * @param[in] ptrTable Pointer a the CGRAM table to be displayed
2109                     ; 811   * @retval void None
2109                     ; 812   * @par Required preconditions:
2109                     ; 813   * - LCD must be enabled
2109                     ; 814   * @par Functions called:
2109                     ; 815   * - LCD_SendByte
2109                     ; 816   * @par Example:
2109                     ; 817   * @code
2109                     ; 818   * LCD_DisplayCGRAM1(0x80);
2109                     ; 819   * @endcode
2109                     ; 820   */
2109                     ; 821 void LCD_DisplayCGRAM1(u8 address, u8 *ptrTable)
2109                     ; 822 {
2109                     ; 823 
2109                     ; 824   u8 u;
2109                     ; 825 
2109                     ; 826  /* Set CGRAM Address */
2109                     ; 827   LCD_SendByte(COMMAND_TYPE, (u8)((u8)0x40 | (u8)0x10));
2109                     ; 828 
2109                     ; 829   u = 32; /* Nb byte in the table */
2109                     ; 830   while (u)
2109                     ; 831   {
2109                     ; 832     LCD_SendByte(DATA_TYPE, ptrTable[32 - u]);
2109                     ; 833     u--;
2109                     ; 834   }
2109                     ; 835 
2109                     ; 836   /* Setup Display Address */
2109                     ; 837   LCD_SendByte(COMMAND_TYPE, (u8)(address + 1));
2109                     ; 838   LCD_SendByte(DATA_TYPE, (u8)0x00);
2109                     ; 839   LCD_SendByte(DATA_TYPE, (u8)0x02);
2109                     ; 840 
2109                     ; 841 }
2109                     ; 842 
2109                     ; 843 /**
2109                     ; 844   * @brief Display ST logo
2109                     ; 845   * @param[in] address Display address (LINE1:0x80-0x87 and LINE2:0x90-0x97)
2109                     ; 846   * @retval void None
2109                     ; 847   * @par Required preconditions:
2109                     ; 848   * - LCD must be enabled
2109                     ; 849   * @par Functions called:
2109                     ; 850   * - LCD_SendByte
2109                     ; 851   * @par Example:
2109                     ; 852   * @code
2109                     ; 853   * LCD_DisplayLogo(0x80);
2109                     ; 854   * @endcode
2109                     ; 855   */
2109                     ; 856 void LCD_DisplayLogo(u8 address)
2109                     ; 857 {
2109                     ; 858   LCD_DisplayCGRAM0(address, S_CGRAM);
2109                     ; 859   LCD_DisplayCGRAM1(address, T_CGRAM);
2109                     ; 860 }
2109                     ; 861 
2109                     ; 862 /**
2109                     ; 863   * @brief Display a string in rolling mode
2109                     ; 864   * @param[in] Line Line used for displaying the text (LCD_LINE1 or LCD_LINE2)
2109                     ; 865   * @param[in] ptr Pointer to the text to display
2109                     ; 866   * @param[in] speed Rolling speed
2109                     ; 867   * @retval void None
2109                     ; 868   * @par Required preconditions:
2109                     ; 869   * - LCD must be enabled
2109                     ; 870   * @par Functions called:
2109                     ; 871   * - LCD_SendByte
2109                     ; 872   * - LCD_ClearLine
2109                     ; 873   * - LCD_Delay
2109                     ; 874   * @par Example:
2109                     ; 875   * @code
2109                     ; 876   * u8 *pText;
2109                     ; 877   * pText = "Welcome into the fabulous world of STM8...";
2109                     ; 878   * LCD_RollString(LCD_LINE2, pText, 0xC000);
2109                     ; 879   * @endcode
2109                     ; 880   */
2109                     ; 881 void LCD_RollString(u8 Line, u8 *ptr, u16 speed)
2109                     ; 882 {
2109                     ; 883 
2109                     ; 884   u8 CharPos = 0;
2109                     ; 885   u8 *ptr2;
2109                     ; 886   
2109                     ; 887   /* Set cursor position at beginning of line */
2109                     ; 888   LCD_SendByte(COMMAND_TYPE, Line);
2109                     ; 889   
2109                     ; 890   ptr2 = ptr;
2109                     ; 891   
2109                     ; 892   /* Display each character of the string */
2109                     ; 893   while (*ptr2 != 0)
2109                     ; 894   {
2109                     ; 895    
2109                     ; 896     if (*ptr != 0)
2109                     ; 897     {
2109                     ; 898       LCD_SendByte(DATA_TYPE, *ptr);
2109                     ; 899       ptr++;
2109                     ; 900     }
2109                     ; 901     else
2109                     ; 902     {
2109                     ; 903       LCD_SendByte(DATA_TYPE, ' ');
2109                     ; 904     }
2109                     ; 905     
2109                     ; 906     CharPos++;
2109                     ; 907    
2109                     ; 908     if (CharPos == LCD_LINE_MAX_CHAR)
2109                     ; 909     {
2109                     ; 910       LCD_Delay(speed);
2109                     ; 911       LCD_ClearLine(Line);
2109                     ; 912       LCD_SendByte(COMMAND_TYPE, Line);
2109                     ; 913       CharPos = 0;
2109                     ; 914       ptr2++;
2109                     ; 915       ptr = ptr2;
2109                     ; 916     }
2109                     ; 917     
2109                     ; 918   }
2109                     ; 919 
2109                     ; 920 }
2109                     ; 921 /**
2109                     ; 922   * @brief Display a string from current position of the LCD cursor
2109                     ; 923   * @param[in] ptr Pointer to the string to display
2109                     ; 924   * @retval void None
2109                     ; 925   * @par Required preconditions:
2109                     ; 926   * - LCD must be enabled
2109                     ; 927   * @par Functions called:
2109                     ; 928   * - LCD_SendByte
2109                     ; 929   * @par Example:
2109                     ; 930   * @code
2109                     ; 931   * LCD_Print("Hello");
2109                     ; 932   * @endcode
2109                     ; 933   */
2109                     ; 934 void LCD_Print(u8 *ptr) {
2109                     ; 935   while (*ptr) 					// Display the string */
2109                     ; 936   LCD_SendByte(DATA_TYPE, *ptr++);
2109                     ; 937 }
2109                     ; 938 /**
2109                     ; 939   * @}
2109                     ; 940   */
2109                     ; 941 
2109                     ; 942 /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
2111  02fe 0a01          	dec	(OFST+0,sp)
2112                     ; 794   while (u)
2112                     ; 795   {
2112                     ; 796     LCD_SendByte(DATA_TYPE, ptrTable[32 - u]);
2112                     ; 797     u--;
2114  0300 26e7          	jrne	L7001
2115                     ; 801   LCD_SendByte(COMMAND_TYPE, address);
2117  0302 7b02          	ld	a,(OFST+1,sp)
2118  0304 97            	ld	xl,a
2119  0305 a6f8          	ld	a,#248
2120  0307 95            	ld	xh,a
2121  0308 cd0036        	call	_LCD_SendByte
2123                     ; 802   LCD_SendByte(DATA_TYPE, (u8)0x00);
2125  030b aefa00        	ldw	x,#64000
2126  030e cd0036        	call	_LCD_SendByte
2128                     ; 803   LCD_SendByte(DATA_TYPE, (u8)0x00);
2130  0311 aefa00        	ldw	x,#64000

⌨️ 快捷键说明

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