LECTURE 8 ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1¤ò»È¤¦

¡û ¤Ï¤¸¤á¤Ë

Á°²ó ¤Ï¡¢¥¿¥¤¥Þ/¥«¥¦¥ó¥¿0 ¤ò»È¤Ã¤Æ LED ¤òÅÀÌǤµ¤»¤Æ¤ß¤Þ¤·¤¿¡£º£²ó¤Ï¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1 ¤ò»È¤Ã¤ÆƱ¤¸¤³¤È¤ò¤·¤Æ¤ß¤è¤¦¤È»×¤¤¤Þ¤¹¡£

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

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

  • ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1À©¸æ¥ì¥¸¥¹¥¿A(TCCR1A)

    ¥Ó¥Ã¥ÈÈÖ¹æ 7 6 5 4 3 2 1 0
    ¥Þ¥¯¥í COM1A1 COM1A0 COM1B1 COM1B0 FOC1A FOC1B WGM11 WGM10
    ½é´üÃÍ 0 0 0 0 0 0 0 0

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

    ¥Ó¥Ã¥È̾ ÆâÍÆ
    COM1A1/COM1A0
    COM1B1/COM1B0¡ÊÈæ³Ó1½ÐÎϥ⡼¥É¡Ë
    OC1A/OC1B ¥Ô¥ó¡ÊPDIP ¥Ñ¥Ã¥±¡¼¥¸¤Ç¤Ï 19/18 ¥Ô¥ó¡Ë¤Î½ÐÎÏÊý¼°¤òÀßÄꤷ¤Þ¤¹¡£

    • WGM11 = WGM10 = 0 ¤Î¾ì¹ç¡Êɸ½àÆ°ºî¡¢CTCÆ°ºî¡Ë(?=A/B)
      COM1?1 COM1?0 ÆâÍÆ
      0 0 OC1? ¤Ë¤Ï½ÐÎϤµ¤ì¤Ê¤¤
      0 1 Èæ³Ó°ìÃפˤª¤¤¤Æȿž
      1 0 Èæ³Ó°ìÃפˤª¤¤¤Æ 0(Low)
      1 1 Èæ³Ó°ìÃפˤª¤¤¤Æ 1(High)

    • WGM13-10=0101/0110/0111/1110/1111 ¤Î¾ì¹ç¡Ê¹â®PWM¡Ë(?=A/B)
      COM1?1 COM1?0 ÆâÍÆ
      0 0 OC1? ¤Ë¤Ï½ÐÎϤµ¤ì¤Ê¤¤
      0 1 WGM13-10=1111 ¤Î¾ì¹ç¤ÏÈæ³Ó°ìÃ×¤Ç OC1A ȿž¡¢OC1B ¤Ï½ÐÎϤµ¤ì¤Ê¤¤¡£ WGM13-10=¤½¤ì°Ê³°¤Î¾ì¹ç¤Ï OC1? ¤Ë¤Ï½ÐÎϤµ¤ì¤Ê¤¤
      1 0 Èæ³Ó°ìÃ×¤Ç 0(Low)¡¢TCNT1 = 0 ¤Ç 1(High)
      1 1 Èæ³Ó°ìÃ×¤Ç 1(High)¡¢TCNT1 = 0 ¤Ç 0(Low)

    • WGM13-10=0001/0010/0011/1000/1001/1010/1011 ¤Î¾ì¹ç¡Ê°ÌÁê´ð½àPWM¡Ë(?=A/B)
      COM1?1 COM1?0 ÆâÍÆ
      0 0 OC1? ¤Ë¤Ï½ÐÎϤµ¤ì¤Ê¤¤
      0 1 WGM13-0=10x1 ¤Î¾ì¹ç¤ÏÈæ³Ó°ìÃ×¤Ç OC1A ȿž¡¢OC1B ¤Ï½ÐÎϤµ¤ì¤Ê¤¤¡£ ¤½¤ì°Ê³°¤Ï OC1? ¤Ë¤Ï½ÐÎϤµ¤ì¤Ê¤¤
      1 0 TCNT1 ¾å¾º»þ¤ÎÈæ³Ó°ìÃ×¤Ç 0(Low)¡¢²¼¹ß»þ¤ÎÈæ³Ó°ìÃ×¤Ç 1(High)
      1 1 TCNT1 ¾å¾º»þ¤ÎÈæ³Ó°ìÃ×¤Ç 1(High)¡¢²¼¹ß»þ¤ÎÈæ³Ó°ìÃ×¤Ç 0(Low)

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

    WGM13 WGM12 WGM11 WGM10 Æ°ºî¼ïÊÌ
    0 0 0 0 ɸ½àÆ°ºî
    0 0 0 1 8¥Ó¥Ã¥È°ÌÁê´ð½àPWMÆ°ºî
    0 0 1 0 9¥Ó¥Ã¥È°ÌÁê´ð½àPWMÆ°ºî
    0 0 1 1 10¥Ó¥Ã¥È°ÌÁê´ð½àPWMÆ°ºî
    0 1 0 0 Èæ³Ó°ìÃ×¥¿¥¤¥Þ/¥«¥¦¥ó¥¿¥¯¥ê¥¢(CTC)Æ°ºî¡ÊOCR1A¥Ô¥ó¤¬¥«¥¦¥ó¥¿ºÇÂçÃÍ¡Ë
    0 1 0 1 8¥Ó¥Ã¥È¹â®PWMÆ°ºî
    0 1 1 0 9¥Ó¥Ã¥È¹â®PWMÆ°ºî
    0 1 1 1 10¥Ó¥Ã¥È¹â®PWMÆ°ºî
    1 0 0 0 °ÌÁê/¼þÇÈ¿ô´ð½àPWMÆ°ºî¡ÊICR1¥Ô¥ó¤¬¥«¥¦¥ó¥¿ºÇÂçÃÍ¡Ë
    1 0 0 1 °ÌÁê/¼þÇÈ¿ô´ð½àPWMÆ°ºî¡ÊOCR1A¥Ô¥ó¤¬¥«¥¦¥ó¥¿ºÇÂçÃÍ¡Ë
    1 0 1 0 °ÌÁê´ð½àPWMÆ°ºî¡ÊICR1¥Ô¥ó¤¬¥«¥¦¥ó¥¿ºÇÂçÃÍ¡Ë
    1 0 1 1 °ÌÁê´ð½àPWMÆ°ºî¡ÊOCR1A¥Ô¥ó¤¬¥«¥¦¥ó¥¿ºÇÂçÃÍ¡Ë
    1 1 0 0 Èæ³Ó°ìÃ×¥¿¥¤¥Þ/¥«¥¦¥ó¥¿¥¯¥ê¥¢(CTC)Æ°ºî¡ÊICR1¥Ô¥ó¤¬¥«¥¦¥ó¥¿ºÇÂçÃÍ¡Ë
    1 1 0 1 ͽÌó
    1 1 1 0 ¹â®PWMÆ°ºî¡ÊICR1¥Ô¥ó¤¬¥«¥¦¥ó¥¿ºÇÂçÃÍ¡Ë
    1 1 1 1 ¹â®PWMÆ°ºî¡ÊOCR1A¥Ô¥ó¤¬¥«¥¦¥ó¥¿ºÇÂçÃÍ¡Ë


  • ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1À©¸æ¥ì¥¸¥¹¥¿B(TCCR1B)

    ¥Ó¥Ã¥ÈÈÖ¹æ 7 6 5 4 3 2 1 0
    ¥Þ¥¯¥í ICNC1 ICES1 - WGM13 WGM12 CS12 CS11 CS10
    ½é´üÃÍ 0 0 0 0 0 0 0 0

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

    ¥Ó¥Ã¥È̾ ÆâÍÆ
    ICNC1¡ÊÊá³ÍÆþÎÏ1¥Î¥¤¥º¾Ãµî´ï¡Ë 1 ¤ËÀßÄꤹ¤ë¤³¤È¤Ç¡¢Êá³ÍÆþÎϥΥ¤¥º¾Ãµî´ï¤¬Í­¸ú¤Ë¤Ê¤ê¤Þ¤¹¡£
    ICES1¡ÊÊá³ÍÆþÎÏ1¥¨¥Ã¥¸ÁªÂò¡Ë 1¤òÀßÄꤹ¤ë¤È ICP1 ¥Ô¥ó¤ÎΩ¤Á¾å¤¬¤ê¥¨¥Ã¥¸¤ÇÊá³Í¤òǧ¼±¤·¡¢0 ¤òÀßÄꤹ¤ë¤ÈΩ²¼¤ê¥¨¥Ã¥¸¤ÇÊá³Í¤òǧ¼±¤·¤Þ¤¹¡£
    WGM13/WGM12¡ÊÇÈ·ÁÀ¸À®¥â¡¼¥É¡Ë TCCR1A ¥ì¥¸¥¹¥¿¤Î WGM11-10¥Ó¥Ã¥ÈÀâÌÀ¤ò»²¾È
    CS12/CS11/CS10¡Ê¥¯¥í¥Ã¥¯ÁªÂò¡Ë ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1¤Ç»ÈÍѤ¹¤ë¥¯¥í¥Ã¥¯¤Î¥·¥¹¥Æ¥à¥¯¥í¥Ã¥¯¤ËÂФ¹¤ëʬ¼þÈæ¡¢¤¢¤ë¤¤¤Ï³°Éô¥¯¥í¥Ã¥¯¤Î»ÈÍѤò°Ê²¼¤ÎÁȤ߹ç¤ï¤»¤ÇÀßÄꤷ¤Þ¤¹¡£

    CS12 CS11 CS10 ÆâÍÆ
    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 ³°Éô¥¯¥í¥Ã¥¯¡£T1 ¥Ô¥ó¡ÊPDIP ¥Ñ¥Ã¥±¡¼¥¸¤Ç¤Ï 2 ¥Ô¥ó¡Ë¤ÎΩ¤Á²¼¤¬¤ê¥¨¥Ã¥¸
    1 1 1 ³°Éô¥¯¥í¥Ã¥¯¡£T1 ¥Ô¥ó¡ÊPDIP ¥Ñ¥Ã¥±¡¼¥¸¤Ç¤Ï 2 ¥Ô¥ó¡Ë¤ÎΩ¤Á¾å¤¬¤ê¥¨¥Ã¥¸


  • ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1¥«¥¦¥ó¥¿(TCNT1H,TCNT1L)(TCNT1 ¤È¤·¤Æ 2 ¥Ð¥¤¥È¥¢¥¯¥»¥¹²Äǽ)

    16 ¥Ó¥Ã¥È¤Î¥«¥¦¥ó¥¿Ãͤò³ÊǼ¤¹¤ë¥ì¥¸¥¹¥¿¤Ç¤¹¡£
    TCNT1 ¤È¤·¤Æ 2 ¥Ð¥¤¥È¥¢¥¯¥»¥¹¤¹¤ë¾ì¹ç¤Ï¡¢ ¥¢¥¯¥»¥¹»þ¤Ë³ä¤ê¹þ¤ß¤¬µ¯¤­¤Ê¤¤Íͤˤ·¤Æ¤¯¤À¤µ¤¤¡£

    --- TCNT1H ---

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

    --- TCNT1L ---

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


  • ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1Èæ³ÓA¥ì¥¸¥¹¥¿(OCR1AH,OCR1AL)(OCR1A ¤È¤·¤Æ 2 ¥Ð¥¤¥È¥¢¥¯¥»¥¹²Äǽ)

    TCNT1 ¤È¤ÎÈæ³Ó¤Ë»È¤ï¤ì¤ë 16 ¥Ó¥Ã¥È¥ì¥¸¥¹¥¿¤Ç¤¹¡£
    OCR1A ¤È¤·¤Æ 2 ¥Ð¥¤¥È¥¢¥¯¥»¥¹¤¹¤ë¾ì¹ç¤Ï¡¢ ¥¢¥¯¥»¥¹»þ¤Ë³ä¤ê¹þ¤ß¤¬µ¯¤­¤Ê¤¤Íͤˤ·¤Æ¤¯¤À¤µ¤¤¡£

    --- OCR1AH ---

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

    --- OCR1AL ---

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


  • ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1Èæ³ÓB¥ì¥¸¥¹¥¿(OCR1BH,OCR1BL)(OCR1B ¤È¤·¤Æ 2 ¥Ð¥¤¥È¥¢¥¯¥»¥¹²Äǽ)

    TCNT1 ¤È¤ÎÈæ³Ó¤Ë»È¤ï¤ì¤ë 16 ¥Ó¥Ã¥È¥ì¥¸¥¹¥¿¤Ç¤¹¡£
    OCR1B ¤È¤·¤Æ 2 ¥Ð¥¤¥È¥¢¥¯¥»¥¹¤¹¤ë¾ì¹ç¤Ï¡¢ ¥¢¥¯¥»¥¹»þ¤Ë³ä¤ê¹þ¤ß¤¬µ¯¤­¤Ê¤¤Íͤˤ·¤Æ¤¯¤À¤µ¤¤¡£

    --- OCR1BH ---

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

    --- OCR1BL ---

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


  • ¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1Êá³Í¥ì¥¸¥¹¥¿(ICR1H,ICR1L)(ICR1 ¤È¤·¤Æ 2 ¥Ð¥¤¥È¥¢¥¯¥»¥¹²Äǽ)

    ICP1 ¥Ô¥ó¤ÇÊá³Í¤òǧ¼±¤·¤¿»þÅÀ¤Î TCNT1 ¤ÎÃͤò³ÊǼ¤¹¤ë 16 ¥Ó¥Ã¥È¥ì¥¸¥¹¥¿¤Ç¤¹¡£
    ICR1 ¤È¤·¤Æ 2 ¥Ð¥¤¥È¥¢¥¯¥»¥¹¤¹¤ë¾ì¹ç¤Ï¡¢ ¥¢¥¯¥»¥¹»þ¤Ë³ä¤ê¹þ¤ß¤¬µ¯¤­¤Ê¤¤Íͤˤ·¤Æ¤¯¤À¤µ¤¤¡£

    --- ICR1H ---

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

    --- ICR1L ---

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


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

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

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

    ¥Ó¥Ã¥È̾ ÆâÍÆ
    TICIE1¡ÊÊá³Í³ä¤ê¹þ¤ßµö²Ä¡Ë 1 ¤òÀßÄꤹ¤ë¤È¡¢Êá³Í³ä¤ê¹þ¤ß¤¬Í­¸ú¤Ë¤Ê¤ê¤Þ¤¹¡£
    OCIE1A¡ÊÈæ³ÓA°ìÃ׳ä¤ê¹þ¤ßµö²Ä¡Ë 1 ¤òÀßÄꤹ¤ë¤È¡¢Èæ³ÓA°ìÃ׳ä¤ê¹þ¤ß¤¬Í­¸ú¤Ë¤Ê¤ê¤Þ¤¹¡£
    OCIE1B¡ÊÈæ³ÓB°ìÃ׳ä¤ê¹þ¤ßµö²Ä¡Ë 1 ¤òÀßÄꤹ¤ë¤È¡¢Èæ³ÓB°ìÃ׳ä¤ê¹þ¤ß¤¬Í­¸ú¤Ë¤Ê¤ê¤Þ¤¹¡£
    TOIE1¡Ê¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ßµö²Ä¡Ë 1 ¤òÀßÄꤹ¤ë¤È¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¤¬Í­¸ú¤Ë¤Ê¤ê¤Þ¤¹¡£


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

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

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

    ¥Ó¥Ã¥È̾ ÆâÍÆ
    ICF1¡ÊÊá³Í¥Õ¥é¥°¡Ë ICP1 ¥Ô¥ó¤ÇÊá³Í¤òǧ¼±¤·¤¿¾ì¹ç¤Ë 1 ¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£³ä¤ê¹þ¤ß½èÍý»þ¤Ë¼«Æ°Åª¤Ë 0 ¤È¤Ê¤ë¾¡¢1 ¤ò½ñ¤­¹þ¤à¤³¤È¤Ç 0 ¤È¤Ê¤ê¤Þ¤¹¡£
    OCF1A¡ÊÈæ³ÓA°ìÃץե饰¡Ë TCNT1 ¤È OCR1A ¤ÎÃͤ¬°ìÃפ·¤¿¾ì¹ç¤Ë 1 ¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£³ä¤ê¹þ¤ß½èÍý»þ¤Ë¼«Æ°Åª¤Ë 0 ¤È¤Ê¤ë¾¡¢1 ¤ò½ñ¤­¹þ¤à¤³¤È¤Ç 0 ¤È¤Ê¤ê¤Þ¤¹¡£
    OCF1B¡ÊÈæ³ÓB°ìÃץե饰¡Ë TCNT1 ¤È OCR1B ¤ÎÃͤ¬°ìÃפ·¤¿¾ì¹ç¤Ë 1 ¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£³ä¤ê¹þ¤ß½èÍý»þ¤Ë¼«Æ°Åª¤Ë 0 ¤È¤Ê¤ë¾¡¢1 ¤ò½ñ¤­¹þ¤à¤³¤È¤Ç 0 ¤È¤Ê¤ê¤Þ¤¹¡£
    TOV1¡Ê¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Õ¥é¥°¡Ë TCNT1 ¤Ç¤Î¥ª¡¼¥Ð¡¼¥Õ¥í¡¼È¯À¸»þ¤Ë 1 ¤¬ÀßÄꤵ¤ì¤Þ¤¹¡£³ä¤ê¹þ¤ß½èÍý»þ¤Ë¼«Æ°Åª¤Ë 0 ¤È¤Ê¤ë¾¡¢1 ¤ò½ñ¤­¹þ¤à¤³¤È¤Ç 0 ¤È¤Ê¤ê¤Þ¤¹¡£

