LECTURE 7 ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0¤ò»È¤¦

¡û ´ØÏ¢¥ì¥¸¥¹¥¿

¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0´ØÏ¢¤Î¥ì¥¸¥¹¥¿¤ò°Ê²¼¤Ë¾Ò²ð¤·¤Þ¤¹¡£¥Þ¥¯¥í¤Ë¤Ä¤¤¤Æ¤Ï¡¢avr-libc ¤Ç»ÈÍѤǤ­¤ëÄêµÁ̾¤ò·ÇºÜ¤·¤Æ¤¤¤Þ¤¹¡£¤Þ¤¿¡¢ÆüËܸì¤Î¥ì¥¸¥¹¥¿Ì¾¤È¥Ó¥Ã¥È̾¤Ï¡¢±Ñ¸ì¤ÎÄêµÁ̾¾Î¤òŬÅö¤ËÌõ¤·¤Æ¤Þ¤¹¡£

  • ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0À©¸æ¥ì¥¸¥¹¥¿(TCCR0)

    ¥Ó¥Ã¥ÈÈÖ¹æ 7 6 5 4 3 2 1 0
    ¥Þ¥¯¥í FOC0 WGM00 COM01 COM00 WGM01 CS02 CS01 CS00
    ½é´üÃÍ 0 0 0 0 0 0 0 0

    ³Æ¥Ó¥Ã¥È¤ÎÀâÌÀ¤ò°Ê²¼¤Ë½ñ¤­¤Þ¤¹¡£

    ¥Ó¥Ã¥È̾ ÆâÍÆ
    FOC0¡ÊOC0¶¯À©½ÐÎÏ¡Ë Æ°ºî¼ïÊ̤¬É¸½àÆ°ºî¤ª¤è¤ÓÈæ³Ó°ìÃ×¥¿¥¤¥Þ/¥«¥¦¥ó¥¿¥¯¥ê¥¢¤Î¾ì¹ç¤Ë¡¢1 ¤òÀßÄꤹ¤ë¤³¤È¤Ç¶¯À©Åª¤ËÈæ³Ó°ìÃפòȯÀ¸¤µ¤»¤Þ¤¹¡£³ä¤ê¹þ¤ß¤ä¥¿¥¤¥Þ/¥«¥¦¥ó¥¿¤Î¥¯¥ê¥¢¤Ï¹Ô¤ï¤ì¤º¡¢OC0 ¥Ô¥ó¤Î½ÐÎϤΤßÊѹ¹¤Ë¤Ê¤ëÍͤǤ¹¡£¼«Ê¬¤Ï»È¤¤½ê¤¬¤è¤¯Ê¬¤ê¤Þ¤»¤ó¤¬¡Ä
    WGM00¡ÊÇÈ·ÁÀ¸À®¥â¡¼¥É¡Ë ¸å½Ò¤Î WGM01 ¤ÈÊ»¤»¤ÆÆ°ºî¼ïÊÌ¡ÊLECTURE 6 ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿¤Ë¤Ä¤¤¤Æ¤ò»²¾È¡Ë¤òÀßÄꤷ¤Þ¤¹¡£

    WGM01 WGM00 Æ°ºî¼ïÊÌ
    0 0 ɸ½àÆ°ºî
    0 1 °ÌÁê´ð½àPWM
    1 0 Èæ³Ó°ìÃ×¥¿¥¤¥Þ/¥«¥¦¥ó¥¿¥¯¥ê¥¢
    1 1 ¹â®PWM

    COM01/COM00¡ÊÈæ³Ó0½ÐÎϥ⡼¥É¡Ë OC0 ¥Ô¥ó¡ÊPDIP ¥Ñ¥Ã¥±¡¼¥¸¤Ç¤Ï 4 ¥Ô¥ó¡Ë¤Î½ÐÎÏÊý¼°¤òÀßÄꤷ¤Þ¤¹¡£

    • WGM00 = 0 ¤Î¾ì¹ç¡Êɸ½àÆ°ºî¡¢CTCÆ°ºî¡Ë
      COM01 COM00 ÆâÍÆ
      0 0 OC0 ¤Ë¤Ï½ÐÎϤµ¤ì¤Ê¤¤
      0 1 Èæ³Ó°ìÃפˤª¤¤¤Æȿž
      1 0 Èæ³Ó°ìÃפˤª¤¤¤Æ 0(Low)
      1 1 Èæ³Ó°ìÃפˤª¤¤¤Æ 1(High)

    • WGM00 = 1¡¢WGM01 = 1 ¤Î¾ì¹ç¡Ê¹â®PWM¡Ë
      COM01 COM00 ÆâÍÆ
      0 0 OC0 ¤Ë¤Ï½ÐÎϤµ¤ì¤Ê¤¤
      0 1 ͽÌó
      1 0 Èæ³Ó°ìÃ×¤Ç 0(Low)¡¢TCNT0 = 0 ¤Ç 1(High)
      1 1 Èæ³Ó°ìÃ×¤Ç 1(High)¡¢TCNT0 = 0 ¤Ç 0(Low)

    • WGM00 = 1¡¢WGM01 = 0 ¤Î¾ì¹ç¡Ê°ÌÁê´ð½àPWM¡Ë
      COM01 COM00 ÆâÍÆ
      0 0 OC0 ¤Ë¤Ï½ÐÎϤµ¤ì¤Ê¤¤
      0 1 ͽÌó
      1 0 TCNT0 ¾å¾º»þ¤ÎÈæ³Ó°ìÃ×¤Ç 0(Low)¡¢²¼¹ß»þ¤ÎÈæ³Ó°ìÃ×¤Ç 1(High)
      1 1 TCNT0 ¾å¾º»þ¤ÎÈæ³Ó°ìÃ×¤Ç 1(High)¡¢²¼¹ß»þ¤ÎÈæ³Ó°ìÃ×¤Ç 0(Low)

    WGM01¡ÊÇÈ·ÁÀ¸À®¥â¡¼¥É¡Ë WGM00 ¤ÎÀâÌÀ¤ò»²¾È
    CS02/CS01/CS00¡Ê¥¯¥í¥Ã¥¯ÁªÂò¡Ë ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0¤Ç»ÈÍѤ¹¤ë¥¯¥í¥Ã¥¯¤Î¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤ËÂФ¹¤ëʬ¼þÈæ¡¢¤¢¤ë¤¤¤Ï³°Éô¥¯¥í¥Ã¥¯¤Î»ÈÍѤò°Ê²¼¤ÎÁȤ߹ç¤ï¤»¤ÇÀßÄꤷ¤Þ¤¹¡£

    CS02 CS01 CS00 ÆâÍÆ
    0 0 0 ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0Ää»ß
    0 0 1 ʬ¼þÈæ̵¤·
    0 1 0 CK/8
    0 1 1 CK/64
    1 0 0 CK/256
    1 0 1 CK/1024
    1 1 0 ³°Éô¥¯¥í¥Ã¥¯¡£T0 ¥Ô¥ó¡ÊPDIP ¥Ñ¥Ã¥±¡¼¥¸¤Ç¤Ï 1 ¥Ô¥ó¡Ë¤ÎΩ¤Á²¼¤¬¤ê¥¨¥Ã¥¸
    1 1 1 ³°Éô¥¯¥í¥Ã¥¯¡£T0 ¥Ô¥ó¡ÊPDIP ¥Ñ¥Ã¥±¡¼¥¸¤Ç¤Ï 1 ¥Ô¥ó¡Ë¤ÎΩ¤Á¾å¤¬¤ê¥¨¥Ã¥¸


  • ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0¥«¥¦¥ó¥¿(TCNT0)

    8¥Ó¥Ã¥È¤Î¥«¥¦¥ó¥¿Ãͤò³ÊǼ¤¹¤ë¥ì¥¸¥¹¥¿¤Ç¤¹¡£

    ¥Ó¥Ã¥ÈÈÖ¹æ 7 6 5 4 3 2 1 0
    ¥Þ¥¯¥í - - - - - - - -
    ½é´üÃÍ 0 0 0 0 0 0 0 0


  • ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0Èæ³Ó¥ì¥¸¥¹¥¿(OCR0)

    TCNT0 ¤ÎÃͤȤÎÈæ³Ó¤Ë»È¤ï¤ì¤ë 8 ¥Ó¥Ã¥È¥ì¥¸¥¹¥¿¤Ç¤¹¡£

    ¥Ó¥Ã¥ÈÈÖ¹æ 7 6 5 4 3 2 1 0
    ¥Þ¥¯¥í - - - - - - - -
    ½é´üÃÍ 0 0 0 0 0 0 0 0


  • ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿³ä¤ê¹þ¤ß¥Þ¥¹¥¯¥ì¥¸¥¹¥¿(TIMSK)¡Ê¥¿¥¤¥Þ/¥«¥¦¥ó¥¿´Ö¶¦ÄÌ¡Ë
    ¢¨¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0¤Ë´Ø·¸Í­¤ë¤Î¤Ï OCIE0 / TOIE0 ¤Ç¤¹¡£

    ¥Ó¥Ã¥ÈÈÖ¹æ 7 6 5 4 3 2 1 0
    ¥Þ¥¯¥í OCIE2 TOIE2 TICIE1 OCIE1A OCIE1B TOIE1 OCIE0 TOIE0
    ½é´üÃÍ 0 0 0 0 0 0 0 0

    ³Æ¥Ó¥Ã¥È¤ÎÀâÌÀ¤ò°Ê²¼¤Ë½ñ¤­¤Þ¤¹¡£

    ¥Ó¥Ã¥È̾ ÆâÍÆ
    OCIE0¡ÊÈæ³Ó°ìÃץե饰³ä¤ê¹þ¤ßµö²Ä¡Ë 1 ¤òÀßÄꤹ¤ë¤È¡¢Èæ³Ó°ìÃ׳ä¤ê¹þ¤ß¤¬Í­¸ú¤Ë¤Ê¤ê¤Þ¤¹¡£
    TOIE0¡Ê¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ßµö²Ä¡Ë 1 ¤òÀßÄꤹ¤ë¤È¡¢¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¤¬Í­¸ú¤Ë¤Ê¤ê¤Þ¤¹¡£


  • ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿³ä¤ê¹þ¤ßÍ×µá¥Õ¥é¥°¥ì¥¸¥¹¥¿(TIFR)¡Ê¥¿¥¤¥Þ/¥«¥¦¥ó¥¿´Ö¶¦ÄÌ¡Ë
    ¢¨¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0¤Ë´Ø·¸Í­¤ë¤Î¤Ï OCF0 / TOV0 ¤Ç¤¹¡£

    ¥Ó¥Ã¥ÈÈÖ¹æ 7 6 5 4 3 2 1 0
    ¥Þ¥¯¥í OCF2 TOV2 ICF1 OCF1A OCF1B TOV1 OCF0 TOV0
    ½é´üÃÍ 0 0 0 0 0 0 0 0

    ³Æ¥Ó¥Ã¥È¤ÎÀâÌÀ¤ò°Ê²¼¤Ë½ñ¤­¤Þ¤¹¡£

    ¥Ó¥Ã¥È̾ ÆâÍÆ
    OCF0¡ÊÈæ³Ó°ìÃץե饰¡Ë TCNT0 ¤È OCR0 ¤ÎÃͤ¬°ìÃפ·¤¿¾ì¹ç¤Ë 1 ¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£³ä¤ê¹þ¤ß½èÍý»þ¤Ë¼«Æ°Åª¤Ë 0 ¤È¤Ê¤ë¾¡¢1 ¤ò½ñ¤­¹þ¤à¤³¤È¤Ç 0 ¤È¤Ê¤ê¤Þ¤¹¡£
    TOV0¡Ê¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¡Ë TCNT0 ¤Ç¤Î¥ª¡¼¥Ð¡¼¥Õ¥í¡¼È¯À¸»þ¤Ë 1 ¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£³ä¤ê¹þ¤ß½èÍý»þ¤Ë¼«Æ°Åª¤Ë 0 ¤È¤Ê¤ë¾¡¢1 ¤ò½ñ¤­¹þ¤à¤³¤È¤Ç 0 ¤È¤Ê¤ê¤Þ¤¹¡£

