LECTURE 6 ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿¤Ë¤Ä¤¤¤Æ

¡û ¤Ï¤¸¤á¤Ë

»þ´Ö¤ò·×¤ëµ¡²ñ¤È¤¤¤¦¤Î¤Ï¿È¶á¤Ë¤¿¤¯¤µ¤ó¤¢¤ë¤È»×¤¤¤Þ¤¹¤¬¡¢¥×¥í¥°¥é¥à¤Ç´Êñ¤Ë»þ´Ö¤ò·×¬¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¤ÈÈó¾ï¤ËÊØÍø¤Ç¤¹¡£

ATmega8535 ¤Ï¡¢3 ¤Ä¤Î¥¿¥¤¥Þ/¥«¥¦¥ó¥¿Éô¤òÈ÷¤¨¤Æ¤¤¤Þ¤¹¡£ºÇÂç 0xff ¤Þ¤Ç¿ô¤¨¤ë¤³¤È¤¬¤Ç¤­¤ë 8 ¥Ó¥Ã¥È¥¿¥¤¥Þ/¥«¥¦¥ó¥¿x2 ¤ÈºÇÂç 0xffff ¤Þ¤Ç¿ô¤¨¤ë¤³¤È¤¬¤Ç¤­¤ë 16 ¥Ó¥Ã¥È¥¿¥¤¥Þ/¥«¥¦¥ó¥¿x1 ¤Ç¤¹¡£

¤³¤ì¤é¤Î¥¿¥¤¥Þ/¥«¥¦¥ó¥¿Éô¤Ë¤Ï¡¢ºÇÂçÃͤòĶ¤¨¤¿¤³¤È¤òÃΤ餻¤ë³ä¤ê¹þ¤ß¡Ê¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¡Ë¤ä¡¢»ØÄꤷ¤¿ÃͤËÅþ㤷¤¿¤³¤È¤òÃΤ餻¤ë³ä¤ê¹þ¤ß¡ÊÈæ³Ó°ìÃ׳ä¤ê¹þ¤ß¡ËÅù¤Îµ¡Ç½¤¬¤¢¤ê¤Þ¤¹¡£¤Þ¤¿¡¢PWM¡ÊPulse Width Modulation¡Ëµ¡Ç½¤â¤¢¤ë¤¿¤á¡¢¼ç¤Ë¥é¥¸¥³¥ó¤Ç»ÈÍѤµ¤ì¤ë¥µ¡¼¥Ü¥â¡¼¥¿¤òÈæ³ÓŪ´Êñ¤ËÀ©¸æ¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

¤³¤³¤Ç¤Ï¡¢¤½¤ì¤é 3 ¤Ä¤Î¥¿¥¤¥Þ/¥«¥¦¥ó¥¿Éô¤Ë¤Ä¤¤¤Æ³µÍפòÀâÌÀ¤·¡¢¼¡²ó°Ê¹ß¤Ë¤Æ¼ÂºÝ¤Ë¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 ¤È¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1 ¤ò»È¤Ã¤¿¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤òºî¤Ã¤Æ¤¤¤­¤Þ¤¹¡£¥¿¥¤¥Þ/¥«¥¦¥ó¥¿2 ¤Ï¡¢º£¤Î¤È¤³¤í»È¤Ã¤Æ¤ß¤ëͽÄê¤Ï¤¢¤ê¤Þ¤»¤ó¡£

¡û ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0

ATmega8535 ¤Î¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0¤Î¼ç¤Ê»ÅÍͤϰʲ¼¤ÎÍͤˤʤê¤Þ¤¹¡£

  • 8¥Ó¥Ã¥È¤Î¥«¥¦¥ó¥¿¥ì¥¸¥¹¥¿¤ò»ÈÍÑ
  • Èæ³Ó°ìÃפˤè¤ë¥¿¥¤¥Þ/¥«¥¦¥ó¥¿¤Î¥¯¥ê¥¢
  • ÇÈ·ÁÀ¸À®´ï¤Ë¤è¤ë OC0 ¥Ô¥ó¤Ø¤ÎÇÈ·Á½ÐÎÏ(²ÄÊѼþÇÈ¿ô½ÐÎÏ¡¢PWM)
  • ¥ª¡¼¥Ð¥Õ¥í¡¼³ä¤ê¹þ¤ß¤ò¥µ¥Ý¡¼¥È
  • Èæ³Ó°ìÃ׳ä¤ê¹þ¤ß¤ò¥µ¥Ý¡¼¥È

¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 ¤Ï¡¢8 ¥Ó¥Ã¥È¤Î TCNT0 ¥ì¥¸¥¹¥¿¤ò¥«¥¦¥ó¥¿¤È¤·¤ÆÆ°ºî¤·¤Þ¤¹¡£¸å½Ò¤ÎÆ°ºî¼ïÊ̤˱þ¤¸¤Æ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤¬ÀßÄꤵ¤ì¤ë¤È¡¢¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¤¬µö²Ä¤µ¤ì¤Æ¤¤¤ì¤Ð¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¤¬È¯À¸¤·¤Þ¤¹¡£¤Þ¤¿¡¢OCR0 ¥ì¥¸¥¹¥¿¤ËÀßÄꤵ¤ì¤¿ÃÍ¤È TCNT0 ¤ÎÃͤ¬°ìÃפ·¤¿¾ì¹ç¡¢Èæ³Ó°ìÃץե饰¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£¤³¤Î»þ¡¢Èæ³Ó°ìÃ׳ä¤ê¹þ¤ß¤¬µö²Ä¤µ¤ì¤Æ¤¤¤ì¤ÐÈæ³Ó°ìÃ׳ä¤ê¹þ¤ß¤¬È¯À¸¤·¤Þ¤¹¡£

Èæ³Ó°ìÃפ¬È¯À¸¤¹¤ë¤È¡¢TCCR0 ¥ì¥¸¥¹¥¿¡Ê¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0À©¸æ¥ì¥¸¥¹¥¿¡Ë¤Î COM01 - COM00 ¥Ó¥Ã¥È¤ª¤è¤Ó WGM01 - WGM00 ¤ÎÀßÄê¤Ë±þ¤¸¤Æ¡¢OC0 ¥Ô¥ó¡ÊPDIP ¥Ñ¥Ã¥±¡¼¥¸¤Î¾ì¹ç¤Ï 4 ¥Ô¥ó¡Ë¤ËÇÈ·Á¤¬½ÐÎϤµ¤ì¤Þ¤¹¡£

¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 ¤Î»ÈÍѤ˴ط¸¤¹¤ë¥ì¥¸¥¹¥¿¤Ï¡¢°Ê²¼¤È¤Ê¤ê¤Þ¤¹¡£

¥ì¥¸¥¹¥¿Ì¾ ÆâÍÆ
TCCR0 ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 À©¸æ¥ì¥¸¥¹¥¿
TCNT0 ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0
OCR0 ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 Èæ³Ó¥ì¥¸¥¹¥¿
TIMSK ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿³ä¤ê¹þ¤ß¥Þ¥¹¥¯¥ì¥¸¥¹¥¿¡Ê¥¿¥¤¥Þ/¥«¥¦¥ó¥¿´Ö¶¦ÄÌ¡Ë
TIFR ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿³ä¤ê¹þ¤ßÍ×µá¥Õ¥é¥°¥ì¥¸¥¹¥¿¡Ê¥¿¥¤¥Þ/¥«¥¦¥ó¥¿´Ö¶¦ÄÌ¡Ë