¡û ²óÏ©¿Þ

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

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

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

Ãæ¤Ë¤Ï

  • Makefile
  • util.h
  • util.c
  • timer1.h
  • timer1.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 ¤ò·«¤êÊÖ¤·¤Þ¤¹¡£Á°²ó ¤ÈÆ°ºîÆâÍƤ¬Æ±¤¸¤Ê¤Î¤Ç¡¢Æ°²è¤ÏºÜ¤»¤Þ¤»¤ó¡£

  • timer1.h
        1    #ifndef ___TIMER1_H_INCLUDED_
        2    #define ___TIMER1_H_INCLUDED_
        3    
        4    #include <avr/io.h>
        5    #include <inttypes.h>
        6    
        7    
        8    /* ¥¿¥¤¥Þ¡¼¥¯¥í¥Ã¥¯ÁªÂòÍÑ¥Þ¥¯¥í */
        9    #define TIMER1_STOP      0x00
       10    #define TIMER1_CK        (_BV(CS10))
       11    #define TIMER1_CK_8      (_BV(CS11))
       12    #define TIMER1_CK_64     (_BV(CS11) | _BV(CS10))
       13    #define TIMER1_CK_256    (_BV(CS12))
       14    #define TIMER1_CK_1024   (_BV(CS12) | _BV(CS10))
       15    
       16    /* Èæ³Ó½ÐÎϥ⡼¥ÉÁªÂòÍÑ¥Þ¥¯¥í */
       17    #define COM_A_NONE       0x00
       18    #define COM_A_TOGGLE     (_BV(COM1A0))
       19    #define COM_A_HIGH_FIRST (_BV(COM1A1))
       20    #define COM_A_LOW_FIRST  (_BV(COM1A1) | _BV(COM1A0))
       21    
       22    #define COM_B_NONE       0x00
       23    #define COM_B_TOGGLE     (_BV(COM1B0))
       24    #define COM_B_HIGH_FIRST (_BV(COM1B1))
       25    #define COM_B_LOW_FIRST  (_BV(COM1B1) | _BV(COM1B0))
       26    
       27    /* ÇÈ·ÁÀ¸À®¼ïÊÌÁªÂòÍÑ¥Þ¥¯¥í */
       28    #define WGM1_NORMAL         0x00
       29    #define WGM1_CTC_ICR1       (_BV(WGM13) | _BV(WGM12))
       30    #define WGM1_CTC_OCR1A      (_BV(WGM12))
       31    #define WGM1_FAST_PWM_ICR1  (_BV(WGM13) | _BV(WGM12) | _BV(WGM11))
       32    #define WGM1_FAST_PWM_OCR1A (_BV(WGM13) | _BV(WGM12) | _BV(WGM11) | _BV(WGM10))
       33    
       34    #define timer1_ov_enable()         { TIMSK |= _BV(TOIE1); }
       35    #define timer1_ov_disable()        { TIMSK &= ~_BV(TOIE1); }
       36    #define timer1_compa_enable()      { TIMSK |= _BV(OCIE1A); }
       37    #define timer1_compa_disable()     { TIMSK &= ~_BV(OCIE1A); }
       38    #define timer1_compb_enable()      { TIMSK |= _BV(OCIE1B); }
       39    #define timer1_compb_disable()     { TIMSK &= ~_BV(OCIE1B); }
       40    #define timer1_ic_enable()         { TIMSK |= _BV(TICIE1); }
       41    #define timer1_ic_disable()        { TIMSK &= ~_BV(TICIE1); }
       42    #define timer1_clear_coma_mode()   { TCCR1A &= ~(_BV(COM1A1) | _BV(COM1A0)); }
       43    #define timer1_clear_comb_mode()   { TCCR1A &= ~(_BV(COM1B1) | _BV(COM1B0)); }
       44
       45    #define timer1_stop()\
       46           { TCCR1B &= ~(_BV(CS12) | _BV(CS11) | _BV(CS10)); }
       47    
       48    #define timer1_set_coma_mode(mode) {\
       49            timer1_clear_coma_mode();\
       50            TCCR1A |= (mode) & (_BV(COM1A1) | _BV(COM1A0));\
       51    }
       52    
       53    #define timer1_set_comb_mode(mode) {\
       54            timer1_clear_comb_mode();\
       55            TCCR1A |= (mode) & (_BV(COM1B1) | _BV(COM1B0));\
       56    }
       57    
       58    #define timer1_clear_wave_mode()   {\
       59            TCCR1A &= ~(_BV(WGM11) | _BV(WGM10));\
       60            TCCR1B &= ~(_BV(WGM13) | _BV(WGM12));\
       61    }
       62    
       63    #define timer1_set_wave_mode(mode) {\
       64            timer1_clear_wave_mode();\
       65            TCCR1A |= (mode) & (_BV(WGM11) | _BV(WGM10));\
       66            TCCR1B |= (mode) & (_BV(WGM13) | _BV(WGM12));\
       67    }
       68    
       69    #define timer1_start(clock) {\
       70            timer1_stop();\
       71            TCCR1B |= (clock) & (_BV(CS12) | _BV(CS11) | _BV(CS10));\
       72    }
       73    
       74    /*
       75     * TCNT1 ¤ËÀßÄꤹ¤ë¥«¥¦¥ó¥¿Ãͤò»ØÄꤹ¤ë¡£
       76     *
       77     * 16¥Ó¥Ã¥È¥ì¥¸¥¹¥¿¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤¿¤á¡¢16¥Ó¥Ã¥È¥ì¥¸¥¹¥¿ÍѤÎ
       78     * °ì»þ¥ì¥¸¥¹¥¿¤Ø¤Î¾¥¢¥¯¥»¥¹¤¬µ¯¤­¤Ê¤¤¾õÂ֤Ǽ¹Ԥ¹¤ë¤³¤È¡£
       79     */
       80    static inline void 
       81    timer1_set_count(uint16_t count)
       82    {
       83            TCNT1 = count;
       84    }
       85    
       86    
       87    /*
       88     * OCR1A ¤ËÀßÄꤹ¤ë¥«¥¦¥ó¥¿Ãͤò»ØÄꤹ¤ë¡£
       89     *
       90     * 16¥Ó¥Ã¥È¥ì¥¸¥¹¥¿¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤¿¤á¡¢16¥Ó¥Ã¥È¥ì¥¸¥¹¥¿ÍѤÎ
       91     * °ì»þ¥ì¥¸¥¹¥¿¤Ø¤Î¾¥¢¥¯¥»¥¹¤¬µ¯¤­¤Ê¤¤¾õÂ֤Ǽ¹Ԥ¹¤ë¤³¤È¡£
       92     */
       93    static inline void
       94    timer1_set_ocr1a(uint16_t ocr1a)
       95    {
       96            OCR1A = ocr1a;
       97    }
       98    
       99    
      100    /*
      101     * OCR1A ¤ËÀßÄꤹ¤ë¥«¥¦¥ó¥¿Ãͤò»ØÄꤹ¤ë¡£
      102     *
      103     * 16¥Ó¥Ã¥È¥ì¥¸¥¹¥¿¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤¿¤á¡¢16¥Ó¥Ã¥È¥ì¥¸¥¹¥¿ÍѤÎ
      104     * °ì»þ¥ì¥¸¥¹¥¿¤Ø¤Î¾¥¢¥¯¥»¥¹¤¬µ¯¤­¤Ê¤¤¾õÂ֤Ǽ¹Ԥ¹¤ë¤³¤È¡£
      105     */
      106    static inline void
      107    timer1_set_ocr1b(uint16_t ocr1b)
      108    {
      109            OCR1B = ocr1b;
      110    }
      111    
      112    
      113    /*
      114     * ICR1 ¤ËÀßÄꤹ¤ë¥«¥¦¥ó¥¿Ãͤò»ØÄꤹ¤ë¡£
      115     *
      116     * 16¥Ó¥Ã¥È¥ì¥¸¥¹¥¿¤Ë¥¢¥¯¥»¥¹¤¹¤ë¤¿¤á¡¢16¥Ó¥Ã¥È¥ì¥¸¥¹¥¿ÍѤÎ
      117     * °ì»þ¥ì¥¸¥¹¥¿¤Ø¤Î¾¥¢¥¯¥»¥¹¤¬µ¯¤­¤Ê¤¤¾õÂ֤Ǽ¹Ԥ¹¤ë¤³¤È¡£
      118     */
      119    static inline void
      120    timer1_set_icr1(uint16_t icr1)
      121    {
      122            ICR1 = icr1;
      123    }
      124    
      125    
      126    void timer1_ov_set_interrupt(void (*func)(void));
      127    void timer1_compa_set_interrupt(void (*func)(void));
      128    void timer1_compb_set_interrupt(void (*func)(void));
      129    void timer1_ic_set_interrupt(void (*func)(void));
      130    
      131    
      132    #endif
      133    
      134    /* End of timer1.h */
    
    
    • 8 ¡Á 14 ¹ÔÌÜ

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

    • 16 ¡Á 25 ¹ÔÌÜ

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

    • 27 ¡Á 32 ¹ÔÌÜ

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

    • 34 ¡Á 72 ¹ÔÌÜ

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

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

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

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

      • timer1_ic_enable()/timer1_ic_disable() ¥Þ¥¯¥í¤Ï¡¢TIMSK ¥ì¥¸¥¹¥¿¤Î TICIE1 ¥Ó¥Ã¥È¤òÁàºî¤¹¤ë¤³¤È¤ÇÊá³Í³ä¤ê¹þ¤ß¤ÎÍ­¸ú²½/̵¸ú²½¤ò¹Ô¤¤¤Þ¤¹¡£

      • timer1_clear_coma_mode() ¥Þ¥¯¥í¤Ï¡¢TCCR1A ¥ì¥¸¥¹¥¿¤Î COM1A1/COM1A0 ¥Ó¥Ã¥È¤ò¥¯¥ê¥¢¤·¤Þ¤¹¡£

      • timer1_clear_comb_mode() ¥Þ¥¯¥í¤Ï¡¢TCCR1A ¥ì¥¸¥¹¥¿¤Î COM1B1/COM1B0 ¥Ó¥Ã¥È¤ò¥¯¥ê¥¢¤·¤Þ¤¹¡£

      • timer1_stop() ¥Þ¥¯¥í¤Ï¡¢TCCR1B ¥ì¥¸¥¹¥¿¤Î CS12-10 ¥Ó¥Ã¥È¤ò¥¯¥ê¥¢¡Ê¥¯¥í¥Ã¥¯Ìµ¤·¡Ë ¤¹¤ë¤³¤È¤Ç¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1 ¤òÄä»ß¤·¤Þ¤¹¡£

      • timer1_set_coma_mode() ¥Þ¥¯¥í¤Ï¡¢timer1_clear_coma_mode() ¤Ç TCCR1A ¥ì¥¸¥¹¥¿¤Î COM1A1/COM1A0 ¥Ó¥Ã¥È¤ò¥¯¥ê¥¢¤·¤¿¸å¤Ë¡¢»ØÄꤵ¤ì¤¿¥¯¥í¥Ã¥¯ÀßÄê¤ò COM1A1/COM1A0 ¥Ó¥Ã¥È¤ËÀßÄꤷ¤Þ¤¹¡£

      • timer1_set_comb_mode() ¥Þ¥¯¥í¤Ï¡¢timer1_clear_comb_mode() ¤Ç TCCR1A ¥ì¥¸¥¹¥¿¤Î COM1B1/COM1B0 ¥Ó¥Ã¥È¤ò¥¯¥ê¥¢¤·¤¿¸å¤Ë¡¢»ØÄꤵ¤ì¤¿¥¯¥í¥Ã¥¯ÀßÄê¤ò COM1B1/COM1B0 ¥Ó¥Ã¥È¤ËÀßÄꤷ¤Þ¤¹¡£

      • timer1_clear_wave_mode() ¥Þ¥¯¥í¤Ï¡¢TCCR1A ¥ì¥¸¥¹¥¿¤Î WGM11-10 ¥Ó¥Ã¥È¤ª¤è¤Ó TCCR1B ¥ì¥¸¥¹¥¿¤Î WGM13-12 ¥Ó¥Ã¥È¤ò¥¯¥ê¥¢¤·¤Þ¤¹¡£

      • timer1_set_wave_mode() ¥Þ¥¯¥í¤Ï¡¢timer1_clear_wave_mode() ¤Ç TCCR1A ¥ì¥¸¥¹¥¿¤Î WGM11-10 ¥Ó¥Ã¥È¤ª¤è¤Ó TCCR1B ¥ì¥¸¥¹¥¿¤Î WGM13-12 ¥Ó¥Ã¥È¤ò¥¯¥ê¥¢¤·¤¿¸å¤Ë¡¢»ØÄꤵ¤ì¤¿ÇÈ·ÁÀ¸À®¼ïÊ̤ò WGM13-10 ¥Ó¥Ã¥È¤ËÀßÄꤷ¤Þ¤¹¡£

      • timer1_start() ¥Þ¥¯¥í¤Ï¡¢timer1_stop() ¤Ç¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1 ¤òÄä»ß¤·¤¿¸å¤Ë¡¢ »ØÄꤵ¤ì¤¿¥¯¥í¥Ã¥¯ÀßÄê¤ò TCCR1B ¥ì¥¸¥¹¥¿¤Î CS12-10 ¥Ó¥Ã¥È¤ËÀßÄꤹ¤ë¤³¤È¤Ç¥¿¥¤¥Þ/¥«¥¦¥ó¥¿1 ¤ò³«»Ï¤·¤Þ¤¹¡£

    • 74 ¡Á 123 ¹ÔÌÜ

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

      timer1_set_count() ´Ø¿ô¤Ï¡¢»ØÄꤵ¤ì¤¿ 16 ¥Ó¥Ã¥ÈÃͤò TCNT1 ¤Ë½ñ¤­¹þ¤ß¤Þ¤¹¡£ TCNT1 ¤Î½é´üÃͤòÀßÄꤷ¤¿¤ê¡¢³ä¤ê¹þ¤ßÅù¤Î¥¿¥¤¥ß¥ó¥°¤Ç¥«¥¦¥ó¥¿ÃͤòÊѤ¨¤¿¤¤¾ì¹ç¤Ë»È¤¤¤Þ¤¹¡£

      timer1_set_ocr1a()/timer1_set_ocr1b()/timer1_set_icr1() ¤Ï¡¢»ØÄꤵ¤ì¤¿ 16 ¥Ó¥Ã¥ÈÃͤò¤½¤ì¤¾¤ì OCR1A/OCR1B/ICR1 ¤Ë½ñ¤­¹þ¤ß¤Þ¤¹¡£¤³¤ì¤é¤ÎÃͤϤ½¤ì¤¾¤ìÈæ³ÓA°ìÃ×/Èæ³ÓB°ìÃ×/Êá³Í¤Ë»ÈÍѤµ¤ì¤Þ¤¹¡£

  • timer1.c
        1    #include <avr/interrupt.h>
        2    #include <avr/io.h>
        3    #include <inttypes.h>
        4    
        5    #include "timer1.h"
        6    
        7    
        8    static void (*timer1_ov_interrupt_handler)(void);
        9    static void (*timer1_compa_interrupt_handler)(void);
       10    static void (*timer1_compb_interrupt_handler)(void);
       11    static void (*timer1_ic_interrupt_handler)(void);
       12    
       13    
       14    /*
       15     * ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß¥Ï¥ó¥É¥é
       16     */
       17    ISR(TIMER1_OVF_vect)
       18    {
       19            timer1_ov_interrupt_handler();
       20    }
       21    
       22    
       23    /*
       24     * ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼»þ¤Ë³ä¤ê¹þ¤ß¥Ï¥ó¥É¥éÆâ¤Ç¼Â¹Ô¤¹¤ë
       25     * ¥æ¡¼¥¶´Ø¿ô¤òÀßÄꤹ¤ë¡£
       26     */
       27    void 
       28    timer1_ov_set_interrupt(void (*func)(void))
       29    {
       30            timer1_ov_interrupt_handler = func;
       31    }
       32    
       33    
       34    /*
       35     * Èæ³ÓA°ìÃ׳ä¤ê¹þ¤ß¥Ï¥ó¥É¥é
       36     */
       37    ISR(TIMER1_COMPA_vect)
       38    {
       39            timer1_compa_interrupt_handler();
       40    }
       41    
       42    
       43    /*
       44     * Èæ³ÓA°ìÃ×»þ¤Ë³ä¤ê¹þ¤ß¥Ï¥ó¥É¥éÆâ¤Ç¼Â¹Ô¤¹¤ë¥æ¡¼¥¶´Ø¿ô¤òÀßÄꤹ¤ë¡£
       45     */
       46    void
       47    timer1_compa_set_interrupt(void (*func)(void))
       48    {
       49            timer1_compa_interrupt_handler = func;
       50    }
       51    
       52    
       53    /*
       54     * Èæ³ÓB°ìÃ׳ä¤ê¹þ¤ß¥Ï¥ó¥É¥é
       55     */
       56    ISR(TIMER1_COMPB_vect)
       57    {
       58            timer1_compb_interrupt_handler();
       59    }
       60    
       61    
       62    /*
       63     * Èæ³ÓB°ìÃ×»þ¤Ë³ä¤ê¹þ¤ß¥Ï¥ó¥É¥éÆâ¤Ç¼Â¹Ô¤¹¤ë¥æ¡¼¥¶´Ø¿ô¤òÀßÄꤹ¤ë¡£
       64     */
       65    void
       66    timer1_compb_set_interrupt(void (*func)(void))
       67    {
       68            timer1_compb_interrupt_handler = func;
       69    }
       70    
       71    
       72    ISR(TIMER1_CAPT_vect)
       73    {
       74            timer1_ic_interrupt_handler();
       75    }
       76    
       77    
       78    /*
       79     * Êá³Í³ä¤ê¹þ¤ß¥Ï¥ó¥É¥éÆâ¤Ç¼Â¹Ô¤¹¤ë¥æ¡¼¥¶´Ø¿ô¤òÀßÄꤹ¤ë¡£
       80     */
       81    void
       82    timer1_ic_set_interrupt(void (*func)(void))
       83    {
       84            timer1_ic_interrupt_handler = func;
       85    }
       86    
       87    /* End of timer1.c */
    
    
    • 14 ¡Á 20 ¹ÔÌÜ

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

    • 23 ¡Á 31 ¹ÔÌÜ (timer1_ov_set_interrupt())

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

    • 34 ¡Á 40 ¹ÔÌÜ

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

    • 43 ¡Á 50 ¹ÔÌÜ (timer1_compa_set_interrupt())

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

    • 53 ¡Á 59 ¹ÔÌÜ

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

    • 62 ¡Á 69 ¹ÔÌÜ (timer1_compb_set_interrupt())

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

    • 72 ¡Á 75 ¹ÔÌÜ

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

    • 78 ¡Á 85 ¹ÔÌÜ (timer1_ic_set_interrupt())

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

  • main-ov.c¡Ê¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß»ÈÍÑ»þ¤Î main¡Ë
        1    #include <avr/interrupt.h>
        2    #include <avr/io.h>
        3    #include <avr/sleep.h>
        4    
        5    #include "timer1.h"
        6    #include "util.h"
        7    
        8    
        9    static void timer1_ov_interrupt(void);
       10    
       11    
       12    int
       13    main(void)
       14    {
       15            /* PB0 ¥Ô¥ó¤Î¤ß½ÐÎÏÀßÄê */
       16            DDRB |= _BV(DDB0);
       17            pullup();
       18    
       19            timer1_ov_enable();
       20            timer1_ov_set_interrupt(timer1_ov_interrupt);
       21            timer1_set_count(0);
       22    
       23            sei();
       24    
       25            /* (8MHz/1)/65536 = Ìó122Hz */
       26            timer1_start(TIMER1_CK);
       27        
       28            while (1){
       29                    sleep_mode();
       30            }
       31    
       32            return 0; /* ·Ù¹ð¤òÈò¤±¤ë¤¿¤á */
       33    }
       34    
       35    
       36    static void 
       37    timer1_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 °Ê³°¤ÎÁ´ÆþÎϥݡ¼¥È¤ÎÆâÉô¥×¥ë¥¢¥Ã¥×¤òÍ­¸ú²½)
      • timer1_ov_enable() (timer1.h¡¢¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ßÍ­¸ú²½)
      • timer1_ov_set_interrupt() (timer1.h¡¢¥ª¡¼¥Ð¡¼¥Õ¥í¡¼³ä¤ê¹þ¤ß»þ¤Ë¼Â¹Ô¤¹¤ë¥æ¡¼¥¶´Ø¿ô¤ÎÅÐÏ¿)
      • timer1_set_count() (timer1.h¡¢TCNT1 ¤Î½é´üÃͤòÀßÄê)

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

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

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

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

    • 36 ¡Á 54 ¹ÔÌÜ (timer1_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 "timer1.h"
        6    #include "util.h"
        7    
        8    
        9    static void timer1_comp_interrupt(void);
       10    
       11    
       12    int
       13    main(void)
       14    {
       15            /* PB0 ¥Ô¥ó¤Î¤ß½ÐÎÏÀßÄê */
       16            DDRB |= _BV(DDB0);
       17            pullup();
       18    
       19            timer1_compa_enable();
       20            timer1_compa_set_interrupt(timer1_comp_interrupt);
       21            timer1_set_wave_mode(WGM1_CTC_OCR1A);
       22            timer1_set_count(0);
       23            timer1_set_ocr1a(127);
       24    
       25            sei();
       26    
       27            /* (8MHz/256)/128 = Ìó244Hz */
       28            timer1_start(TIMER1_CK_256);
       29        
       30            while (1){
       31                    sleep_mode();
       32            }
       33    
       34            return 0; /* ·Ù¹ð¤òÈò¤±¤ë¤¿¤á */
       35    }
       36    
       37    
       38    static void 
       39    timer1_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 °Ê³°¤ÎÁ´ÆþÎϥݡ¼¥È¤ÎÆâÉô¥×¥ë¥¢¥Ã¥×¤òÍ­¸ú²½)
      • timer1_compa_enable() (timer1.h¡¢Èæ³ÓA°ìÃ׳ä¤ê¹þ¤ßÍ­¸ú²½)
      • timer1_compa_set_interrupt() (timer1.h¡¢Èæ³ÓA°ìÃ׳ä¤ê¹þ¤ß»þ¤Ë¼Â¹Ô¤¹¤ë¥æ¡¼¥¶´Ø¿ô¤ÎÅÐÏ¿)
      • timer1_set_wave_mode() (timer1.h¡¢ÇÈ·ÁÀ¸À®¼ïÊ̤òÀßÄê)
      • timer1_set_count() (timer1.h¡¢TCNT1 ¤Î½é´üÃͤòÀßÄê)
      • timer1_set_ocr1a() (timer1.h¡¢OCR1A ¤ÎÃͤòÀßÄê)

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

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

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

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

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

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

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

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

°Ê¾å¤Ç²òÀâ¤Ï½ª¤ï¤ê¤Ç¤¹¡£¼¡²ó¤«¤é¤Ï¡¢¥¿¥¤¥Þ/¥«¥¦¥ó¥¿¤Îµ¡Ç½¤ò»È¤Ã¤Æ¥µ¡¼¥Ü¥â¡¼¥¿¤òÆ°¤«¤·¤Æ¤ß¤Þ¤¹¡£