¡û ²óÏ©¿Þ

LECTURE 1 ATmega8535 ¤ª¤è¤Ó»ÈÍѴĶ­¤Ë¤Ä¤¤¤Æ ¤Ë·ÇºÜ¤·¤Æ¤¢¤ëÁ´ÂβóÏ©¿Þ¤ËÂФ·¤Æ¡¢ÅÀÌǤµ¤»¤ë LED Éôʬ¤òÀÖÏȤǰϤó¤À¿Þ¤ò¤³¤Á¤é¤ËÃÖ¤¤¤Æ¤ª¤­¤Þ¤¹¡£¡Ä¤È¤Ï¸À¤Ã¤Æ¤â¡¢LECTURE 2 LED ¤òÅÀÌǤµ¤»¤ë ¤ÈÁ´¤¯Æ±¤¸¤Ê¤Î¤Ç¤½¤Á¤é¤Î¿Þ¤Ø¤Î¥ê¥ó¥¯¤Ç¤¹¡£

¡û ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ÈÀâÌÀ

¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0¤ò»È¤Ã¤Æ LED ¤òÅÀÌǤµ¤»¤ë¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ò 07timer0.tar.gz ¤«¤é¥À¥¦¥ó¥í¡¼¥É¤Ç¤­¤Þ¤¹¡£¤Ï¤¸¤á¤Ë ¤Î¥Ú¡¼¥¸¤«¤é¡¢Á´¤Æ¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ò ¸Ç¤á¤¿ tar ¥Õ¥¡¥¤¥ë¤ò¥À¥¦¥ó¥í¡¼¥É¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£

Ãæ¤Ë¤Ï

  • Makefile
  • util.h
  • util.c
  • timer0.h
  • timer0.c
  • main-ov.c
  • main-comp.c

¤¬³ÊǼ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£util.h/util.c ¤Ë¤Ä¤¤¤Æ¤Ï LECTURE 4 A/D ÊÑ´¹¤Ç¥Ü¥ê¥å¡¼¥à¡Ê²ÄÊÑÄñ¹³¡ËÃͤòÆÉ¤à ¤ÎÆâÍƤÈƱ¤¸¤Ç Makefile ¤â¤Û¤È¤ó¤ÉÊѤï¤é¤Ê¤¤¤Î¤Ç¡¢¤½¤ì°Ê³°¤Ë¤Ä¤¤¤Æ°Ê²¼¤ËºÜ¤»¤Þ¤¹¡£¤Ê¤ª¡¢°Ê²¼¤Ë·ÇºÜ¤·¤Æ¤¤¤ë¥½¡¼¥¹¥³¡¼¥É¤Ë¤Ï½¤Àµ BSD ¥é¥¤¥»¥ó¥¹¾ò¹à¤ò´Þ¤á¤Æ¤¤¤Þ¤»¤ó¤¬¡¢¥½¡¼¥¹¥³¡¼¥ÉÇÛÉۤϽ¤Àµ BSD ¥é¥¤¥»¥ó¥¹¤Ë½¾¤¤¤Þ¤¹¡Ê¤Ï¤¸¤á¤Ë ¤Î¥Ú¡¼¥¸¤ÎÌÈÀÕ»ö¹à¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡Ë¡£

¤³¤ì¤Þ¤Ç¤Ë¥Ò¥å¡¼¥º¥Ó¥Ã¥È¤ÎÀßÄê¤ò¹Ô¤Ã¤¿¤³¤È¤¬°ìÅÙ¤â̵¤¤¾ì¹ç¤Ï¡¢¤Þ¤ººÇ½é¤Ë make fuse ¤ò¼Â¹Ô¤·¤Æ¤¯¤À¤µ¤¤¡£fuse ¥¿¡¼¥²¥Ã¥È¤Ë¤Ä¤¤¤Æ¤Ï¡¢LECTURE 2 LED ¤òÅÀÌǤµ¤»¤ë ¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Î¹à¤ò»²¾È¤·¤Æ¤¯¤À¤µ¤¤¡£

make ¼Â¹Ô¸å¡¢¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¤ò»ÈÍѤ·¤¿¥×¥í¥°¥é¥à¤ò¥¢¥Ã¥×¥í¡¼¥É¤¹¤ë¾ì¹ç¤Ï make uisp-ov ¤ò¼Â¹Ô¤·¤Æ¤¯¤À¤µ¤¤¡£¤Þ¤¿¡¢Èæ³Ó°ìÃ׳ä¤ê¹þ¤ß¤ò»ÈÍѤ·¤¿¥×¥í¥°¥é¥à¤ò¥¢¥Ã¥×¥í¡¼¥É¤¹¤ë¾ì¹ç¤Ï make uisp-comp ¤ò¼Â¹Ô¤·¤Æ¤¯¤À¤µ¤¤¡£¼ÂÁõÊýË¡¤¬°Û¤Ê¤ë¤À¤±¤ÇÆ°ºîÆâÍƤÏƱ¤¸¤Ç¤¹¡£

LED ¤¬Ìó 500ms Ëè¤Ë¡Ê1 ÉÃ´Ö¤Ë 2 ²óÄø¡ËON/OFF ¤ò·«¤êÊÖ¤·¤Þ¤¹¡£

¤³¤Á¤é¤Ï LED ÅÀÌǤÎÆ°²è¤Ç¤¹¡Ê10Éá£YouTube ¤ËÀܳ¤·¤Þ¤¹¡Ë¡£

  • timer0.h
        1    #ifndef ___TIMER0_H_INCLUDED_
        2    #define ___TIMER0_H_INCLUDED_
        3    
        4    #include <avr/io.h>
        5    #include <inttypes.h>
        6    
        7    
        8    /* ¥¿¥¤¥Þ¡¼¥¯¥í¥Ã¥¯ÁªÂòÍÑ¥Þ¥¯¥í */
        9    #define TIMER0_STOP     0x00
       10    #define TIMER0_CK       (_BV(CS00))
       11    #define TIMER0_CK_8     (_BV(CS01))
       12    #define TIMER0_CK_64    (_BV(CS01) | _BV(CS00))
       13    #define TIMER0_CK_256   (_BV(CS02))
       14    #define TIMER0_CK_1024  (_BV(CS02) | _BV(CS00))
       15    
       16    /* Èæ³Ó½ÐÎϥ⡼¥ÉÁªÂòÍÑ¥Þ¥¯¥í */
       17    #define COM0_NONE       0x00
       18    #define COM0_TOGGLE     (_BV(COM00))
       19    #define COM0_HIGH_FIRST (_BV(COM01))
       20    #define COM0_LOW_FIRST  (_BV(COM01) | _BV(COM00))
       21    
       22    /* ÇÈ·ÁÀ¸À®¼ïÊÌÁªÂòÍÑ¥Þ¥¯¥í */
       23    #define WGM0_NORMAL     0x00
       24    #define WGM0_PWM        (_BV(WGM00))
       25    #define WGM0_CTC        (_BV(WGM01))
       26    #define WGM0_FAST_PWM   (_BV(WGM01) | _BV(WGM00))
       27    
       28    #define timer0_ov_enable()       { TIMSK |= _BV(TOIE0); }
       29    #define timer0_ov_disable()      { TIMSK &= ~_BV(TOIE0); }
       30    #define timer0_comp_enable()     { TIMSK |= _BV(OCIE0); }
       31    #define timer0_comp_disable()    { TIMSK &= ~_BV(OCIE0); }
       32    #define timer0_clear_com_mode()  { TCCR0 &= ~(_BV(COM01) | _BV(COM00)); }
       33    #define timer0_clear_wave_mode() { TCCR0 &= ~(_BV(WGM01) | _BV(WGM00)); }
       34
       35    #define timer0_stop()\
       36            { TCCR0 &= ~(_BV(CS02) | _BV(CS01) | _BV(CS00)); }
       37    
       38    #define timer0_set_com_mode(mode)  {\
       39            timer0_clear_com_mode();\
       40            TCCR0 |= (mode) & (_BV(COM01) | _BV(COM00));\
       41    }
       42    
       43    #define timer0_set_wave_mode(mode) {\
       44            timer0_clear_wave_mode();\
       45            TCCR0 |= (mode) & (_BV(WGM01) | _BV(WGM00));\
       46    }
       47    
       48    #define timer0_start(clock) {\
       49            timer0_stop();\
       50            TCCR0 |= (clock) & (_BV(CS02) | _BV(CS01) | _BV(CS00));\
       51    }
       52    
       53    /*
       54     * TCNT0 ¤ËÀßÄꤹ¤ë¥«¥¦¥ó¥¿Ãͤò»ØÄꤹ¤ë¡£
       55     */
       56    static inline void
       57    timer0_set_count(uint8_t count)
       58    {
       59            TCNT0 = count;
       60    }
       61    
       62    
       63    /*
       64     * OCR0 ¤ËÀßÄꤹ¤ë¥«¥¦¥ó¥¿Ãͤò»ØÄꤹ¤ë¡£
       65     */
       66    static inline void
       67    timer0_set_ocr0(uint8_t ocr0)
       68    {
       69            OCR0 = ocr0;
       70    }
       71    
       72    
       73    void timer0_ov_set_interrupt(void (*func)(void));
       74    void timer0_comp_set_interrupt(void (*func)(void));
       75    
       76    
       77    #endif
       78    
       79    /* End of timer0.h */
    
    
    • 8 ¡Á 14 ¹ÔÌÜ

      ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 ÍѤΥ¯¥í¥Ã¥¯»ØÄê¤ò³Ú¤Ë¤Ç¤­¤ëÍͤ˥ޥ¯¥í¤òÄêµÁ¤·¤Æ¤¤¤Þ¤¹¡£TCCR0 ¥ì¥¸¥¹¥¿¤Î CS02-00 ¥Ó¥Ã¥È¤ËÂбþ¤¹¤ë¥Ó¥Ã¥È¤ò _BV() ¥Þ¥¯¥í¤ÇÀßÄꤷ¤Æ¤¤¤Þ¤¹¡£ËÜ¥Þ¥¯¥í¤Ï ¸å½Ò¤Î timer0_start() ¥Þ¥¯¥í¼Â¹Ô»þ¤Ë»ØÄꤷ¤Þ¤¹¡£

    • 16 ¡Á 20 ¹ÔÌÜ

      Èæ³Ó½ÐÎϥ⡼¥É¤ò³Ú¤Ë»ØÄê¤Ç¤­¤ëÍͤ˥ޥ¯¥í¤òÄêµÁ¤·¤Æ¤¤¤Þ¤¹¡£TCCR0 ¥ì¥¸¥¹¥¿¤Î COM01-00 ¥Ó¥Ã¥È¤ËÂбþ¤¹¤ë¥Ó¥Ã¥È¤ò _BV() ¥Þ¥¯¥í¤ÇÀßÄꤷ¤Æ¤¤¤Þ¤¹¡£ËÜ¥Þ¥¯¥í¤Ï¸å½Ò¤Î timer0_set_com_mode() ¥Þ¥¯¥í¼Â¹Ô»þ¤Ë»ØÄꤷ¤Þ¤¹¡£

    • 22 ¡Á 26 ¹ÔÌÜ

      ÇÈ·ÁÀ¸À®¼ïÊ̤ò³Ú¤Ë»ØÄê¤Ç¤­¤ëÍͤ˥ޥ¯¥í¤òÄêµÁ¤·¤Æ¤¤¤Þ¤¹¡£TCCR0 ¥ì¥¸¥¹¥¿¤Î WGM01-00 ¥Ó¥Ã¥È¤ËÂбþ¤¹¤ë¥Ó¥Ã¥È¤ò _BV() ¥Þ¥¯¥í¤ÇÀßÄꤷ¤Æ¤¤¤Þ¤¹¡£ËÜ¥Þ¥¯¥í¤Ï¸å½Ò¤Î timer0_set_wave_mode() ¥Þ¥¯¥í¼Â¹Ô»þ¤Ë»ØÄꤷ¤Þ¤¹¡£

    • 28 ¡Á 51 ¹ÔÌÜ

      µ­½Ò¤¬³Ú¤Ë¤Ê¤ëÍͤˡ¢¤¢¤ë¤¤¤Ïʬ¤ê¤ä¤¹¤¯¤Ê¤ëÍͤˤ¤¤¯¤Ä¤«¤Î¥Þ¥¯¥í¤òÄêµÁ¤·¤Æ¤¤¤Þ¤¹¡£

      • timer0_ov_enable()/timer0_ov_disable() ¥Þ¥¯¥í¤Ï¡¢TIMSK ¥ì¥¸¥¹¥¿¤Î TOIE0 ¥Ó¥Ã¥È¤òÁàºî¤¹¤ë¤³¤È¤Ç¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¤ÎÍ­¸ú²½/̵¸ú²½¤ò¹Ô¤¤¤Þ¤¹¡£

      • timer0_comp_enable()/timer0_comp_disable() ¥Þ¥¯¥í¤Ï¡¢TIMSK ¥ì¥¸¥¹¥¿¤Î OCIE0 ¥Ó¥Ã¥È¤òÁàºî¤¹¤ë¤³¤È¤ÇÈæ³Ó°ìÃ׳ä¤ê¹þ¤ß¤ÎÍ­¸ú²½/̵¸ú²½¤ò¹Ô¤¤¤Þ¤¹¡£

      • timer0_clear_com_mode() ¥Þ¥¯¥í¤Ï¡¢TCCR0 ¥ì¥¸¥¹¥¿¤Î COM01-00 ¥Ó¥Ã¥È¤ò¥¯¥ê¥¢¤·¤Þ¤¹¡£

      • timer0_clear_wave_mode() ¥Þ¥¯¥í¤Ï¡¢TCCR0 ¥ì¥¸¥¹¥¿¤Î WGM01-00 ¥Ó¥Ã¥È¤ò¥¯¥ê¥¢¤·¤Þ¤¹¡£

      • timer0_stop() ¥Þ¥¯¥í¤Ï¡¢TCCR0 ¥ì¥¸¥¹¥¿¤Î CS02-00 ¥Ó¥Ã¥È¤ò¥¯¥ê¥¢¡Ê¥¯¥í¥Ã¥¯Ìµ¤·¡Ë ¤¹¤ë¤³¤È¤Ç¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 ¤òÄä»ß¤·¤Þ¤¹¡£

      • timer0_set_com_mode() ¥Þ¥¯¥í¤Ï¡¢timer0_clear_com_mode() ¤Ç TCCR0 ¥ì¥¸¥¹¥¿¤Î COM01-00 ¥Ó¥Ã¥È¤ò¥¯¥ê¥¢¤·¤¿¸å¤Ë¡¢»ØÄꤵ¤ì¤¿¥¯¥í¥Ã¥¯ÀßÄê¤ò COM01-00 ¥Ó¥Ã¥È¤ËÀßÄꤷ¤Þ¤¹¡£

      • timer0_set_wave_mode() ¥Þ¥¯¥í¤Ï¡¢timer0_clear_wave_mode() ¤Ç TCCR0 ¥ì¥¸¥¹¥¿¤Î WGM01-00 ¥Ó¥Ã¥È¤ò¥¯¥ê¥¢¤·¤¿¸å¤Ë¡¢»ØÄꤵ¤ì¤¿ÇÈ·ÁÀ¸À®¼ïÊ̤ò WGM01-00 ¥Ó¥Ã¥È¤ËÀßÄꤷ¤Þ¤¹¡£

      • timer0_start() ¥Þ¥¯¥í¤Ï¡¢timer0_stop() ¤Ç¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 ¤òÄä»ß¤·¤¿¸å¤Ë¡¢ »ØÄꤵ¤ì¤¿¥¯¥í¥Ã¥¯ÀßÄê¤ò TCCR0 ¥ì¥¸¥¹¥¿¤Î CS02-00 ¥Ó¥Ã¥È¤ËÀßÄꤹ¤ë¤³¤È¤Ç¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 ¤ò³«»Ï¤·¤Þ¤¹¡£

    • 53 ¡Á 70 ¹ÔÌÜ

      ¤³¤Á¤é¤Ï·¿¥Á¥§¥Ã¥¯¤òÍ­¸ú¤Ë¤·¤¿¤«¤Ã¤¿¤Î¤Ç¡¢¥Þ¥¯¥í¤Ç¤Ï¤Ê¤¯ inline ´Ø¿ô¤È¤·¤Þ¤·¤¿¡£

      timer0_set_count() ´Ø¿ô¤Ï¡¢»ØÄꤵ¤ì¤¿ 8 ¥Ó¥Ã¥ÈÃͤò TCNT0 ¤Ë½ñ¤­¹þ¤ß¤Þ¤¹¡£ TCNT0 ¤Î½é´üÃͤòÀßÄꤷ¤¿¤ê¡¢³ä¤ê¹þ¤ßÅù¤Î¥¿¥¤¥ß¥ó¥°¤Ç¥«¥¦¥ó¥¿ÃͤòÊѤ¨¤¿¤¤¾ì¹ç¤Ë»È¤¤¤Þ¤¹¡£ ¤Þ¤¿¡¢timer0_set_ocr0() ´Ø¿ô¤Ï¡¢»ØÄꤵ¤ì¤¿ 8 ¥Ó¥Ã¥ÈÃͤò OCR0 ¤Ë½ñ¤­¹þ¤ß¤Þ¤¹¡£ ¤³¤ÎÃͤÏÈæ³Ó°ìÃפ˻ÈÍѤµ¤ì¤Þ¤¹¡£

  • timer0.c
        1    #include <avr/interrupt.h>
        2    #include "timer0.h"
        3    
        4    
        5    static void (*timer0_ov_interrupt_handler)(void);
        6    static void (*timer0_comp_interrupt_handler)(void);
        7    
        8    
        9    /*
       10     * ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¥Ï¥ó¥É¥é
       11     */
       12    ISR(TIMER0_OVF_vect)
       13    {
       14            timer0_ov_interrupt_handler();
       15    }
       16    
       17    
       18    /*
       19     * ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼»þ¤Ë³ä¤ê¹þ¤ß¥Ï¥ó¥É¥éÆâ¤Ç¼Â¹Ô¤¹¤ë¥æ¡¼¥¶´Ø¿ô¤òÀßÄꤹ¤ë¡£
       20     */
       21    void 
       22    timer0_ov_set_interrupt(void (*func)(void))
       23    {
       24            timer0_ov_interrupt_handler = func;
       25    }
       26    
       27    
       28    /*
       29     * Èæ³Ó°ìÃ׳ä¤ê¹þ¤ß¥Ï¥ó¥É¥é
       30     */
       31    ISR(TIMER0_COMP_vect)
       32    {
       33            timer0_comp_interrupt_handler();
       34    }
       35    
       36    
       37    /*
       38     * Èæ³Ó°ìÃ×»þ¤Ë³ä¤ê¹þ¤ß¥Ï¥ó¥É¥éÆâ¤Ç¼Â¹Ô¤¹¤ë¥æ¡¼¥¶´Ø¿ô¤òÀßÄꤹ¤ë¡£
       39     */
       40    void
       41    timer0_comp_set_interrupt(void (*func)(void))
       42    {
       43            timer0_comp_interrupt_handler = func;
       44    }
       45    
       46    /* End of timer0.c */
    
    
    • 9 ¡Á 15 ¹ÔÌÜ

      ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¤òÍ­¸ú¤Ë¤·¤¿¾ì¹ç¤Ë»ÈÍѤ¹¤ë¡¢³ä¤ê¹þ¤ß¥Ï¥ó¥É¥é¤òµ­½Ò¤·¤Æ¤¤¤Þ¤¹¡£ ATmega8535 ¤Î¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¤òɽ¤¹¥Þ¥¯¥í¤Ï TIMER0_OVF_vect ¤Ç¤¹¡£ ¼ÂºÝ¤Ë¤Ï¡¢¸å½Ò¤¹¤ë timer0_ov_set_interrupt() ¤ÇÅÐÏ¿¤µ¤ì¤¿¥æ¡¼¥¶´Ø¿ô¤ò¼Â¹Ô¤¹¤ëÍͤ˼ÂÁõ¤·¤Æ¤¤¤Þ¤¹¡£

    • 18 ¡Á 25 ¹ÔÌÜ (timer0_ov_set_interrupt())

      Á°½Ò¤Î¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¥Ï¥ó¥É¥éÆâ¤Ç¼ÂºÝ¤Ë¼Â¹Ô¤¹¤ë¡¢¥æ¡¼¥¶´Ø¿ô¤òÅÐÏ¿¤·¤Þ¤¹¡£

    • 28 ¡Á 34 ¹ÔÌÜ

      Èæ³Ó°ìÃ׳ä¤ê¹þ¤ß¤òÍ­¸ú¤Ë¤·¤¿¾ì¹ç¤Ë»ÈÍѤ¹¤ë¡¢³ä¤ê¹þ¤ß¥Ï¥ó¥É¥é¤òµ­½Ò¤·¤Æ¤¤¤Þ¤¹¡£ ATmega8535 ¤Î¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 Èæ³Ó°ìÃ׳ä¤ê¹þ¤ß¤òɽ¤¹¥Þ¥¯¥í¤Ï TIMER0_COMP_vect ¤Ç¤¹¡£ ¼ÂºÝ¤Ë¤Ï¡¢¸å½Ò¤¹¤ë timer0_comp_set_interrupt() ¤ÇÅÐÏ¿¤µ¤ì¤¿¥æ¡¼¥¶´Ø¿ô¤ò¼Â¹Ô¤¹¤ëÍͤ˼ÂÁõ¤·¤Æ¤¤¤Þ¤¹¡£

    • 37 ¡Á 44 ¹ÔÌÜ (timer0_comp_set_interrupt())

      Á°½Ò¤ÎÈæ³Ó°ìÃ׳ä¤ê¹þ¤ß¥Ï¥ó¥É¥éÆâ¤Ç¼ÂºÝ¤Ë¼Â¹Ô¤¹¤ë¡¢¥æ¡¼¥¶´Ø¿ô¤òÅÐÏ¿¤·¤Þ¤¹¡£

  • main-ov.c¡Ê¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß»ÈÍÑ»þ¤Î main¡Ë
        1    #include <avr/interrupt.h>
        2    #include <avr/io.h>
        3    #include <avr/sleep.h>
        4    
        5    #include "timer0.h"
        6    #include "util.h"
        7    
        8    
        9    static void timer0_ov_interrupt(void);
       10    
       11    
       12    int
       13    main(void)
       14    {
       15            /* PB0 ¥Ô¥ó¤Î¤ß½ÐÎÏÀßÄê */
       16            DDRB |= _BV(DDB0);
       17            pullup();
       18    
       19            timer0_ov_enable();
       20            timer0_ov_set_interrupt(timer0_ov_interrupt);
       21            timer0_set_count(0);
       22    
       23            sei();
       24    
       25            /* (8MHz/256)/256 = Ìó122Hz */
       26            timer0_start(TIMER0_CK_256);
       27        
       28            while (1){
       29                    sleep_mode();
       30            }
       31    
       32            return 0; /* ·Ù¹ð¤òÈò¤±¤ë¤¿¤á */
       33    }
       34    
       35    
       36    static void 
       37    timer0_ov_interrupt(void)
       38    {
       39            static int count = 0;
       40    
       41            /*
       42             * LED ¤Î¾õÂÖÊѹ¹¼þÇÈ¿ô¤òÌó 2Hz (500ms) ¤È¤¹¤ë¡£
       43             * ³ä¤ê¹þ¤ß¼þ´ü¤¬Ìó 122Hz ¤Ê¤Î¤Ç 61²óËè¤Ë¾õÂÖ¤òÊѤ¨¤ë¡£
       44             *
       45             * ON-----OFF-----ON-----...
       46             *   500ms   500ms  
       47             */
       48            if (++ count != 61) {
       49                    return;
       50            }
       51    
       52            count = 0;
       53            PORTB ^= _BV(PB0);
       54    }
       55    
       56    /* End of main-ov.c */
    
    

    ËÜ¥Õ¥¡¥¤¥ë¤Ï¡¢¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¤ò»È¤¦¾ì¹ç¤Î main() ¤òµ­½Ò¤·¤Æ¤¤¤Þ¤¹¡£

    • 12 ¡Á 33 ¹ÔÌÜ (main())

      • pullup() Á°¤Ë PORTB0 ¤Î¤ß½ÐÎÏÊý¸þ¤ËÀßÄê
      • pullup() (pullup.h¡¢PORTB0 °Ê³°¤ÎÁ´ÆþÎϥݡ¼¥È¤ÎÆâÉô¥×¥ë¥¢¥Ã¥×¤òÍ­¸ú²½)
      • timer0_ov_enable() (timer0.h¡¢¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ßÍ­¸ú²½)
      • timer0_ov_set_interrupt() (timer0.h¡¢¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß»þ¤Ë¼Â¹Ô¤¹¤ë¥æ¡¼¥¶´Ø¿ô¤ÎÅÐÏ¿)
      • timer0_set_count() (timer0.h¡¢TCNT0 ¤Î½é´üÃͤòÀßÄê)

      ¤ò¹Ô¤Ã¤¿¸å¡¢sei() (avr/interrupt.h) ¤ò¼Â¹Ô¤·¤Æ¥·¥¹¥Æ¥à¤Î³ä¤ê¹þ¤ß¤òÍ­¸ú²½¤·¤Æ¤¤¤Þ¤¹¡£

      ¤½¤Î¸å¤Ë timer0_start() ¤ò¼Â¹Ô¤·¤Æ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 ¤ÎÆ°ºî¤ò³«»Ï¤·¤Þ¤¹¡£ timer0_start() ¤Ë TIMER0_CK_256 ¤ò»ØÄꤷ¤Æ¤¤¤ë¤¿¤á¡¢¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¤Î¼þ´ü¤ÏÌó 122Hz ((8MHz/256)/256)¤È¤Ê¤ê¤Þ¤¹¡£

      ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¥¿¥¤¥ß¥ó¥°

      °Ê¸å sleep_mode() ¤Ë¤Æ¥¢¥¤¥É¥ëÆ°ºî¤Ø°Ü¹Ô¤·¡¢LED ¤ÎÅÀÌǽèÍý¤Ï¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¥Ï¥ó¥É¥é¤ËǤ¤»¤Þ¤¹¡£

    • 36 ¡Á 54 ¹ÔÌÜ (timer0_ov_interrupt())

      ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß»þ¤Ë¼Â¹Ô¤µ¤ì¤ë¥æ¡¼¥¶´Ø¿ô¤Ç¤¹¡£

      static ÊÑ¿ô¤Ç¤¢¤ë count ¤Ç³ä¤ê¹þ¤ß²ó¿ô¤ò¿ô¤¨¡¢61 ²ó¤Ë°ìÅÙ PORTB0 ¤ÎÃͤòȿž¤·¤Þ¤¹¡£ ³ä¤ê¹þ¤ß¼þ´ü¤¬Ìó 122Hz ¤Ç¤¢¤ë¤¿¤á¡¢È¿Å¾¼þ´ü¤ÏÌó 122/61 = 2 Hz ¤È¤Ê¤ê¤Þ¤¹¡£

  • main-comp.c¡ÊÈæ³Ó°ìÃ׳ä¤ê¹þ¤ß»ÈÍÑ»þ¤Î main¡Ë
        1    #include <avr/interrupt.h>
        2    #include <avr/io.h>
        3    #include <avr/sleep.h>
        4    
        5    #include "timer0.h"
        6    #include "util.h"
        7    
        8    
        9    static void timer0_comp_interrupt(void);
       10    
       11    
       12    int
       13    main(void)
       14    {
       15            /* PB0 ¥Ô¥ó¤Î¤ß½ÐÎÏÀßÄê */
       16            DDRB |= _BV(DDB0);
       17            pullup();
       18    
       19            timer0_comp_enable();
       20            timer0_comp_set_interrupt(timer0_comp_interrupt);
       21            timer0_set_wave_mode(WGM0_CTC);
       22            timer0_set_count(0);
       23            timer0_set_ocr0(127);
       24    
       25            sei();
       26    
       27            /* (8MHz/256)/128 = Ìó244Hz */
       28            timer0_start(TIMER0_CK_256);
       29        
       30            while (1){
       31                    sleep_mode();
       32            }
       33    
       34            return 0; /* ·Ù¹ð¤òÈò¤±¤ë¤¿¤á */
       35    }
       36    
       37    
       38    static void 
       39    timer0_comp_interrupt(void)
       40    {    
       41            static int count = 0;
       42    
       43            /*
       44             * LED ¤Î¾õÂÖÊѹ¹¼þÇÈ¿ô¤òÌó 2Hz (500ms) ¤È¤¹¤ë¡£
       45             * ³ä¤ê¹þ¤ß¼þ´ü¤¬Ìó 244Hz ¤Ê¤Î¤Ç 122²óËè¤Ë¾õÂÖ¤òÊѤ¨¤ë¡£
       46             *
       47             * ON-----OFF-----ON-----...
       48             *   500ms   500ms  
       49             */
       50            if (++ count != 122) {
       51                    return;
       52            }
       53    
       54            count = 0;
       55            PORTB ^= _BV(PB0);
       56    }
       57    
       58    /* End of main-comp.c */
    
    

    ËÜ¥Õ¥¡¥¤¥ë¤Ï¡¢Èæ³Ó°ìÃ׳ä¤ê¹þ¤ß¤ò»È¤¦¾ì¹ç¤Î main() ¤òµ­½Ò¤·¤Æ¤¤¤Þ¤¹¡£

    • 12 ¡Á 35 ¹ÔÌÜ (main())

      • pullup() Á°¤Ë PORTB0 ¤Î¤ß½ÐÎÏÊý¸þ¤ËÀßÄê
      • pullup() (pullup.h¡¢PORTB0 °Ê³°¤ÎÁ´ÆþÎϥݡ¼¥È¤ÎÆâÉô¥×¥ë¥¢¥Ã¥×¤òÍ­¸ú²½)
      • timer0_comp_enable() (timer0.h¡¢Èæ³Ó°ìÃ׳ä¤ê¹þ¤ßÍ­¸ú²½)
      • timer0_comp_set_interrupt() (timer0.h¡¢Èæ³Ó°ìÃ׳ä¤ê¹þ¤ß»þ¤Ë¼Â¹Ô¤¹¤ë¥æ¡¼¥¶´Ø¿ô¤ÎÅÐÏ¿)
      • timer0_set_wave_mode() (timer0.h¡¢ÇÈ·ÁÀ¸À®¼ïÊ̤òÀßÄê)
      • timer0_set_count() (timer0.h¡¢TCNT0 ¤Î½é´üÃͤòÀßÄê)
      • timer0_set_ocr0() (timer0.h¡¢OCR0 ¤ÎÃͤòÀßÄê)

      ¤ò¹Ô¤Ã¤¿¸å¡¢sei() (avr/interrupt.h) ¤ò¼Â¹Ô¤·¤Æ¥·¥¹¥Æ¥à¤Î³ä¤ê¹þ¤ß¤òÍ­¸ú²½¤·¤Æ¤¤¤Þ¤¹¡£

      ¤³¤Î½é´ü²½¥Õ¥§¡¼¥º¤Ç¡¢timer0_set_wave_mode(WGM0_CTC) ¤Ë¤è¤Ã¤ÆÇÈ·ÁÀ¸À®¼ïÊ̤ò "Èæ³Ó°ìÃ×¥¿¥¤¥Þ/¥«¥¦¥ó¥¿¥¯¥ê¥¢(CTC)"¤ËÀßÄꤷ¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤Ë¤è¤ê TCNT0 ¤È OCR0 ¤¬°ìÃפ·¤¿»þÅÀ¤Ç TCNT0 ¤ò¥¯¥ê¥¢¤·¡¢0 ¤«¤é¥«¥¦¥ó¥È¤òºÆ³«¤¹¤ëÆ°ºî¤òÁªÂò¤·¤Æ¤¤¤Þ¤¹¡£

      ¤½¤Î¸å¤Ë timer0_start() ¤ò¼Â¹Ô¤·¤Æ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 ¤ÎÆ°ºî¤ò³«»Ï¤·¤Þ¤¹¡£ timer0_start() ¤Ë TIMER0_CK_256 ¤ò»ØÄꤷ¤Æ¤ª¤ê¡¢¤«¤Ä OCR0 ¤ÎÃͤˤè¤ê¥«¥¦¥ó¥¿ºÇÂçÃÍ¤Ï 127 ¤È¤Ê¤ë¤¿¤á¡¢Èæ³Ó°ìÃ׳ä¤ê¹þ¤ß¤Î¼þ´ü¤ÏÌó 244Hz ((8MHz/256)/128)¤È¤Ê¤ê¤Þ¤¹¡£

      Èæ³Ó°ìÃ׳ä¤ê¹þ¤ß¥¿¥¤¥ß¥ó¥°

      °Ê¸å sleep_mode() ¤Ë¤Æ¥¢¥¤¥É¥ëÆ°ºî¤Ø°Ü¹Ô¤·¡¢LED ¤ÎÅÀÌǽèÍý¤ÏÈæ³Ó°ìÃ׳ä¤ê¹þ¤ß¥Ï¥ó¥É¥é¤ËǤ¤»¤Þ¤¹¡£

    • 38 ¡Á 56 ¹ÔÌÜ (timer0_comp_interrupt())

      Èæ³Ó°ìÃ׳ä¤ê¹þ¤ß»þ¤Ë¼Â¹Ô¤µ¤ì¤ë¥æ¡¼¥¶´Ø¿ô¤Ç¤¹¡£

      static ÊÑ¿ô¤Ç¤¢¤ë count ¤Ç³ä¤ê¹þ¤ß²ó¿ô¤ò¿ô¤¨¡¢122 ²ó¤Ë°ìÅÙ PORTB0 ¤ÎÃͤòȿž¤·¤Þ¤¹¡£ ³ä¤ê¹þ¤ß¼þ´ü¤¬Ìó 244Hz ¤Ç¤¢¤ë¤¿¤á¡¢È¿Å¾¼þ´ü¤ÏÌó 244/122 = 2 Hz ¤È¤Ê¤ê¤Þ¤¹¡£

°Ê¾å¤Ç²òÀâ¤Ï½ª¤ï¤ê¤Ç¤¹¡£¼¡²ó¤Ï¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1¤ò»È¤Ã¤ÆƱ¤¸¤³¤È¤ò¤ä¤Ã¤Æ¤ß¤¿¤¤¤È»×¤¤¤Þ¤¹¡£