📄 strings.html
字号:
<DT><B>Example:</B><DD><CODE><TABLE BORDER="0"><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>lfsr </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">FSR2,StringBuffer </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>lfsr </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">FSR1,Append </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>call </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">String.Append </FONT></CODE></TD></TR></TABLE></CODE></DD></DL>
</DD>
<DD><DL>
<DT><B>Description:</B><DD> This appends the string stored at Append in RAM, at the end of a StringBuffer.</DD></DL>
</DD>
</DL>
<HR>
<A NAME="String.Char2String"></A><H3>
String.Char2String</H3>
<PRE>
<B>String.Char2String</B>( FSR2 FSR1 w )</PRE>
<P>
<DL>
<DD> This function converts a char array to a string.<BR><BR> ATTENTION, the StringBuffer has to be big enough for the resulting string. This function will write the complete string to ram, regardless of the buffer size!<BR>
<P>
<DD><DL>
<DT><B>Parameters:</B>
<DD><CODE>FSR2 The</CODE> - start address of String </DD>
<DD><CODE>FSR1</CODE> - The start address of char array </DD>
<DD><CODE>w</CODE> - The number of chars in the array </DD>
</DL></DD>
<P>
<DD><DL>
<DT><B>Stacklevel:</B><DD>1</DD></DL>
</DD>
<DD><DL>
<DT><B>Status:</B><DD> Written</DD></DL>
</DD>
<P>
<DD><DL>
<DT><B>Example:</B><DD><CODE><TABLE BORDER="0"><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>lfsr </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">FSR2,StringBuffer </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>lfsr </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">FSR1,ArrayAddress </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>movlw </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">'A' </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>movwf </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">INDF1 </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>call </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">String.Char2String </FONT></CODE></TD></TR></TABLE></CODE></DD></DL>
</DD>
<DD><DL>
<DT><B>Description:</B><DD> This stores the string "A" at the address StringBuffer.</DD></DL>
</DD>
</DL>
<HR>
<A NAME="String.GetLength"></A><H3>
String.GetLength</H3>
<PRE>
Strings.length w <B>String.GetLength</B>( FSR2 )</PRE>
<P>
<DL>
<DD> This function returns the length of a string. The length represents the number of characters in the string. To get the memory space of the string add 1 to the length (end of string character).<BR>
<P>
<DD><DL>
<DT><B>Parameters:</B>
<DD><CODE>FSR2 The</CODE> - start address of String </DD>
</DL></DD>
<DD><DL>
<DT><B>Returns:</B>
<DD><CODE>Strings.length</CODE> - The length of the string </DD>
<DD><CODE>w</CODE> - The length of the string </DD>
</DL></DD>
<P>
<DD><DL>
<DT><B>Stacklevel:</B><DD>1</DD></DL>
</DD>
<DD><DL>
<DT><B>Status:</B><DD> Written</DD></DL>
</DD>
<P>
<DD><DL>
<DT><B>Example:</B><DD><CODE><TABLE BORDER="0"><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>lfsr </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">FSR2,StringBuffer </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>call </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">String.GetLength </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>bz </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">BufferEmpty </FONT></CODE></TD></TR></TABLE></CODE></DD></DL>
</DD>
<DD><DL>
<DT><B>Description:</B><DD> This example reads the length of a string, if it is zero, the code at the address BufferEmpty will be executed.</DD></DL>
</DD>
</DL>
<HR>
<A NAME="String.HexArray2String"></A><H3>
String.HexArray2String</H3>
<PRE>
<B>String.HexArray2String</B>( FSR2 FSR1 w )</PRE>
<P>
<DL>
<DD> This function converts an array of hex values to a character encoded string. Each byte will be encoded as two characters.
<P>
<DD><DL>
<DT><B>Parameters:</B>
<DD><CODE>FSR2</CODE> - The start address of String </DD>
<DD><CODE>FSR1</CODE> - The start address of array </DD>
<DD><CODE>w</CODE> - The number of bytes to convert </DD>
</DL></DD>
<P>
<DD><DL>
<DT><B>Calls subroutines:</B><PRE> String.Hex2ASCII
</PRE>
</DD></DL>
<DD><DL>
<DT><B>Stacklevel:</B><DD>2</DD></DL>
</DD>
<DD><DL>
<DT><B>Status:</B><DD> Tested</DD></DL>
</DD>
<P>
<DD><DL>
<DT><B>Example:</B><DD><CODE><TABLE BORDER="0"><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>lfsr </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">FSR2,StringBuffer </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>lfsr </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">FSR1,ArrayAddress </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>movlw </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">0x01 </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>movwf </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">POSTINC1 </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>movlw </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">0x23 </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>movwf </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">POSTDEC1 </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>movlw </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">0x02 </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>call </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">String.HexArray2String </FONT></CODE></TD></TR></TABLE></CODE></DD></DL>
</DD>
<DD><DL>
<DT><B>Description:</B><DD> This stores the string "0123" at the address StringBuffer.</DD></DL>
</DD>
</DL>
<HR>
<A NAME="String.Hex2ASCII"></A><H3>
String.Hex2ASCII</H3>
<PRE>
w <B>String.Hex2ASCII</B>( w )</PRE>
<P>
<DL>
<DD> This function converts an the low nibble of a hex value to an ascii character.<BR>
<P>
<DD><DL>
<DT><B>Parameters:</B>
<DD><CODE>w</CODE> - The hex value </DD>
</DL></DD>
<DD><DL>
<DT><B>Returns:</B>
<DD><CODE>w</CODE> - The character encoded hex value </DD>
</DL></DD>
<P>
<DD><DL>
<DT><B>Stacklevel:</B><DD>1</DD></DL>
</DD>
<DD><DL>
<DT><B>Status:</B><DD> Tested</DD></DL>
</DD>
<P>
<DD><DL>
<DT><B>Example:</B><DD><CODE><TABLE BORDER="0"><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>movlw </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">0x12 </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>call </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">String.Hex2ASCII </FONT></CODE></TD></TR></TABLE></CODE></DD></DL>
</DD>
<DD><DL>
<DT><B>Description:</B><DD> This returns '2'</DD></DL>
</DD>
</DL>
<HR>
<A NAME="String.Copy"></A><H3>
String.Copy</H3>
<PRE>
<B>String.Copy</B>( FSR2 FSR1 )</PRE>
<P>
<DL>
<DD> This function copies a string at one address to another address.<BR><BR> ATTENTION, the reserved memory has to be big enough for the resulting string. This function will write the complete string to ram, regardless of the buffer size!<BR>
<P>
<DD><DL>
<DT><B>Parameters:</B>
<DD><CODE>FSR2 The</CODE> - start address of the destination </DD>
<DD><CODE>FSR1</CODE> - The start address of the string </DD>
</DL></DD>
<P>
<DD><DL>
<DT><B>Used SFRs:</B><DD> FSR1 FSR2</DD></DL>
</DD>
<DD><DL>
<DT><B>Stacklevel:</B><DD>1</DD></DL>
</DD>
<DD><DL>
<DT><B>Status:</B><DD> Written</DD></DL>
</DD>
<P>
<DD><DL>
<DT><B>Example:</B><DD><CODE><TABLE BORDER="0"><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>lfsr </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">FSR1,String </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>lfsr </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">FSR2,StringBuffer </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF"><B>call </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">String.Copy </FONT></CODE></TD></TR></TABLE></CODE></DD></DL>
</DD>
<DD><DL>
<DT><B>Description:</B><DD> This copies the string String to a StringBuffer</DD></DL>
</DD>
</DL>
<HR>
<!-- ========= END OF CLASS DATA ========= -->
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -