?lang_form?
?lang_select?
?lang_submit?
?lang_endform?
{HEADER END}
{FILE START}
library
?curdirlinks? - Rev 6
?prevdifflink? - Blame - ?getfile?
<!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>Procyon AVRlib: encoder.h File Reference</title>
<link href="dox.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="modules.html">Modules</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="dirs.html">Directories</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> | <a class="qindex" href="pages.html">Related Pages</a></div>
<h1>encoder.h File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
<p>
Definition in file <a class="el" href="encoder_8h-source.html">encoder.h</a>.
<p>
<code>#include "<a class="el" href="global_8h-source.html">global.h</a>"</code><br>
<code>#include "<a class="el" href="encoderconf_8h-source.html">encoderconf.h</a>"</code><br>
<p>
<a href="encoder_8h-source.html">Go to the source code of this file.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Defines</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8h.html#a0">IMSK</a> GIMSK</td></tr>
<tr><td colspan="2"><br><h2>Typedefs</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a1" doxytag="encoder.h::EncoderStateType"></a>
typedef <a class="el" href="structstruct__EncoderState.html">struct_EncoderState</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8h.html#a1">EncoderStateType</a></td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Encoder state structure. <br></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a2" doxytag="encoder.h::encoderInit"></a>
void </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8h.html#a2">encoderInit</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="encoder_8c.html#a1">encoderInit()</a> initializes hardware and encoder position readings <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a3" doxytag="encoder.h::encoderOff"></a>
void </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8h.html#a3">encoderOff</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="encoder_8c.html#a2">encoderOff()</a> disables hardware and stops encoder position updates <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a4" doxytag="encoder.h::encoderGetPosition"></a>
s32 </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8h.html#a4">encoderGetPosition</a> (u08 encoderNum)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="encoder_8c.html#a3">encoderGetPosition()</a> reads the current position of the encoder <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a5" doxytag="encoder.h::encoderSetPosition"></a>
void </td><td class="memItemRight" valign="bottom"><a class="el" href="encoder_8h.html#a5">encoderSetPosition</a> (u08 encoderNum, s32 position)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight"><a class="el" href="encoder_8c.html#a4">encoderSetPosition()</a> sets the current position of the encoder <br></td></tr>
</table>
<hr><h2>Define Documentation</h2>
<a class="anchor" name="a0" doxytag="encoder.h::IMSK"></a><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">#define IMSK GIMSK </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
To keep track of the encoder position in software, we connect PhaseA to an external processor interrupt line, and PhaseB to any I/O pin. We set up the external interrupt to trigger whenever PhaseA produces a rising edge. When a rising edge is detected, our interrupt handler function is executed. Inside the handler function, we quickly check the PhaseB line to see if it is high or low. If it is high, we increment the encoder's position counter, otherwise we decrement it. The encoder position counter can be read at any time to find out the current position.
<p>
Definition at line <a class="el" href="encoder_8h-source.html#l00110">110</a> of file <a class="el" href="encoder_8h-source.html">encoder.h</a>. </td>
</tr>
</table>
<hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:08 2006 for Procyon AVRlib by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
</body>
</html>
|
{FILE END}
{FOOTER START}
Powered by WebSVN v2.8.3