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

📄 timerx8_8h-source.html

📁 avr应用测试程序
💻 HTML
📖 第 1 页 / 共 3 页
字号:
00212 <span class="comment"></span><span class="preprocessor">#ifdef TCNT2    // support timer2 only if it exists</span>00213 <span class="preprocessor"></span><span class="keywordtype">void</span> <a class="code" href="group__timer128.html#ga8">timer2SetPrescaler</a>(u08 prescale);      <span class="comment">///&lt; set timer2 prescaler</span>00214 <span class="comment"></span>u16  <a class="code" href="group__timer128.html#ga12">timer2GetPrescaler</a>(<span class="keywordtype">void</span>);              <span class="comment">///&lt; get timer2 prescaler</span>00215 <span class="comment"></span><span class="preprocessor">#endif</span>00216 <span class="preprocessor"></span>00217 00218 <span class="comment">// TimerAttach and Detach commands</span>00219 <span class="comment">//      These functions allow the attachment (or detachment) of any user function</span>00220 <span class="comment">//      to a timer interrupt.  "Attaching" one of your own functions to a timer</span>00221 <span class="comment">//      interrupt means that it will be called whenever that interrupt happens.</span>00222 <span class="comment">//      Using attach is better than rewriting the actual INTERRUPT() function</span>00223 <span class="comment">//      because your code will still work and be compatible if the timer library</span>00224 <span class="comment">//      is updated.  Also, using Attach allows your code and any predefined timer</span>00225 <span class="comment">//      code to work together and at the same time.  (ie. "attaching" your own</span>00226 <span class="comment">//      function to the timer0 overflow doesn't prevent timerPause from working,</span>00227 <span class="comment">//      but rather allows you to share the interrupt.)</span>00228 <span class="comment">//</span>00229 <span class="comment">//      timerAttach(TIMER1OVERFLOW_INT, myOverflowFunction);</span>00230 <span class="comment">//      timerDetach(TIMER1OVERFLOW_INT)</span>00231 <span class="comment">//</span>00232 <span class="comment">//      timerAttach causes the myOverflowFunction() to be attached, and therefore</span>00233 <span class="comment">//      execute, whenever an overflow on timer1 occurs.  timerDetach removes the</span>00234 <span class="comment">//      association and executes no user function when the interrupt occurs.</span>00235 <span class="comment">//      myOverflowFunction must be defined with no return value and no arguments:</span>00236 <span class="comment">//</span>00237 <span class="comment">//      void myOverflowFunction(void) { ... }</span>00238 <span class="comment"></span>00239 <span class="comment">//! Attach a user function to a timer interrupt</span>00240 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__timer.html#ga8">timerAttach</a>(u08 interruptNum, <span class="keywordtype">void</span> (*userFunc)(<span class="keywordtype">void</span>) );<span class="comment"></span>00241 <span class="comment">//! Detach a user function from a timer interrupt</span>00242 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__timer.html#ga9">timerDetach</a>(u08 interruptNum);00243 00244 00245 <span class="comment">// timing commands</span><span class="comment"></span>00246 <span class="comment">/// A timer-based delay/pause function</span>00247 <span class="comment">/// @param pause_ms Number of integer milliseconds to wait.</span>00248 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__timer.html#ga10">timerPause</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">short</span> pause_ms);00249 00250 <span class="comment">// overflow counters</span>00251 <span class="keywordtype">void</span> <a class="code" href="group__timer.html#ga11">timer0ClearOverflowCount</a>(<span class="keywordtype">void</span>);    <span class="comment">///&lt; Clear timer0's overflow counter. </span>00252 <span class="comment"></span><span class="keywordtype">long</span> <a class="code" href="group__timer.html#ga12">timer0GetOverflowCount</a>(<span class="keywordtype">void</span>);      <span class="comment">///&lt; read timer0's overflow counter</span>00253 <span class="comment"></span><span class="preprocessor">#ifdef TCNT2    // support timer2 only if it exists</span>00254 <span class="preprocessor"></span><span class="keywordtype">void</span> timer2ClearOverflowCount(<span class="keywordtype">void</span>);    <span class="comment">///&lt; clear timer2's overflow counter</span>00255 <span class="comment"></span><span class="keywordtype">long</span> timer2GetOverflowCount(<span class="keywordtype">void</span>);      <span class="comment">///&lt; read timer0's overflow counter</span>00256 <span class="comment"></span><span class="preprocessor">#endif</span>00257 <span class="preprocessor"></span><span class="comment"></span>00258 <span class="comment">/// @defgroup timerpwm Timer PWM Commands</span>00259 <span class="comment">/// @ingroup timer</span>00260 <span class="comment">/// These commands control PWM functionality on timer1</span>00261 <span class="comment"></span><span class="comment">// PWM initialization and set commands for timer1</span>00262 <span class="comment">// timer1PWMInit()</span>00263 <span class="comment">//      configures the timer1 hardware for PWM mode on pins OC1A and OC1B.</span>00264 <span class="comment">//      bitRes should be 8,9,or 10 for 8,9,or 10bit PWM resolution</span>00265 <span class="comment">//</span>00266 <span class="comment">// timer1PWMOff()</span>00267 <span class="comment">//      turns off all timer1 PWM output and set timer mode to normal state</span>00268 <span class="comment">//</span>00269 <span class="comment">// timer1PWMAOn() and timer1PWMBOn()</span>00270 <span class="comment">//      turn on output of PWM signals to OC1A or OC1B pins</span>00271 <span class="comment">//      NOTE: Until you define the OC1A and OC1B pins as outputs, and run</span>00272 <span class="comment">//      this "on" command, no PWM output will be output</span>00273 <span class="comment">//</span>00274 <span class="comment">// timer1PWMAOff() and timer1PWMBOff()</span>00275 <span class="comment">//      turn off output of PWM signals to OC1A or OC1B pins</span>00276 <span class="comment">//</span>00277 <span class="comment">// timer1PWMASet() and timer1PWMBSet()</span>00278 <span class="comment">//      sets the PWM duty cycle for each channel</span>00279 <span class="comment">//  NOTE:   &lt;pwmDuty&gt; should be in the range 0-255 for 8bit PWM</span>00280 <span class="comment">//          &lt;pwmDuty&gt; should be in the range 0-511 for 9bit PWM</span>00281 <span class="comment">//          &lt;pwmDuty&gt; should be in the range 0-1023 for 10bit PWM</span>00282 <span class="comment">// NOTE: the PWM frequency can be controlled in increments by setting the</span>00283 <span class="comment">//          prescaler for timer1</span><span class="comment"></span>00284 <span class="comment">//@{</span>00285 <span class="comment"></span>00286 <span class="comment"></span>00287 <span class="comment">/// Enter standard PWM Mode on timer1.</span>00288 <span class="comment">/// \param bitRes   indicates the period/resolution to use for PWM output in timer bits.</span>00289 <span class="comment">///                     Must be either 8, 9, or 10 bits corresponding to PWM periods of 256, 512, or 1024 timer tics.</span>00290 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga0">timer1PWMInit</a>(u08 bitRes);00291 <span class="comment"></span>00292 <span class="comment">/// Enter PWM Mode on timer1 with a specific top-count value.</span>00293 <span class="comment">/// \param topcount indicates the desired PWM period in timer tics.</span>00294 <span class="comment">///                     Can be a number between 1 and 65535 (16-bit).</span>00295 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga1">timer1PWMInitICR</a>(u16 topcount);00296 <span class="comment"></span>00297 <span class="comment">/// Turn off all timer1 PWM output and set timer mode to normal.</span>00298 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga2">timer1PWMOff</a>(<span class="keywordtype">void</span>);00299 <span class="comment"></span>00300 <span class="comment">/// Turn on/off Timer1 PWM outputs.</span>00301 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga3">timer1PWMAOn</a>(<span class="keywordtype">void</span>);            <span class="comment">///&lt; Turn on timer1 Channel A (OC1A) PWM output.</span>00302 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga4">timer1PWMBOn</a>(<span class="keywordtype">void</span>);            <span class="comment">///&lt; Turn on timer1 Channel B (OC1B) PWM output.</span>00303 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga5">timer1PWMAOff</a>(<span class="keywordtype">void</span>);           <span class="comment">///&lt; turn off timer1 Channel A (OC1A) PWM output</span>00304 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga6">timer1PWMBOff</a>(<span class="keywordtype">void</span>);           <span class="comment">///&lt; turn off timer1 Channel B (OC1B) PWM output</span>00305 <span class="comment"></span>00306 <span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga7">timer1PWMASet</a>(u16 pwmDuty);    <span class="comment">///&lt; set duty of timer1 Channel A (OC1A) PWM output</span>00307 <span class="comment"></span><span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga8">timer1PWMBSet</a>(u16 pwmDuty);    <span class="comment">///&lt; set duty of timer1 Channel B (OC1B) PWM output</span>00308 <span class="comment"></span><span class="comment"></span>00309 <span class="comment">//@}</span>00310 <span class="comment"></span><span class="comment">//@}</span>00311 <span class="comment"></span>00312 <span class="comment">// Pulse generation commands have been moved to the pulse.c library</span>00313 00314 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="align: right;"><small>Generated on Sun Oct 29 03:41:07 2006 for Procyon AVRlib by&nbsp;<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>

⌨️ 快捷键说明

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