📄 timerx8_8c-source.html
字号:
00318 OCR1A = 0;00319 <span class="comment">// clear output compare value B</span>00320 OCR1B = 0;00321 00322 }00323 <span class="preprocessor">#endif</span>00324 <span class="preprocessor"></span><a name="l00325"></a><a class="code" href="group__timerpwm.html#ga2">00325</a> <span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga2">timer1PWMOff</a>(<span class="keywordtype">void</span>)00326 {00327 <span class="comment">// turn off timer1 PWM mode</span>00328 cbi(TCCR1A,PWM11);00329 cbi(TCCR1A,PWM10);00330 <span class="comment">// set PWM1A/B (OutputCompare action) to none</span>00331 <a class="code" href="group__timerpwm.html#ga5">timer1PWMAOff</a>();00332 <a class="code" href="group__timerpwm.html#ga6">timer1PWMBOff</a>();00333 }00334 <a name="l00335"></a><a class="code" href="group__timerpwm.html#ga3">00335</a> <span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga3">timer1PWMAOn</a>(<span class="keywordtype">void</span>)00336 {00337 <span class="comment">// turn on channel A (OC1A) PWM output</span>00338 <span class="comment">// set OC1A as non-inverted PWM</span>00339 sbi(TCCR1A,COM1A1);00340 cbi(TCCR1A,COM1A0);00341 }00342 <a name="l00343"></a><a class="code" href="group__timerpwm.html#ga4">00343</a> <span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga4">timer1PWMBOn</a>(<span class="keywordtype">void</span>)00344 {00345 <span class="comment">// turn on channel B (OC1B) PWM output</span>00346 <span class="comment">// set OC1B as non-inverted PWM</span>00347 sbi(TCCR1A,COM1B1);00348 cbi(TCCR1A,COM1B0);00349 }00350 <a name="l00351"></a><a class="code" href="group__timerpwm.html#ga5">00351</a> <span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga5">timer1PWMAOff</a>(<span class="keywordtype">void</span>)00352 {00353 <span class="comment">// turn off channel A (OC1A) PWM output</span>00354 <span class="comment">// set OC1A (OutputCompare action) to none</span>00355 cbi(TCCR1A,COM1A1);00356 cbi(TCCR1A,COM1A0);00357 }00358 <a name="l00359"></a><a class="code" href="group__timerpwm.html#ga6">00359</a> <span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga6">timer1PWMBOff</a>(<span class="keywordtype">void</span>)00360 {00361 <span class="comment">// turn off channel B (OC1B) PWM output</span>00362 <span class="comment">// set OC1B (OutputCompare action) to none</span>00363 cbi(TCCR1A,COM1B1);00364 cbi(TCCR1A,COM1B0);00365 }00366 <a name="l00367"></a><a class="code" href="group__timerpwm.html#ga7">00367</a> <span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga7">timer1PWMASet</a>(u16 pwmDuty)00368 {00369 <span class="comment">// set PWM (output compare) duty for channel A</span>00370 <span class="comment">// this PWM output is generated on OC1A pin</span>00371 <span class="comment">// NOTE: pwmDuty should be in the range 0-255 for 8bit PWM</span>00372 <span class="comment">// pwmDuty should be in the range 0-511 for 9bit PWM</span>00373 <span class="comment">// pwmDuty should be in the range 0-1023 for 10bit PWM</span>00374 <span class="comment">//outp( (pwmDuty>>8), OCR1AH); // set the high 8bits of OCR1A</span>00375 <span class="comment">//outp( (pwmDuty&0x00FF), OCR1AL); // set the low 8bits of OCR1A</span>00376 OCR1A = pwmDuty;00377 }00378 <a name="l00379"></a><a class="code" href="group__timerpwm.html#ga8">00379</a> <span class="keywordtype">void</span> <a class="code" href="group__timerpwm.html#ga8">timer1PWMBSet</a>(u16 pwmDuty)00380 {00381 <span class="comment">// set PWM (output compare) duty for channel B</span>00382 <span class="comment">// this PWM output is generated on OC1B pin</span>00383 <span class="comment">// NOTE: pwmDuty should be in the range 0-255 for 8bit PWM</span>00384 <span class="comment">// pwmDuty should be in the range 0-511 for 9bit PWM</span>00385 <span class="comment">// pwmDuty should be in the range 0-1023 for 10bit PWM</span>00386 <span class="comment">//outp( (pwmDuty>>8), OCR1BH); // set the high 8bits of OCR1B</span>00387 <span class="comment">//outp( (pwmDuty&0x00FF), OCR1BL); // set the low 8bits of OCR1B</span>00388 OCR1B = pwmDuty;00389 }00390 <span class="comment"></span>00391 <span class="comment">//! Interrupt handler for tcnt0 overflow interrupt</span><a name="l00392"></a><a class="code" href="timerx8_8c.html#a27">00392</a> <span class="comment"></span>TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW0)00393 {00394 Timer0Reg0++; <span class="comment">// increment low-order counter</span>00395 00396 <span class="comment">// increment pause counter</span>00397 TimerPauseReg++;00398 00399 <span class="comment">// if a user function is defined, execute it too</span>00400 <span class="keywordflow">if</span>(TimerIntFunc[TIMER0OVERFLOW_INT])00401 TimerIntFunc[TIMER0OVERFLOW_INT]();00402 }00403 <span class="comment"></span>00404 <span class="comment">//! Interrupt handler for tcnt1 overflow interrupt</span><a name="l00405"></a><a class="code" href="timerx8_8c.html#a28">00405</a> <span class="comment"></span>TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW1)00406 {00407 <span class="comment">// if a user function is defined, execute it</span>00408 <span class="keywordflow">if</span>(TimerIntFunc[TIMER1OVERFLOW_INT])00409 TimerIntFunc[TIMER1OVERFLOW_INT]();00410 }00411 00412 <span class="preprocessor">#ifdef TCNT2 // support timer2 only if it exists</span>00413 <span class="preprocessor"></span><span class="comment">//! Interrupt handler for tcnt2 overflow interrupt</span>00414 <span class="comment"></span>TIMER_INTERRUPT_HANDLER(SIG_OVERFLOW2)00415 {00416 Timer2Reg0++; <span class="comment">// increment low-order counter</span>00417 00418 <span class="comment">// if a user function is defined, execute it</span>00419 <span class="keywordflow">if</span>(TimerIntFunc[TIMER2OVERFLOW_INT])00420 TimerIntFunc[TIMER2OVERFLOW_INT]();00421 }00422 <span class="preprocessor">#endif</span>00423 <span class="preprocessor"></span>00424 <span class="preprocessor">#ifdef OCR0</span>00425 <span class="preprocessor"></span><span class="comment">// include support for Output Compare 0 for new AVR processors that support it</span><span class="comment"></span>00426 <span class="comment">//! Interrupt handler for OutputCompare0 match (OC0) interrupt</span>00427 <span class="comment"></span>TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE0)00428 {00429 <span class="comment">// if a user function is defined, execute it</span>00430 <span class="keywordflow">if</span>(TimerIntFunc[TIMER0OUTCOMPARE_INT])00431 TimerIntFunc[TIMER0OUTCOMPARE_INT]();00432 }00433 <span class="preprocessor">#endif</span>00434 <span class="preprocessor"></span><span class="comment"></span>00435 <span class="comment">//! Interrupt handler for CutputCompare1A match (OC1A) interrupt</span><a name="l00436"></a><a class="code" href="timerx8_8c.html#a29">00436</a> <span class="comment"></span>TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE1A)00437 {00438 <span class="comment">// if a user function is defined, execute it</span>00439 <span class="keywordflow">if</span>(TimerIntFunc[TIMER1OUTCOMPAREA_INT])00440 TimerIntFunc[TIMER1OUTCOMPAREA_INT]();00441 }00442 <span class="comment"></span>00443 <span class="comment">//! Interrupt handler for OutputCompare1B match (OC1B) interrupt</span><a name="l00444"></a><a class="code" href="timerx8_8c.html#a30">00444</a> <span class="comment"></span>TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE1B)00445 {00446 <span class="comment">// if a user function is defined, execute it</span>00447 <span class="keywordflow">if</span>(TimerIntFunc[TIMER1OUTCOMPAREB_INT])00448 TimerIntFunc[TIMER1OUTCOMPAREB_INT]();00449 }00450 <span class="comment"></span>00451 <span class="comment">//! Interrupt handler for InputCapture1 (IC1) interrupt</span><a name="l00452"></a><a class="code" href="timerx8_8c.html#a31">00452</a> <span class="comment"></span>TIMER_INTERRUPT_HANDLER(SIG_INPUT_CAPTURE1)00453 {00454 <span class="comment">// if a user function is defined, execute it</span>00455 <span class="keywordflow">if</span>(TimerIntFunc[TIMER1INPUTCAPTURE_INT])00456 TimerIntFunc[TIMER1INPUTCAPTURE_INT]();00457 }00458 <span class="comment"></span>00459 <span class="comment">//! Interrupt handler for OutputCompare2A match (OC2A) interrupt</span><a name="l00460"></a><a class="code" href="timerx8_8c.html#a32">00460</a> <span class="comment"></span>TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE2A)00461 {00462 <span class="comment">// if a user function is defined, execute it</span>00463 <span class="keywordflow">if</span>(TimerIntFunc[TIMER2OUTCOMPARE_INT])00464 TimerIntFunc[TIMER2OUTCOMPARE_INT]();00465 }00466 <span class="comment"></span>00467 <span class="comment">//! Interrupt handler for OutputCompare2B match (OC2B) interrupt</span><a name="l00468"></a><a class="code" href="timerx8_8c.html#a33">00468</a> <span class="comment"></span>TIMER_INTERRUPT_HANDLER(SIG_OUTPUT_COMPARE2B)00469 {00470 <span class="comment">// if a user function is defined, execute it</span>00471 <span class="keywordflow">if</span>(TimerIntFunc[TIMER2OUTCOMPARE_INT])00472 TimerIntFunc[TIMER2OUTCOMPARE_INT]();00473 }</pre></div><hr size="1"><address style="align: right;"><small>Generated on Mon Aug 22 04:29:28 2005 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>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -