📄 adc_8h.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>BlueLab: adc.h File Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.3.8 --><div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div><h1>adc.h File Reference</h1>Access to ADC hardware. <a href="#_details">More...</a><p><h2>Functions</h2><ul><li><a class="el" href="csrtypes_8h.html#a4">uint16</a> <a class="el" href="adc_8h.html#a0">AdcRequest</a> (<a class="el" href="struct_task_data.html">Task</a> task, <a class="el" href="adc__if_8h.html#a6">vm_adc_source_type</a> adc_source)<dl class="el"><dd class="mdescRight">Send a request to the Adc to make a reading from adc_source. When the reading is made, a message will be sent to the task passed. Returns non zero if request is accepted, else zero. <a href="#a0"></a><br></dl></ul><hr><a name="_details"></a><h2>Detailed Description</h2>Access to ADC hardware. <p>The Adc can be used to read the voltage at a number of locations.<ul><li>Across pin AIO0</li><li>Across pin AIO1</li><li>From internal Vref - the internal voltage in the chip.</li></ul><p>The Adc returns these value relative to the supply voltage Vdd, over the range 0...255. For example, the return value from a request for a voltage reading across pin AIO0 is:<p>(Voltage across AIO0/Supply voltage Vdd) * 255<p>So if 0.9 volts are flowing across AIO0, and the supply voltage is 1.8v, the return value would be ~128. Now consider the case where we wish to calculate the supply voltage. If we read from the internal Vref, we get (Vref/Vdd) * 255 returned. Taking a return value of 177, we know:<p>(Vref/Vdd) * 255 = 177.<p>However, we know that Vref is always 1.25v and therefore Vdd is 1.8v. With this information we can take a reading across AIO0 where:<p>Reading = (Voltage across AIO0/Vdd) * 255<p>If we take an example return value of 128 we know:<p>128 = (Voltage across AIO0 / 1.8) * 255<p>Therefore the voltage flowing across AIO0 is ~0.9 volts.<p>When reading VM_ADC_SRC_VDD_BAT, the reading returned is 0.4 of the true value. Code using this reading should adjust for this. See the battery library as an example.<hr><h2>Function Documentation</h2><a class="anchor" name="a0" doxytag="adc.h::AdcRequest" ></a><p><table class="mdTable" width="100%" cellpadding="2" cellspacing="0"> <tr> <td class="mdRow"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> <a class="el" href="csrtypes_8h.html#a4">uint16</a> AdcRequest </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="struct_task_data.html">Task</a> </td> <td class="mdname" nowrap> <em>task</em>, </td> </tr> <tr> <td class="md" nowrap align="right"></td> <td></td> <td class="md" nowrap><a class="el" href="adc__if_8h.html#a6">vm_adc_source_type</a> </td> <td class="mdname" nowrap> <em>adc_source</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr></table><table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td><p>Send a request to the Adc to make a reading from adc_source. When the reading is made, a message will be sent to the task passed. Returns non zero if request is accepted, else zero. <p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign=top><em>task</em> </td><td>The task which will receive Adc messages. </td></tr> <tr><td></td><td valign=top><em>adc_source</em> </td><td>The source to take readings from. </td></tr> </table></dl> </td> </tr></table></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -