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

📄 rd_lcd1602b.s

📁 移动机器人(小车)的物理坐标和逻辑坐标的转换源码
💻 S
📖 第 1 页 / 共 3 页
字号:
; {
	.dbline -2
L30:
	.dbline 0 ; func end
	ret
	.dbend
	.dbfunc e StringLength _StringLength fc
;             n0 -> R10
;         String -> R16,R17
	.even
_StringLength::
	st -y,R10
	.dbline -1
	.dbline 523
;     /*
;    static UINT8 StringHead = 0;
; 	UINT8 SCREEN[17];
; 	UINT8 a = 0;
; 	UINT8 Point = StringHead;
; 	UINT8 StringLong = StringLength(String);
; 	static UINT16 RunTimeCounter = 0;
; 	
; 	for (a = 0;a<EndX - StartX + 1;a++)
; 	{
; 	     SCREEN[a] = String[Point];
; 		 Point ++;
; 		 if (Point == StringLong)
; 		 {
; 		     Point = 0;
; 		 }
; 	}
; 	
;     for (;a < 17;a++)
; 	{
; 	    SCREEN[a] = 0;
; 	}
; 	
; 	RunTimeCounter ++;
; 	if (RunTimeCounter > LCD_RUN_STRING_SPEED)
; 	{
; 	    StringHead ++;
; 		RunTimeCounter = 0;
; 		if (StringHead == StringLong)
; 	    {
; 	        StringHead = 0;
; 	    }
; 	}
; 	
; 	LOCATE(StartX,Y)
; 	PRINT(SCREEN)*/
; }
; 
; /***********************************************************
; *   函数说明:字符串长度测试函数                           *
; *   输入:    字符串指针                                   *
; *   输出:    字符串的长度                                 *
; *   调用函数:无                                           *
; ***********************************************************/
; UINT8 StringLength(UINT8 *String)
; {
	.dbline 524
;     UINT8 n = 0;
	clr R10
	rjmp L33
L32:
	.dbline 526
; 	while (*String)
; 	{
	.dbline 527
; 	    n++;
	inc R10
	.dbline 528
; 		String ++;
	subi R16,255  ; offset = 1
	sbci R17,255
	.dbline 529
; 	}
L33:
	.dbline 525
	movw R30,R16
	ldd R2,z+0
	tst R2
	brne L32
X6:
	.dbline 531
; 	
; 	return n;
	mov R16,R10
	.dbline -2
L31:
	.dbline 0 ; func end
	ld R10,y+
	ret
	.dbsym r n0 10 c
	.dbsym r String 16 pc
	.dbend
	.area lit(rom, con, rel)
L36:
	.byte 0
	.byte 0,0,0,0,0,0,0,0,0
	.area text(rom, con, rel)
	.dbfile E:\单片机\ROOBCO~1\全向定位系统\坐标转换模块\相对定位模块测试版\Relative_Locate_Module\RD_LCD1602B.c
	.dbfunc e PrintD _PrintD fV
;      cTempBuff -> y+5
;             n3 -> R10
; bIfFindFirstNoneZeroNumber1 -> R22
;             n1 -> R22
;   wTempNumber0 -> y+1
;      chCounter -> R20
;        nNumber -> y+25
	.even
_PrintD::
	rcall push_arg4
	rcall push_xgsetF00C
	sbiw R28,19
	ldd R20,y+29
	.dbline -1
	.dbline 612
; }
; 
; /***********************************************************
; *   函数说明:闪烁显示函数                                 *
; *   输入:    要显示的字符串、显示的光标、x,y坐标位置      *
; *   输出:    无                                           *
; *   调用函数:LOCATE()  LCDWaitForReady() LCDSendData()    *
; ***********************************************************/
; /*
; void Flash(UINT8 *String,UINT8 Icon,UINT8 X,UINT8 Y)
; {
;     UINT8 a = 0;
; 	UINT8 StringLong = StringLength(String);
; 	
;     if ((SYS_TIMER_MS_ADD_UNTILL_OVF & LCD_FLASH_TIME_OUT) 
;         > (LCD_FLASH_TIME_OUT >> 1))
; 	{
; 	    LOCATE(X,Y)
; 		PRINT(String)    
; 	}
; 	else
; 	{
; 	    for (a = X;a < (X+StringLong);a++)
; 		{
; 		    LOCATE(a,Y)
; 			LCDWaitForReady();
; 			LCDSendData(Icon);
; 		}
; 	}
; }*/
; 
; /***********************************************************
; *   函数说明:字幕GIF函数                                  *
; *   输入:    要显示的字符串集合指针,字符串数目,位置     *
; *   输出:    无                                           *
; *   调用函数:LOCATE()  PRINT()                            *
; ***********************************************************/
; /*
; void FlashStringGroup(UINT8 String[][17],UINT8 StringCounter,UINT8 X,UINT8 Y)
; {
;     static UINT8 Pictures = 0;
; 	static UINT8 DispState = 0;
;     if ((SYS_TIMER_MS_ADD_UNTILL_OVF & LCD_FLASH_STRING_GROUP_TIME_OUT) 
;         > (LCD_FLASH_STRING_GROUP_TIME_OUT >> 1))
; 	{
; 	    if (DispState == 0)
; 		{
; 	        Pictures ++;
; 		    if (Pictures == StringCounter)
; 		    {
; 		        Pictures = 0; 
; 		    }
; 			DispState = 1;
; 		}
; 	}
; 	else
; 	{
; 	    if (DispState == 1)
; 		{
; 		    Pictures ++;
; 			if (Pictures == StringCounter)
; 			{
; 			    Pictures = 0;
; 			}
; 			DispState = 0;
; 		}
; 	}
; 	
; 	LOCATE(X,Y);
; 	PRINT(String[Pictures]);
; }
; */
; 
; /***********************************************************
; *   函数说明:数值显示函数                                 *
; *   输入:    要显示的整数                                 *
; *   输出:    无                                           *
; *   调用函数:无                                           *
; ***********************************************************/
; void PrintD(INT32 nNumber,UINT8 chCounter)
; {
	.dbline 613
;     uint8 cTempBuff[10] = {0};
	ldi R24,<L36
	ldi R25,>L36
	movw R30,R28
	adiw R30,5
	ldi R16,10
	ldi R17,0
	st -y,R31
	st -y,R30
	st -y,R25
	st -y,R24
	rcall asgncblk
	.dbline 614
;     uint8 n = 0;
	.dbline 615
;     uint32 wTempNumber = ABS(nNumber);
	ldi R24,0
	ldi R25,0
	ldi R26,0
	ldi R27,0
	ldd R2,y+25
	ldd R3,y+26
	ldd R4,y+27
	ldd R5,y+28
	cp R2,R24
	cpc R3,R25
	cpc R4,R26
	cpc R5,R27
	brge L37
X7:
	movw R16,R2
	movw R18,R4
	rcall neg32
	std y+15,R16
	std y+16,R17
	std y+17,R18
	std y+18,R19
	rjmp L38
L37:
	ldd R2,y+25
	ldd R3,y+26
	ldd R4,y+27
	ldd R5,y+28
	std y+15,R2
	std y+16,R3
	std y+17,R4
	std y+18,R5
L38:
	ldd R2,y+15
	ldd R3,y+16
	ldd R4,y+17
	ldd R5,y+18
	std y+1,R2
	std y+2,R3
	std y+3,R4
	std y+4,R5
	.dbline 616
;     BOOL  bIfFindFirstNoneZeroNumber = FALSE;
	.dbline 618
;     
;     if (nNumber < 0)
	ldi R24,0
	ldi R25,0
	ldi R26,0
	ldi R27,0
	ldd R2,y+25
	ldd R3,y+26
	ldd R4,y+27
	ldd R5,y+28
	cp R2,R24
	cpc R3,R25
	cpc R4,R26
	cpc R5,R27
	brge L39
X8:
	.dbline 619
;     {
	.dbline 620
;         PRINT("-")
	ldi R16,<L41
	ldi R17,>L41
	rcall _LCDDisplayString
	.dbline 621
;     }
L39:
	.dbline 624
;     
;     
;     for (n = 9;n > 0;n--)
	ldi R22,9
	rjmp L45
L42:
	.dbline 625
;     {
	.dbline 626
;         cTempBuff[n] = (wTempNumber % 10);
	ldi R24,10
	ldi R25,0
	ldi R26,0
	ldi R27,0
	ldd R16,y+1
	ldd R17,y+2
	ldd R18,y+3
	ldd R19,y+4
	st -y,R27
	st -y,R26
	st -y,R25
	st -y,R24
	rcall mod32u
	movw R24,R28
	adiw R24,5
	mov R30,R22
	clr R31
	add R30,R24
	adc R31,R25
	std z+0,R16
	.dbline 627
;         wTempNumber /= 10;
	ldi R24,10
	ldi R25,0
	ldi R26,0
	ldi R27,0
	ldd R16,y+1
	ldd R17,y+2
	ldd R18,y+3
	ldd R19,y+4
	st -y,R27
	st -y,R26
	st -y,R25
	st -y,R24
	rcall div32u
	std y+1,R16
	std y+2,R17
	std y+3,R18
	std y+4,R19
	.dbline 628
;     }
L43:
	.dbline 624
	dec R22
L45:
	.dbline 624
	tst R22
	brne L42
X9:
	.dbline 630
;     
;     if (chCounter)
	tst R20
	breq L46
X10:
	.dbline 631
;     {
	.dbline 632
;         bIfFindFirstNoneZeroNumber = TRUE;
	ldi R22,1
	.dbline 633
;     }
	rjmp L47
L46:
	.dbline 635
;     else
;     {
	.dbline 636
;         chCounter = UBOUND(cTempBuff);
	ldi R20,10
	.dbline 637
;         bIfFindFirstNoneZeroNumber = FALSE;
	clr R22
	.dbline 638
;     }
L47:
	.dbline 640
;     
;     chCounter = MIN(chCounter,UBOUND(cTempBuff));
	cpi R20,10
	brsh L48
X11:
	mov R10,R20
	clr R11
	rjmp L49
L48:
	ldi R24,10
	ldi R25,0
	movw R10,R24
L49:
	mov R20,R10
	.dbline 642
;     
;     for (n = UBOUND(cTempBuff) - chCounter;n < UBOUND(cTempBuff);n++)
	ldi R24,10
	mov R10,R24
	sub R10,R20
	rjmp L53
L50:
	.dbline 643
;     {
	.dbline 644
;         if (cTempBuff[n])
	movw R24,R28
	adiw R24,5
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R2,z+0
	tst R2
	breq L54
X12:
	.dbline 645
;         {
	.dbline 646
;             PRINTN(cTempBuff[n],1);
	ldi R24,1
	std y+0,R24
	movw R24,R28
	adiw R24,5
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R16,z+0
	clr R17
	clr R18
	clr R19
	rcall _LCDDisplayNum
	.dbline 646
	.dbline 648
; 
;             bIfFindFirstNoneZeroNumber = TRUE;
	ldi R22,1
	.dbline 649
;         }
	rjmp L55
L54:
	.dbline 650
;         else if (bIfFindFirstNoneZeroNumber)
	tst R22
	breq L56
X13:
	.dbline 651
;         {
	.dbline 652
;             PRINTN(cTempBuff[n],1);
	ldi R24,1
	std y+0,R24
	movw R24,R28
	adiw R24,5
	mov R30,R10
	clr R31
	add R30,R24
	adc R31,R25
	ldd R16,z+0
	clr R17
	clr R18
	clr R19
	rcall _LCDDisplayNum
	.dbline 652
	.dbline 654
; 
;         }
L56:
L55:
	.dbline 655
;     }
L51:
	.dbline 642
	inc R10
L53:
	.dbline 642
	mov R24,R10
	cpi R24,10
	brsh X16
	rjmp L50
X16:
X14:
	.dbline 657
;     
;     if (!bIfFindFirstNoneZeroNumber)
	tst R22
	brne L58
X15:
	.dbline 658
;     {
	.dbline 659
;         PRINTN(0,chCounter);
	std y+0,R20
	ldi R16,0
	ldi R17,0
	ldi R18,0
	ldi R19,0
	rcall _LCDDisplayNum
	.dbline 659
	.dbline 660
;     }
L58:
	.dbline -2
L35:
	.dbline 0 ; func end
	adiw R28,19
	rcall pop_xgsetF00C
	adiw R28,4
	ret
	.dbsym l cTempBuff 5 A[10:10]c
	.dbsym r n3 10 c
	.dbsym r bIfFindFirstNoneZeroNumber1 22 c
	.dbsym r n1 22 c
	.dbsym l wTempNumber0 1 l
	.dbsym r chCounter 20 c
	.dbsym l nNumber 25 L
	.dbend
	.area data(ram, con, rel)
	.dbfile E:\单片机\ROOBCO~1\全向定位系统\坐标转换模块\相对定位模块测试版\Relative_Locate_Module\RD_LCD1602B.c
L41:
	.blkb 2
	.area idata
	.byte 45,0
	.area data(ram, con, rel)
	.dbfile E:\单片机\ROOBCO~1\全向定位系统\坐标转换模块\相对定位模块测试版\Relative_Locate_Module\RD_LCD1602B.c
;     
; }

⌨️ 快捷键说明

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