°Ê²¼¤Ï¡¢TCCR0 ¤ÎÀßÄê¤Ë±þ¤¸¤¿¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 ¤ÎÆ°ºî¼ïÊ̤Ǥ¹¡£

  • ɸ½àÆ°ºî
    • TCNT0 ¤Ï¾ï¤Ë¾å¾ºÊý¸þ¤Ë¥«¥¦¥ó¥È¥¢¥Ã¥×
    • TCNT0 ¤¬ 8 ¥Ó¥Ã¥ÈºÇÂçÃÍ(0xff) ¤ËÅþ㤹¤ë¤È¼¡¤Ï 0x00 ¤«¤é¥«¥¦¥ó¥È¥¢¥Ã¥×¤òºÆ³«
    • TCNT0 ¤¬ 0x00 ¤ËÅþ㤷¤¿»þ¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤òÀßÄê
    • OC0 ¥Ô¥óÇÈ·Á½ÐÎϤòÍ­¸ú¤Ë¤·¤¿¾ì¹ç¡¢OC0 ¥Ô¥ó½ÐÎϤÏÈæ³Ó°ìÃפΥ¿¥¤¥ß¥ó¥°¤Ç L/H/ȿž ¤Î¤¤¤º¤ì¤«

  • Èæ³Ó°ìÃ×¥¿¥¤¥Þ/¥«¥¦¥ó¥¿¥¯¥ê¥¢(CTC)
    • TCNT0 ¤Ï¾ï¤Ë¾å¾ºÊý¸þ¤Ë¥«¥¦¥ó¥È¥¢¥Ã¥×
    • TCNT0 ¤È OCR0 ¤¬°ìÃפ¹¤ë¤È¼¡¤Ï 0x00 ¤«¤é¥«¥¦¥ó¥È¥¢¥Ã¥×¤òºÆ³«
    • TCNT0 ¤¬ 0x00 ¤ËÅþ㤷¤¿»þ¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤òÀßÄê
    • OC0 ¥Ô¥óÇÈ·Á½ÐÎϤòÍ­¸ú¤Ë¤·¤¿¾ì¹ç¡¢OC0 ¥Ô¥ó½ÐÎϤÏÈæ³Ó°ìÃפΥ¿¥¤¥ß¥ó¥°¤Ç L/H/ȿž ¤Î¤¤¤º¤ì¤«

  • ¹â®PWM
    • TCNT0 ¤Ï¾ï¤Ë¾å¾ºÊý¸þ¤Ë¥«¥¦¥ó¥È¥¢¥Ã¥×
    • TCNT0 ¤¬ 8 ¥Ó¥Ã¥ÈºÇÂçÃÍ(0xff) ¤ËÅþ㤹¤ë¤È¼¡¤Ï 0x00 ¤«¤é¥«¥¦¥ó¥È¥¢¥Ã¥×¤òºÆ³«
    • TCNT0 ¤¬ 0xff ¤ËÅþ㤷¤¿»þ¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤òÀßÄê
    • OC0 ¥Ô¥óÇÈ·Á½ÐÎϤòÍ­¸ú¤Ë¤·¤¿¾ì¹ç¡¢OC0 ¥Ô¥ó½ÐÎϤÏÈæ³Ó°ìÃפª¤è¤Ó TCNT0 ¤Î 0x00 ¤Ø¤ÎÅþ㥿¥¤¥ß¥ó¥°¤Çȿž

  • °ÌÁê´ð½àPWM
    • TCNT0 ¤Ï 8 ¥Ó¥Ã¥ÈºÇÂçÃÍ(0xff) ¤ËÅþ㤹¤ë¤Þ¤Ç¤Ï¾å¾ºÊý¸þ¤Ë¥«¥¦¥ó¥È¥¢¥Ã¥×
    • TCNT0 ¤Ï 0xff ¤ËÅþã¸å 0x00 ¤ËÅþ㤹¤ë¤Þ¤Ç¤Ï²¼¹ßÊý¸þ¤Ë¥«¥¦¥ó¥È¥À¥¦¥ó
    • TCNT0 ¤¬ 0x00 ¤ËÅþ㤷¤¿»þ¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤òÀßÄê
    • OC0 ¥Ô¥óÇÈ·Á½ÐÎϤòÍ­¸ú¤Ë¤·¤¿¾ì¹ç¡¢OC0 ¥Ô¥ó½ÐÎϤϾ徺¤ª¤è¤Ó²¼¹ßÃæ¤ÎÈæ³Ó°ìÃפΥ¿¥¤¥ß¥ó¥°¤Çȿž

¡û ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1

ATmega8535 ¤Î¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1¤Î¼ç¤Ê»ÅÍͤϰʲ¼¤ÎÍͤˤʤê¤Þ¤¹¡£

  • 16¥Ó¥Ã¥È¤Î¥«¥¦¥ó¥¿¥ì¥¸¥¹¥¿¤ò»ÈÍÑ
  • 2 ¤Ä¤ÎÈæ³Ó½ÐÎÏ
  • Êá³ÍÆþÎÏ
  • Èæ³Ó°ìÃפˤè¤ë¥¿¥¤¥Þ/¥«¥¦¥ó¥¿¤Î¥¯¥ê¥¢
  • ÇÈ·ÁÀ¸À®´ï¤Ë¤è¤ë OC1A/OC1B ¥Ô¥ó¤Ø¤ÎÇÈ·Á½ÐÎÏ(²ÄÊѼþÇÈ¿ô½ÐÎÏ¡¢PWM)
  • ¥ª¡¼¥Ð¥Õ¥í¡¼³ä¤ê¹þ¤ß¤ò¥µ¥Ý¡¼¥È
  • 2 ¤Ä¤ÎÈæ³Ó°ìÃ׳ä¤ê¹þ¤ß¤ò¥µ¥Ý¡¼¥È
  • Êá³Í³ä¤ê¹þ¤ß¤ò¥µ¥Ý¡¼¥È

¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1 ¤Ï¡¢16 ¥Ó¥Ã¥È¤Î TCNT1 ¥ì¥¸¥¹¥¿¤ò¥«¥¦¥ó¥¿¤È¤·¤ÆÆ°ºî¤·¤Þ¤¹¡£¸å½Ò¤ÎÆ°ºî¼ïÊ̤˱þ¤¸¤Æ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤¬ÀßÄꤵ¤ì¤ë¤È¡¢¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¤¬µö²Ä¤µ¤ì¤Æ¤¤¤ì¤Ð¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¤¬È¯À¸¤·¤Þ¤¹¡£¤Þ¤¿¡¢OCR1A/OCR1B ¥ì¥¸¥¹¥¿¤ËÀßÄꤵ¤ì¤¿ÃÍ¤È TCNT1 ¤ÎÃͤ¬°ìÃפ·¤¿¾ì¹ç¡¢Èæ³Ó°ìÃץե饰¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£¤³¤Î»þ¡¢Èæ³Ó°ìÃ׳ä¹þ¤ß¤¬µö²Ä¤µ¤ì¤Æ¤¤¤ì¤ÐÈæ³Ó°ìÃ׳ä¤ê¹þ¤ß¤¬È¯À¸¤·¤Þ¤¹¡£

Èæ³Ó°ìÃפ¬È¯À¸¤¹¤ë¤È¡¢TCCR1A ¥ì¥¸¥¹¥¿¡Ê¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1À©¸æ¥ì¥¸¥¹¥¿A¡Ë¤Î COM1A1/COM1A0 - COM1B1/COM1B0 ¥Ó¥Ã¥È¡¢WGM11 - WGM10 ¥Ó¥Ã¥È¤ª¤è¤Ó TCCR1B ¥ì¥¸¥¹¥¿¡Ê¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1À©¸æ¥ì¥¸¥¹¥¿B¡Ë¤Î WGM13 - WGM12 ¥Ó¥Ã¥È¤ÎÀßÄê¤Ë±þ¤¸¤Æ¡¢OC1A/OC1B ¥Ô¥ó¡ÊPDIP ¥Ñ¥Ã¥±¡¼¥¸¤Î¾ì¹ç¤Ï 19/18 ¥Ô¥ó¡Ë¤ËÇÈ·Á¤¬½ÐÎϤµ¤ì¤Þ¤¹¡£

ICP1 ¥Ô¥ó¤â¤·¤¯¤Ï¥¢¥Ê¥í¥°Èæ³Ó´ï¤Î½ÐÎϤËÊѲ½¤¬¤¢¤ë¤È¡¢TCNT1 ¤ÎÃͤ¬ ICR1 ¥ì¥¸¥¹¥¿¤Ë¥³¥Ô¡¼¤µ¤ì¡¢Êá³Í³ä¤ê¹þ¤ßÍ×µá¥Õ¥é¥°¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£Êá³Í³ä¤ê¹þ¤ß¤¬µö²Ä¤µ¤ì¤Æ¤¤¤ì¤ÐÊá³Í³ä¤ê¹þ¤ß¤¬È¯À¸¤·¤Þ¤¹¡£

¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1 ¤Î»ÈÍѤ˴ط¸¤¹¤ë¥ì¥¸¥¹¥¿¤Ï¡¢°Ê²¼¤È¤Ê¤ê¤Þ¤¹¡Ê¾ÜºÙ¤Ï¼¡²ó°Ê¹ß¡Ë¡£

¥ì¥¸¥¹¥¿Ì¾ ÆâÍÆ
TCCR1A ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1 À©¸æ¥ì¥¸¥¹¥¿A
TCCR1B ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1 À©¸æ¥ì¥¸¥¹¥¿B
TCNT1 ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1
OCR1A ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1 Èæ³Ó¥ì¥¸¥¹¥¿A
OCR1B ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1 Èæ³Ó¥ì¥¸¥¹¥¿B
ICR1 ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1 Êá³Í¥ì¥¸¥¹¥¿
TIMSK ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿³ä¤ê¹þ¤ß¥Þ¥¹¥¯¥ì¥¸¥¹¥¿¡Ê¥¿¥¤¥Þ/¥«¥¦¥ó¥¿´Ö¶¦ÄÌ¡Ë
TIFR ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿³ä¤ê¹þ¤ßÍ×µá¥Õ¥é¥°¥ì¥¸¥¹¥¿¡Ê¥¿¥¤¥Þ/¥«¥¦¥ó¥¿´Ö¶¦ÄÌ¡Ë

