📄 strings.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by AsmDoc -->
<TITLE>
HTMLWriter
</TITLE>
<META NAME="keywords" CONTENT="HTMLWriter class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="Strings";
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ======== START OF CLASS DATA ======== -->
<H2>
Module Strings</H2>
<HR>
<P>
This module provides useful functions to operate with strings.<BR> But when using these functions, you should always remember, that they are capable of overwriting the complete RAM on your device, if not used the correct way. This will most likely happen, if a string read by one of these functions is not terminated with the end of string character ('\0').
<P>
<P>
<HR>
<P>
<!-- ========== MACRO SUMMARY =========== -->
<A NAME="macro_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Macro Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE></CODE></FONT></TD>
<TD><CODE><B><A HREF="Strings.html#String.ReadPGM2RAM">String.ReadPGM2RAM</A></B>( Prog RAM )</CODE>
<BR>
This function reads a String from the program memory to a RAM buffer.</TD>
</TR>
</TABLE>
<P>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Function Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE></CODE></FONT></TD>
<TD><CODE><B><A HREF="Strings.html#String.ReadFromPGM">String.ReadFromPGM</A></B>( TBLPTRU TBLPTRH TBLPTRL FSR2 )</CODE>
<BR>
This function reads a String from the program memory to a RAM buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE></CODE></FONT></TD>
<TD><CODE><B><A HREF="Strings.html#String.Append">String.Append</A></B>( FSR2 FSR1 )</CODE>
<BR>
This function appends string2 at the end of string1.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE></CODE></FONT></TD>
<TD><CODE><B><A HREF="Strings.html#String.Char2String">String.Char2String</A></B>( FSR2 FSR1 w )</CODE>
<BR>
This function converts a char array to a string.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> Strings.length w </CODE></FONT></TD>
<TD><CODE><B><A HREF="Strings.html#String.GetLength">String.GetLength</A></B>( FSR2 )</CODE>
<BR>
This function returns the length of a string.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE></CODE></FONT></TD>
<TD><CODE><B><A HREF="Strings.html#String.HexArray2String">String.HexArray2String</A></B>( FSR2 FSR1 w )</CODE>
<BR>
This function converts an array of hex values to a character encoded string.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> w </CODE></FONT></TD>
<TD><CODE><B><A HREF="Strings.html#String.Hex2ASCII">String.Hex2ASCII</A></B>( w )</CODE>
<BR>
This function converts an the low nibble of a hex value to an ascii character.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE></CODE></FONT></TD>
<TD><CODE><B><A HREF="Strings.html#String.Copy">String.Copy</A></B>( FSR2 FSR1 )</CODE>
<BR>
This function copies a string at one address to another address.</TD>
</TR>
</TABLE>
<P>
<!-- ============ MACRO DETAIL ========== -->
<A NAME="macro_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Macro Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="String.ReadPGM2RAM"></A><H3>
String.ReadPGM2RAM</H3>
<PRE>
<B>String.ReadPGM2RAM</B>( Prog RAM )</PRE>
<P>
<DL>
<DD> This function reads a String from the program memory to a RAM buffer.<BR> ATTENTION, the buffer has to be at least big enough for the 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>Prog</CODE> - The start address in the program memory </DD>
<DD><CODE>RAM</CODE> - The start address of the buffer to write </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="#AA22AA">String.ReadPGM2RAM </FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">ExString,BufferADR </FONT></CODE></TD></TR><TR> <TD><CODE><FONT COLOR="#AA22AA">... </FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">... </FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">... </FONT></CODE></TD></TR><TR> <TD><CODE><FONT COLOR="#AA22AA">ExString </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF">DE </FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">"Example\0" </FONT></CODE></TD></TR></TABLE></CODE></DD></DL>
</DD>
<DD><DL>
<DT><B>Description:</B><DD> This will copy the string "Example" to BufferADR in RAM.</DD></DL>
</DD>
</DL>
<HR>
<P>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="String.ReadFromPGM"></A><H3>
String.ReadFromPGM</H3>
<PRE>
<B>String.ReadFromPGM</B>( TBLPTRU TBLPTRH TBLPTRL FSR2 )</PRE>
<P>
<DL>
<DD> This function reads a String from the program memory to a RAM buffer.<BR> ATTENTION, the buffer has to be at least big enough for the 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>TBLPTRU</CODE> - The upper bits of the start address in the program memory </DD>
<DD><CODE>TBLPTRH</CODE> - The high bits of the start address in the program memory </DD>
<DD><CODE>TBLPTRL</CODE> - The low bits of the start address in the program memory </DD>
<DD><CODE>FSR2</CODE> - The start address of the buffer to write </DD>
</DL></DD>
<P>
<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>movlw </B></FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">upper ExString </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">TBLPTRU </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">high ExString </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">TBLPTRH </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">low ExString </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">TBLPTRL </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">BufferADR </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.ReadFromPGM </FONT></CODE></TD></TR><TR> <TD><CODE><FONT COLOR="#AA22AA">... </FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">... </FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">... </FONT></CODE></TD></TR><TR> <TD><CODE><FONT COLOR="#AA22AA">ExString </FONT></CODE></TD></TR><TR> <TD><CODE> </CODE></TD> <TD><CODE><FONT COLOR="#0000FF">DE </FONT></CODE></TD> <TD><CODE><FONT COLOR="#AA22AA">"Example\0" </FONT></CODE></TD></TR></TABLE></CODE></DD></DL>
</DD>
<DD><DL>
<DT><B>Description:</B><DD> This will copy the string "Example" to BufferADR in RAM.</DD></DL>
</DD>
</DL>
<HR>
<A NAME="String.Append"></A><H3>
String.Append</H3>
<PRE>
<B>String.Append</B>( FSR2 FSR1 )</PRE>
<P>
<DL>
<DD> This function appends string2 at the end of string1.<BR><BR> ATTENTION, the first String 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 String1 </DD>
<DD><CODE>FSR1</CODE> - The start address of String2 </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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -