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

📄 bcd_8c-source.html

📁 SMS傳送Sourcode,compiler with C,AT command
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>AVR323 Interfacing GSM modems: ATAVRBFLY_FILES/BCD.c Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.7 --><div class="qindex"><a class="qindex" href="main.html">Main&nbsp;Page</a> | <a class="qindex" href="annotated.html">Data&nbsp;Structures</a> | <a class="qindex" href="files.html">File&nbsp;List</a> | <a class="qindex" href="functions.html">Data&nbsp;Fields</a> | <a class="qindex" href="globals.html">Globals</a></div><h1>ATAVRBFLY_FILES/BCD.c</h1><a href="BCD_8c.html">Go to the documentation of this file.</a><pre class="fragment"><div>00001 <span class="comment">// This file has been prepared for Doxygen automatic documentation generation.</span>00023 <span class="comment"></span><span class="comment">/*****************************************************************************</span>00024 <span class="comment">*</span>00025 <span class="comment">*   Function name : CHAR2BCD2</span>00026 <span class="comment">*</span>00027 <span class="comment">*   Returns :       Binary coded decimal value of the input (2 digits)</span>00028 <span class="comment">*</span>00029 <span class="comment">*   Parameters :    Value between (0-99) to be encoded into BCD</span>00030 <span class="comment">*</span>00031 <span class="comment">*   Purpose :       Convert a character into a BCD encoded character.</span>00032 <span class="comment">*                   The input must be in the range 0 to 99.</span>00033 <span class="comment">*                   The result is byte where the high and low nibbles</span>00034 <span class="comment">*                   contain the tens and ones of the input.</span>00035 <span class="comment">*</span>00036 <span class="comment">*****************************************************************************/</span><a name="l00037"></a><a class="code" href="BCD_8h.html#a0">00037</a> <span class="keywordtype">char</span> <a class="code" href="BCD_8h.html#a0">CHAR2BCD2</a>(<span class="keywordtype">char</span> input)00038 {00039     <span class="keywordtype">char</span> high = 0;00040 00041 00042     <span class="keywordflow">while</span> (<a class="code" href="main_8h.html#a27">input</a> &gt;= 10)                 <span class="comment">// Count tens</span>00043     {00044         high++;00045         <a class="code" href="main_8h.html#a27">input</a> -= 10;00046     }00047 00048     <span class="keywordflow">return</span>  (high &lt;&lt; 4) | <a class="code" href="main_8h.html#a27">input</a>;        <span class="comment">// Add ones and return answer</span>00049 }00050 00051 <span class="comment">/*****************************************************************************</span>00052 <span class="comment">*</span>00053 <span class="comment">*   Function name : CHAR2BCD3</span>00054 <span class="comment">*</span>00055 <span class="comment">*   Returns :       Binary coded decimal value of the input (3 digits)</span>00056 <span class="comment">*</span>00057 <span class="comment">*   Parameters :    Value between (0-255) to be encoded into BCD</span>00058 <span class="comment">*</span>00059 <span class="comment">*   Purpose :       Convert a character into a BCD encoded character.</span>00060 <span class="comment">*                   The input must be in the range 0 to 255.</span>00061 <span class="comment">*                   The result is an integer where the three lowest nibbles</span>00062 <span class="comment">*                   contain the ones, tens and hundreds of the input.</span>00063 <span class="comment">*</span>00064 <span class="comment">*****************************************************************************/</span><a name="l00065"></a><a class="code" href="BCD_8h.html#a1">00065</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="BCD_8h.html#a1">CHAR2BCD3</a>(<span class="keywordtype">char</span> input)00066 {00067     <span class="keywordtype">int</span> high = 0;00068 00069     <span class="keywordflow">while</span> (<a class="code" href="main_8h.html#a27">input</a> &gt;= 100)                <span class="comment">// Count hundreds</span>00070     {00071         high++;00072         <a class="code" href="main_8h.html#a27">input</a> -= 100;00073     }00074 00075     high &lt;&lt;= 4;00076 00077     <span class="keywordflow">while</span> (<a class="code" href="main_8h.html#a27">input</a> &gt;= 10)                 <span class="comment">// Count tens</span>00078     {00079         high++;00080         <a class="code" href="main_8h.html#a27">input</a> -= 10;00081     }00082 00083     <span class="keywordflow">return</span>  (high &lt;&lt; 4) | <a class="code" href="main_8h.html#a27">input</a>;        <span class="comment">// Add ones and return answer</span>00084 }</div></pre><hr size="1"><address style="align: right;"><small>Generated on Tue Nov 1 16:21:39 2005 for AVR323 Interfacing GSM modems by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 ></a> 1.3.7 </small></address></body></html>

⌨️ 快捷键说明

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