°Ê²¼¤Ï¡¢TCCR1A/TCCR1B ¤ÎÀßÄê¤Ë±þ¤¸¤¿¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1 ¤ÎÆ°ºî¼ïÊ̤Ǥ¹¡£

  • ɸ½àÆ°ºî
    • TCNT1 ¤Ï¾ï¤Ë¾å¾ºÊý¸þ¤Ë¥«¥¦¥ó¥È¥¢¥Ã¥×
    • TCNT1 ¤¬ 16 ¥Ó¥Ã¥ÈºÇÂçÃÍ(0xffff) ¤ËÅþ㤹¤ë¤È¼¡¤Ï 0x0000 ¤«¤é¥«¥¦¥ó¥È¥¢¥Ã¥×¤òºÆ³«
    • TCNT1 ¤¬ 0x0000 ¤ËÅþ㤷¤¿»þ¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤òÀßÄê
    • OC1A/OC1B ¥Ô¥óÇÈ·Á½ÐÎϤòÍ­¸ú¤Ë¤·¤¿¾ì¹ç¡¢OC1A/OC1B ¥Ô¥ó½ÐÎϤÏÈæ³Ó°ìÃפΥ¿¥¤¥ß¥ó¥°¤Ç L/H/ȿž ¤Î¤¤¤º¤ì¤«

  • Èæ³Ó°ìÃ×¥¿¥¤¥Þ/¥«¥¦¥ó¥¿¥¯¥ê¥¢(CTC)
    • TCNT1 ¤Ï¾ï¤Ë¾å¾ºÊý¸þ¤Ë¥«¥¦¥ó¥È¥¢¥Ã¥×
    • TCNT1 ¤È OCR1A/ICR1 ¤Î¤¤¤º¤ì¤«¡ÊÀßÄê°Í¸¡Ë¤È°ìÃפ¹¤ë¤È¼¡¤Ï 0x0000 ¤«¤é¥«¥¦¥ó¥È¥¢¥Ã¥×¤òºÆ³«
    • ¢¬¤Ç ICR1 ¤ò»È¤¦¾ì¹ç¡¢°ìÃ×»þ¤ËÊá³Í³ä¤ê¹þ¤ßȯÀ¸
    • TCNT1 ¤¬ 0x0000 ¤ËÅþ㤷¤¿»þ¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤òÀßÄê
    • OC1A/OC1B ¥Ô¥óÇÈ·Á½ÐÎϤòÍ­¸ú¤Ë¤·¤¿¾ì¹ç¡¢OC1A/OC1B ¥Ô¥ó½ÐÎϤÏÈæ³Ó°ìÃפΥ¿¥¤¥ß¥ó¥°¤Ç L/H/ȿž ¤Î¤¤¤º¤ì¤«

  • ¹â®PWM
    • TCNT1 ¤Ï¾ï¤Ë¾å¾ºÊý¸þ¤Ë¥«¥¦¥ó¥È¥¢¥Ã¥×
    • TCNT1 ¤¬ÀßÄê¤Ë±þ¤¸¤Æ 0xff/0x1ff/0x3ff/ICR1/OCR1A ¤Î¤¤¤º¤ì¤«¤ËÅþ㤹¤ë¤È¼¡¤Ï 0x0000 ¤«¤é¥«¥¦¥ó¥È¥¢¥Ã¥×¤òºÆ³«
    • TCNT0 ¤¬ÀßÄê¤Ë±þ¤¸¤Æ 0xff/0x1ff/0x3ff/ICR1/OCR1A ¤Î¤¤¤º¤ì¤«¤ËÅþ㤷¤¿»þ¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤òÀßÄê
    • ¢¬¤Ç ICR1 ¤ò»È¤¦¾ì¹ç¡¢°ìÃ×»þ¤ËÊá³Í³ä¤ê¹þ¤ßȯÀ¸
    • OC1A/OC1B ¥Ô¥óÇÈ·Á½ÐÎϤòÍ­¸ú¤Ë¤·¤¿¾ì¹ç¡¢OC1A/OC1B ¥Ô¥ó½ÐÎϤÏÈæ³Ó°ìÃפª¤è¤Ó TCNT1 ¤Î 0x0000 ¤Ø¤ÎÅþ㥿¥¤¥ß¥ó¥°¤Çȿž¡¢OC1A ¤Ï¾¤ËÈæ³Ó°ìÃפΥ¿¥¤¥ß¥ó¥°¤Çȿž¤âÍ­

  • °ÌÁê´ð½àPWM
    • TCNT1 ¤ÏÀßÄê¤Ë±þ¤¸¤Æ 0xff/0x1ff/0x3ff/ICR1/OCR1A ¤Î¤¤¤º¤ì¤«¤ËÅþ㤹¤ë¤Þ¤Ç¤Ï¾å¾ºÊý¸þ¤Ë¥«¥¦¥ó¥È¥¢¥Ã¥×
    • ¢¬¤Ç ICR1 ¤ò»È¤¦¾ì¹ç¡¢°ìÃ×»þ¤ËÊá³Í³ä¤ê¹þ¤ßȯÀ¸
    • TCNT1 ¤Ï 0x0000 ¤ËÅþ㤹¤ë¤Þ¤Ç¤Ï²¼¹ßÊý¸þ¤Ë¥«¥¦¥ó¥È¥À¥¦¥ó
    • TCNT1 ¤¬ 0x0000 ¤ËÅþ㤷¤¿»þ¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤òÀßÄê
    • OC1A/OC1B ¥Ô¥óÇÈ·Á½ÐÎϤòÍ­¸ú¤Ë¤·¤¿¾ì¹ç¡¢OC1A/OC1B ¥Ô¥ó½ÐÎϤϾ徺¤ª¤è¤Ó²¼¹ßÃæ¤ÎÈæ³Ó°ìÃפΥ¿¥¤¥ß¥ó¥°¤Çȿž
    • OCR1A/OCR1B¡ÊÈæ³Ó°ìÃץ쥸¥¹¥¿¡Ë¤Î¹¹¿·¤ÏºÇ¹âÅþãÅÀ¤Ë¤ÆȯÀ¸

  • °ÌÁê/¼þÇÈ¿ô´ð½àPWM
    • TCNT1 ¤ÏÀßÄê¤Ë±þ¤¸¤Æ 0xff/0x1ff/0x3ff/ICR1/OCR1A ¤Î¤¤¤º¤ì¤«¤ËÅþ㤹¤ë¤Þ¤Ç¤Ï¾å¾ºÊý¸þ¤Ë¥«¥¦¥ó¥È¥¢¥Ã¥×
    • ¢¬¤Ç ICR1 ¤ò»È¤¦¾ì¹ç¡¢°ìÃ×»þ¤ËÊá³Í³ä¤ê¹þ¤ßȯÀ¸
    • TCNT1 ¤Ï 0x0000 ¤ËÅþ㤹¤ë¤Þ¤Ç¤Ï²¼¹ßÊý¸þ¤Ë¥«¥¦¥ó¥È¥À¥¦¥ó
    • TCNT1 ¤¬ 0x0000 ¤ËÅþ㤷¤¿»þ¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤òÀßÄê
    • OC1A/OC1B ¥Ô¥óÇÈ·Á½ÐÎϤòÍ­¸ú¤Ë¤·¤¿¾ì¹ç¡¢OC1A/OC1B ¥Ô¥ó½ÐÎϤϾ徺¤ª¤è¤Ó²¼¹ßÃæ¤ÎÈæ³Ó°ìÃפΥ¿¥¤¥ß¥ó¥°¤Çȿž
    • OCR1A/OCR1B¡ÊÈæ³Ó°ìÃץ쥸¥¹¥¿¡Ë¤Î¹¹¿·¤Ï 0x0000 ¤Ë¤ÆȯÀ¸

¡û ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿2

ATmega8535 ¤Î¥¿¥¤¥Þ/¥«¥¦¥ó¥¿2¤Î¼ç¤Ê»ÅÍͤϰʲ¼¤ÎÍͤˤʤê¤Þ¤¹¡£

  • 8¥Ó¥Ã¥È¤Î¥«¥¦¥ó¥¿¥ì¥¸¥¹¥¿¤ò»ÈÍÑ
  • Èæ³Ó°ìÃפˤè¤ë¥¿¥¤¥Þ/¥«¥¦¥ó¥¿¤Î¥¯¥ê¥¢
  • ÇÈ·ÁÀ¸À®´ï¤Ë¤è¤ë OC2 ¥Ô¥ó¤Ø¤ÎÇÈ·Á½ÐÎÏ(²ÄÊѼþÇÈ¿ô½ÐÎÏ¡¢PWM)
  • ¥ª¡¼¥Ð¥Õ¥í¡¼³ä¤ê¹þ¤ß¤ò¥µ¥Ý¡¼¥È
  • Èæ³Ó°ìÃ׳ä¤ê¹þ¤ß¤ò¥µ¥Ý¡¼¥È
  • »þ·×Íѳ°Éô32KHz¿å¾½¤Ë¤è¤ë¥¯¥í¥Ã¥¯¶îÆ°²Äǽ

¥¿¥¤¥Þ/¥«¥¦¥ó¥¿2 ¤Ï¡¢8 ¥Ó¥Ã¥È¤Î TCNT2 ¥ì¥¸¥¹¥¿¤ò¥«¥¦¥ó¥¿¤È¤·¤ÆÆ°ºî¤·¤Þ¤¹¡£¸å½Ò¤ÎÆ°ºî¼ïÊ̤˱þ¤¸¤Æ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤¬ÀßÄꤵ¤ì¤ë¤È¡¢¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¤¬µö²Ä¤µ¤ì¤Æ¤¤¤ì¤Ð¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¤¬È¯À¸¤·¤Þ¤¹¡£¤Þ¤¿¡¢OCR2 ¥ì¥¸¥¹¥¿¤ËÀßÄꤵ¤ì¤¿ÃÍ¤È TCNT2 ¤ÎÃͤ¬°ìÃפ·¤¿¾ì¹ç¡¢Èæ³Ó°ìÃץե饰¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£¤³¤Î»þ¡¢Èæ³Ó°ìÃ׳ä¤ê¹þ¤ß¤¬µö²Ä¤µ¤ì¤Æ¤¤¤ì¤ÐÈæ³Ó°ìÃ׳ä¤ê¹þ¤ß¤¬È¯À¸¤·¤Þ¤¹¡£

Èæ³Ó°ìÃפ¬È¯À¸¤¹¤ë¤È¡¢TCCR2 ¥ì¥¸¥¹¥¿¡Ê¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0À©¸æ¥ì¥¸¥¹¥¿¡Ë¤Î COM21 - COM20 ¥Ó¥Ã¥È¤ª¤è¤Ó WGM21 - WGM20 ¥Ó¥Ã¥È¤ÎÀßÄê¤Ë±þ¤¸¤Æ¡¢OC2 ¥Ô¥ó¡ÊPDIP ¥Ñ¥Ã¥±¡¼¥¸¤Î¾ì¹ç¤Ï 21 ¥Ô¥ó¡Ë¤ËÇÈ·Á¤¬½ÐÎϤµ¤ì¤Þ¤¹¡£

¥¿¥¤¥Þ/¥«¥¦¥ó¥¿2 ¤Î»ÈÍѤ˴ط¸¤¹¤ë¥ì¥¸¥¹¥¿¤Ï¡¢°Ê²¼¤È¤Ê¤ê¤Þ¤¹¡£

¥ì¥¸¥¹¥¿Ì¾ ÆâÍÆ
TCCR2 ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿2 À©¸æ¥ì¥¸¥¹¥¿
TCNT2 ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿2
OCR2 ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿2 Èæ³Ó¥ì¥¸¥¹¥¿
TIMSK ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿³ä¤ê¹þ¤ß¥Þ¥¹¥¯¥ì¥¸¥¹¥¿¡Ê¥¿¥¤¥Þ/¥«¥¦¥ó¥¿´Ö¶¦ÄÌ¡Ë
TIFR ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿³ä¤ê¹þ¤ßÍ×µá¥Õ¥é¥°¥ì¥¸¥¹¥¿¡Ê¥¿¥¤¥Þ/¥«¥¦¥ó¥¿´Ö¶¦ÄÌ¡Ë
ASSR ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿2 ÈóƱ´ü¾õÂ֥쥸¥¹¥¿
SFIOR ÆüìI/Oµ¡Ç½¥ì¥¸¥¹¥¿

°Ê²¼¤Ï¡¢TCCR2 ¤ÎÀßÄê¤Ë±þ¤¸¤¿¥¿¥¤¥Þ/¥«¥¦¥ó¥¿2 ¤ÎÆ°ºî¼ïÊ̤Ǥ¹¡£

  • ɸ½àÆ°ºî
    • TCNT2 ¤Ï¾ï¤Ë¾å¾ºÊý¸þ¤Ë¥«¥¦¥ó¥È¥¢¥Ã¥×
    • TCNT2 ¤¬ 8 ¥Ó¥Ã¥ÈºÇÂçÃÍ(0xff) ¤ËÅþ㤹¤ë¤È¼¡¤Ï 0x00 ¤«¤é¥«¥¦¥ó¥È¥¢¥Ã¥×¤òºÆ³«
    • TCNT2 ¤¬ 0x00 ¤ËÅþ㤷¤¿»þ¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤òÀßÄê
    • OC2 ¥Ô¥óÇÈ·Á½ÐÎϤòÍ­¸ú¤Ë¤·¤¿¾ì¹ç¡¢OC2 ¥Ô¥ó½ÐÎϤÏÈæ³Ó°ìÃפΥ¿¥¤¥ß¥ó¥°¤Ç L/H/ȿž ¤Î¤¤¤º¤ì¤«

  • Èæ³Ó°ìÃ×¥¿¥¤¥Þ/¥«¥¦¥ó¥¿¥¯¥ê¥¢(CTC)
    • TCNT2 ¤Ï¾ï¤Ë¾å¾ºÊý¸þ¤Ë¥«¥¦¥ó¥È¥¢¥Ã¥×
    • TCNT2 ¤È OCR2 ¤¬°ìÃפ¹¤ë¤È¼¡¤Ï 0x00 ¤«¤é¥«¥¦¥ó¥È¥¢¥Ã¥×¤òºÆ³«
    • TCNT2 ¤¬ 0x00 ¤ËÅþ㤷¤¿»þ¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤òÀßÄê
    • OC2 ¥Ô¥óÇÈ·Á½ÐÎϤòÍ­¸ú¤Ë¤·¤¿¾ì¹ç¡¢OC2 ¥Ô¥ó½ÐÎϤÏÈæ³Ó°ìÃפΥ¿¥¤¥ß¥ó¥°¤Ç L/H/ȿž ¤Î¤¤¤º¤ì¤«

  • ¹â®PWM
    • TCNT2 ¤Ï¾ï¤Ë¾å¾ºÊý¸þ¤Ë¥«¥¦¥ó¥È¥¢¥Ã¥×
    • TCNT2 ¤¬ 8 ¥Ó¥Ã¥ÈºÇÂçÃÍ(0xff) ¤ËÅþ㤹¤ë¤È¼¡¤Ï 0x00 ¤«¤é¥«¥¦¥ó¥È¥¢¥Ã¥×¤òºÆ³«
    • TCNT2 ¤¬ 0xff ¤ËÅþ㤷¤¿»þ¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤òÀßÄê
    • OC2 ¥Ô¥óÇÈ·Á½ÐÎϤòÍ­¸ú¤Ë¤·¤¿¾ì¹ç¡¢OC2 ¥Ô¥ó½ÐÎϤÏÈæ³Ó°ìÃפª¤è¤Ó TCNT2 ¤Î 0x00 ¤Ø¤ÎÅþ㥿¥¤¥ß¥ó¥°¤Çȿž

  • °ÌÁê´ð½àPWM
    • TCNT2 ¤Ï 8 ¥Ó¥Ã¥ÈºÇÂçÃÍ(0xff) ¤ËÅþ㤹¤ë¤Þ¤Ç¤Ï¾å¾ºÊý¸þ¤Ë¥«¥¦¥ó¥È¥¢¥Ã¥×
    • TCNT2 ¤Ï 0xff ¤ËÅþã¸å 0x00 ¤ËÅþ㤹¤ë¤Þ¤Ç¤Ï²¼¹ßÊý¸þ¤Ë¥«¥¦¥ó¥È¥À¥¦¥ó
    • TCNT2 ¤¬ 0x00 ¤ËÅþ㤷¤¿»þ¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¤òÀßÄê
    • OC2 ¥Ô¥óÇÈ·Á½ÐÎϤòÍ­¸ú¤Ë¤·¤¿¾ì¹ç¡¢OC2 ¥Ô¥ó½ÐÎϤϾ徺¤ª¤è¤Ó²¼¹ßÃæ¤ÎÈæ³Ó°ìÃפΥ¿¥¤¥ß¥ó¥°¤Çȿž

¼¡²ó°Ê¹ß¤Ç¡¢¼ÂºÝ¤Ë¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 ¤ª¤è¤Ó¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1 ¤ò»È¤Ã¤Æ¤ß¤¿¤¤¤È»×¤¤¤Þ¤¹¡£¥¿¥¤¥Þ/¥«¥¦¥ó¥¿2 ¤Ï¡¢º£¤Î¤È¤³¤í»È¤Ã¤Æ¤ß¤ëͽÄê¤Ï¤¢¤ê¤Þ¤»¤ó¡£