LECTURE 5 A/D ÊÑ´¹¤Ç²Ã®ÅÙ¥»¥ó¥µÃͤòÆɤà

¡û ¤Ï¤¸¤á¤Ë

Á°²ó ¤Ï¡¢ATmega8535 ¤Î A/D ÊÑ´¹µ¡Ç½¤Î»È¤¤Êý¤òÀâÌÀ¤·¤Þ¤·¤¿¡£¤»¤Ã¤«¤¯¤Ê¤Î¤Çº£²ó¤Ï¤½¤Î A/D ÊÑ´¹µ¡Ç½¤òÍøÍѤ·¤Æ¡¢3 ¼´²Ã®ÅÙ¥»¥ó¥µ¤Î½ÐÎϤòÆɤó¤Ç¤ß¤Þ¤¹¡£

¡û ²Ã®ÅÙ¥»¥ó¥µ¤Ë¤Ä¤¤¤Æ

²Ã®ÅÙ¥»¥ó¥µ¤È¤Ï¡¢¤½¤Î̾Á°¤ÎÄ̤ê²Ã®ÅÙ¤ò¸¡½Ð¤¹¤ë¤¿¤á¤Î¥»¥ó¥µ¤Ç¤¹¡£1 ¼´¡Á 3 ¼´Âбþ¤Î¥»¥ó¥µ¤¬Í­¤ê¡¢¤½¤ì¤¾¤ì¤Î¼´¤ËÂФ·¤ÆƯ¤¯²Ã®Å٤˱þ¤¸¤¿ÅÅ°µ¤ò½ÐÎϤ·¤Æ¤¯¤ì¤Þ¤¹¡£¥»¥ó¥µ¤ò·¹¤±¤ë¤È³Æ¼´¤ËƯ¤¯½ÅÎϲîÅÙ¤ÎÂ礭¤µ¤âÊѲ½¤¹¤ë¤¿¤á¡¢»ÑÀªÊѲ½¤Î¸¡½Ð¤Ë¤â»È¤¨¤Þ¤¹¡£

Ëܼ¸³²óÏ©¤Ç¤Ï¡¢KXM52-1050 ¤È¤¤¤¦¥Á¥Ã¥×·¿ 3 ¼´²Ã®ÅÙ¥»¥ó¥µ¤ò»È¤¤¤ä¤¹¤¤Íͤ˴ðÈÄ·Á¼°¤Ë¤Þ¤È¤á¤Æ¤¯¤ì¤Æ¤¤¤ë¡¢½©·îÅÅ»Ò ¤Î KXM52-1050 ¥â¥¸¥å¡¼¥ë¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£800±ß¤¯¤é¤¤¤À¤Ã¤¿Íͤʵ¤¤¬¡Ä

¢­ÀÖÏÈÆ⤬ KXM52-1050 ¥â¥¸¥å¡¼¥ë¤Ç¤¹¡£

KXM52-1050 ¥â¥¸¥å¡¼¥ë

X ¼´¤È Y ¼´¤Ë¤Ä¤¤¤Æ¤Ï¾å¿Þ¤Ëµ­ºÜ¤·¤¿Ìð°õ¤ÎÊý¸þ¤Ë¤Ê¤ëÍͤ˼è¤êÉÕ¤±¤Þ¤·¤¿¡£Z ¼´¤Ë¤Ä¤¤¤Æ¤Ï¡¢´ðÈĤÎ΢¡Ê¿Þ¤Ç¸«¤¨¤Ê¤¤Êý¡Ë¤«¤éɽ¡Ê¿Þ¤Ë¸«¤¨¤ëÊý¡Ë¤Ë´Ó¤¯Êý¸þ¤È¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£

¥Ç¡¼¥¿¥·¡¼¥È¤Ë¤è¤ë¤È Z ¼´¤Ï + ¤¬´ðÈĤÎ΢¤«¤éɽ¤ÎÊý¸þ¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤Ï¤º¤Ê¤Î¤Ç¡¢Ä̾ï¤Î 1G ¤¬¤«¤«¤Ã¤Æ¤¤¤ë¾õ¶·¤Ç¤Ï -1G ¤È¤Ê¤ë¤Ï¤º¤Ê¤Î¤Ç¤¹¤¬¡ÄÉ®¼Ô¤Î²óÏ©¤Ç¤Ï¤É¤¦¤ä¤Ã¤Æ¤âÄ̾ï¾õÂÖ¤Ç 1G¡¢µÕ¤µ¤Þ¤Î»þ¤Ë -1G ¤¬½Ð¤Æ¤·¤Þ¤¤¤Þ¤·¤¿¡£KXM52-1050 ¤Îü»Ò¤ò¥Æ¥¹¥¿¡¼¤ÇľÀܷ׬¤·¤Æ¤â¤½¤ÎÍͤÊÅÅ°µ¤¬½Ð¤Æ¤¤¤¿¤¿¤á¡¢Àܳ¥ß¥¹¤È¤«¹Í¤¨°ã¤¤¤Ç¤Ï¤Ê¤¤¤È»×¤¦¤Î¤Ç¤¹¤¬¡Ä¤È¤¤¤¦¤ï¤±¤Ç¤¹¤Î¤Ç¡¢Êý¸þ¤ÎÀµ¸í¤Ï¤ß¤Ê¤µ¤ó³Æ¼«¤Ç¤´³Îǧ¤¯¤À¤µ¤¤ m(__)m

XY ¼´¤Ë¤Ä¤¤¤Æ¿åÊ¿¤«¤é²¼¿Þ¤ÎÍÍ¤Ë θ ¤À¤±·¹¤±¤¿¤È¤·¤Þ¤¹¡£θ = 0¡ë¤Î»þ¤¬¿åÊ¿°ÌÃ֤Ȥ·¤Þ¤¹¡£

XY¼´¤Î·¹¤­

¤³¤Î¾ì¹ç¡¢²¼¸þ¤­¤Î½ÅÎϲîÅÙ¤ò g ¤È¤¹¤ë¤È XY ¼´¤Ë¤«¤«¤ë½ÅÎϲîÅÙ g ' ¤Ï g ' = g sinθ ¤È¤Ê¤ê¤Þ¤¹¡£θ ¤òÁý¸º¤·¤¿¾ì¹ç¤Î XY ¼´¤Î½ÅÎϲîÅÙ g ' ¤ÎÊѲ½¤Ï²¼¤Î¥°¥é¥Õ¤ÎÍͤˤʤê¤Þ¤¹¡£²£¼´¤¬ θ¡Êñ°Ì¤ÏÅ١ˤòɽ¤·¡¢½Ä¼´¤¬ g '/g ¤òɽ¤·¤Æ¤¤¤Þ¤¹¡£

XY¼´¤Î½ÅÎϲîÅÙ¤ÎÊѲ½

º£ÅÙ¤Ï Z ¼´¤Ë¤Ä¤¤¤Æ¿âľ¤«¤é²¼¿Þ¤ÎÍÍ¤Ë θ ¤À¤±·¹¤±¤¿¤È¤·¤Þ¤¹¡£θ = 0¡ë¤Î»þ¤ò¡¢´ðÈĤÎɽ¦¤ò¾å¤Ë¸þ¤±¤¿°ÌÃ֤Ȥ·¤Þ¤¹¡ÊÀè¤Û¤É¤Î¼Ì¿¿¤Î¾õÂÖ¡£KXM52-1050 ¥â¥¸¥å¡¼¥ë¤Ç¤Ï¤³¤Î¾ì¹ç¡¢Z ¼´¤ÎÊý¸þ¤¬²¼¿Þ¤ÈµÕ¤Ë¤Ê¤ë¤Ï¤º¤Ç¤¹¤¬¡¢ÀâÌÀ¾å¤³¤ÎÍͤ˵­½Ò¤·¤Æ¤¤¤Þ¤¹¡Ë¡£

Z¼´¤Î·¹¤­

¤³¤Î¾ì¹ç¡¢²¼¸þ¤­¤Î½ÅÎϲîÅÙ¤ò g ¤È¤¹¤ë¤È Z ¼´¤Ë¤«¤«¤ë½ÅÎϲîÅÙ g ' ¤Ï g ' = g cosθ ¤È¤Ê¤ê¤Þ¤¹¡£θ ¤òÁý¸º¤·¤¿¾ì¹ç¤Î Z ¼´¤Î½ÅÎϲîÅÙ g ' ¤ÎÊѲ½¤Ï²¼¤Î¥°¥é¥Õ¤ÎÍͤˤʤê¤Þ¤¹¡£²£¼´¤¬ θ¡Êñ°Ì¤ÏÅ١ˤòɽ¤·¡¢½Ä¼´¤¬ g '/g ¤òɽ¤·¤Æ¤¤¤Þ¤¹¡£

Z¼´¤Î½ÅÎϲîÅÙ¤ÎÊѲ½

KXM52-1050 ¥â¥¸¥å¡¼¥ë¤Ç¤Ï Z ¼´¤Ï´ðÈĤÎ΢¤«¤éɽ¤ÎÊý¸þ¡Ê¾å¿Þ¤À¤È²¼¤«¤é¾å¡Ë¤¬Àµ¤Î¤¿¤á¡¢¼ÂºÝ¤Ë¤Ï¾å¿Þ¤Î θ = 0¡ë¤Î»þ¤Ë g ' = -g¡¢θ = 180¡ë¤Î»þ¤Ë g ' = g ¤È¤Ê¤ë¤Ï¤º¤Ê¤Î¤Ç¤¹¤¬¡¢Á°½Ò¤ÎÄ̤êÉ®¼Ô¤Î²óÏ©¤Ç¤ÏµÕ¤Ë¤Ê¤Ã¤Æ¤·¤Þ¤¤¤Þ¤·¤¿¡ÄÊý¸þ¤ÎÀµ¸í¤Ë¤Ä¤¤¤Æ¤Ï¡¢¤ß¤Ê¤µ¤ó³Æ¼«¤Ç¤´³Îǧ¤¯¤À¤µ¤¤ m(__)m

¡û ²óÏ©¿Þ

LECTURE 1 ATmega8535 ¤ª¤è¤Ó»ÈÍѴĶ­¤Ë¤Ä¤¤¤Æ ¤Ë·ÇºÜ¤·¤Æ¤¢¤ëÁ´ÂβóÏ©¿Þ¤ËÂФ·¤Æ¡¢ATMega8535 ¤Î PA1 - PA3 ¤ª¤è¤Ó KXM52-1050 ¥â¥¸¥å¡¼¥ëÉôʬ¤òÀÖÏȤǰϤó¤À¿Þ¤ò ¤³¤Á¤é ¤ËÃÖ¤¤¤Æ¤ª¤­¤Þ¤¹¡£

PORTA ¤Î PA1 - PA3 ¥Ô¥ó¤Ë KXM52-1050 ¥â¥¸¥å¡¼¥ë¤Î Z/Y/X ½ÐÎϤò¤½¤ì¤¾¤ìÀܳ¤·¤Æ¤¤¤Þ¤¹¡£¤³¤ì¤Ë¤è¤ê¡¢PINA1/PINA2/PINA3 ¤ÎÃͤò A/D ÊÑ´¹´ï¤ÇÆɤ߹þ¤á¤Ð¡¢Z/Y/X ¼´¤ËºîÍѤ·¤Æ¤¤¤ë½ÅÎϲîÅÙÀ®Ê¬¤òÆÀ¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

KXM52-1050 ²Ã®ÅÙ¥»¥ó¥µ¤Ï

0g¡Ê½ÅÎϲîÅÙ0¡Ë¤Î¾ì¹ç¤Î½ÐÎÏÅÅ°µ = Vcc/2
1g ¤ÎÊѲ½¤ËÂбþ¤¹¤ëÅÅ°µ´¶ÅÙ = Vcc/5

¤È¤¤¤¦ÆÃÀ­¤ò»ý¤Ã¤Æ¤¤¤Þ¤¹¡£¤è¤Ã¤Æ³Æ¼´¤Î½ÐÎÏÅÅ°µ¤Ï Vcc = 5V ¤È¤¹¤ë¤È

ºÇ¾®ÃÍ     = Vcc/2 - Vcc/5 = 1.5V
¥ª¥Õ¥»¥Ã¥È = Vcc/2         = 2.5V
ºÇÂçÃÍ     = Vcc/2 + Vcc/5 = 3.5V

¤È¤Ê¤ê¤Þ¤¹¡£ATmega8535 ¤Î A/D ÊÑ´¹·ë²Ì¤ÎºÇÂçÃͤ¬ 0x3ff ¤Ç¤¢¤ë¤³¤È¤«¤é¡¢¤½¤ì¤¾¤ì¤Î¾ì¹ç¤Î A/D ÊÑ´¹·ë²Ì¤Îͽ¬ÃͤÏ

ºÇ¾®ÃÍ     = 0x3ff x 1.5V / 5V = Ìó 306.9(0x132)
¥ª¥Õ¥»¥Ã¥È = 0x3ff x 2.5V / 5V = Ìó 511.5(0x1ff)
ºÇÂçÃÍ     = 0x3ff x 3.5V / 5V = Ìó 716.1(0x2cc)

¤È·×»»¤Ç¤­¤Þ¤¹¡£¼ÂºÝ¤Ë¤Ï¥»¥ó¥µ¤Î¸íº¹¤ä¥Î¥¤¥ºÅù¤ÇÃͤϰۤʤë¤Ï¤º¤Ç¤¹¤¬¡¢Ìܰ¤ˤϤʤë¤Ç¤·¤ç¤¦¡£

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

A/D ÊÑ´¹¤ò»È¤Ã¤Æ²Ã®ÅÙ¥»¥ó¥µÃͤòÆɤॵ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ò 05acc.tar.gz ¤«¤é¥À¥¦¥ó¥í¡¼¥É¤Ç¤­¤Þ¤¹¡£¤Ï¤¸¤á¤Ë ¤Î¥Ú¡¼¥¸¤«¤é¡¢Á´¤Æ¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤ò ¸Ç¤á¤¿ tar ¥Õ¥¡¥¤¥ë¤ò¥À¥¦¥ó¥í¡¼¥É¤¹¤ë¤³¤È¤â¤Ç¤­¤Þ¤¹¡£

Ãæ¤Ë¤Ï

  • Makefile
  • adc.h
  • adc.c
  • util.h
  • util.c
  • usart.h
  • usart.c
  • main.c

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

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

make ¼Â¹Ô¸å¡¢¥×¥í¥°¥é¥à¤ò¥¢¥Ã¥×¥í¡¼¥É¤¹¤ë¾ì¹ç¤Ï make uisp ¤ò¼Â¹Ô¤·¤Æ¤¯¤À¤µ¤¤¡£

ËÜ¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ï 500ms ¤Ë 1 ²ó¤Î³ä¹ç¤Ç¡¢3 ¼´¤Î²Ã®ÅÙ¥»¥ó¥µ½ÐÎÏÃͤò A/D ÊÑ´¹µ¡Ç½¤ÇÆɤ߹þ¤ó¤À¸å¤Ë¡¢Ãͤò "(X,Y,Z)=(...,...,...)" ¤È¤¤¤¦·Á¼°¤Îʸ»úÎó¤Ë²Ã¹©¤·¤Æ¥·¥ê¥¢¥ëÄÌ¿®¤ÇÁ÷¿®¤·¤Þ¤¹¡£A/D ÊÑ´¹·ë²ÌÉôʬ¤Ï 10¿Ê¿ôɽ¼¨¤Ç¤¹¡£Ê¸»úÎó¤ò¼õ¿®¤¹¤ë¤¿¤á¤Ë¤Ï¡¢¼Â¸³ÍѲóÏ©¤È PC ¤Î¥·¥ê¥¢¥ë¥Ý¡¼¥È¡ÊD-SUB 9¥Ô¥ó¡Ë¤ò¥¹¥È¥ì¡¼¥È¥±¡¼¥Ö¥ë¤ÇÀܳ¤·¡¢Windows ¤Ç¤¢¤ì¤Ð¥Ï¥¤¥Ñ¡¼¥¿¡¼¥ß¥Ê¥ëÅù¤ÎÄÌ¿®¥½¥Õ¥È¤Ç°Ê²¼¤Î¥Ñ¥é¥á¡¼¥¿¤òÀßÄꤷ¤Æ¥Õ¥í¡¼À©¸æ̵¤·¤ÇÀܳ¤·¤Æ¤¯¤À¤µ¤¤¡£

  • ÈóƱ´üÆ°ºî
  • ¥Ü¡¼¥ì¡¼¥È 9600 bps
  • ¥Ñ¥ê¥Æ¥£Ìµ¤·
  • ¥¹¥È¥Ã¥×¥Ó¥Ã¥È 1¥Ó¥Ã¥È
  • 8 ¥Ó¥Ã¥È¥Ç¡¼¥¿Å¾Á÷

"(X,Y,Z)=(...,...,...)" ¤È¤¤¤¦·Á¼°¤Îʸ»úÎ󤬡¢¥¿¡¼¥ß¥Ê¥ë¤ËϢ³Ū¤Ëɽ¼¨¤µ¤ì¤ë¤È»×¤¤¤Þ¤¹¡£¤³¤Î´Ö¤Ë²Ã®ÅÙ¥»¥ó¥µ¤òºÜ¤»¤¿´ðÈĤò·¹¤±¤ë¤È¡¢"(X,Y,Z)=(...,...,...)" ¤Î ... ¤ÎÉôʬ¤Ëɽ¼¨¤µ¤ì¤ë¿ô»ú¤¬ÊѲ½¤·¤Þ¤¹¡£

¢­ÄÌ¿®¥½¥Õ¥È¤Ë¤Ï¤³¤ÎÍͤËɽ¼¨¤µ¤ì¤Þ¤¹¡£
²Ã®ÅÙ¥»¥ó¥µÃͤÎÆɤ߹þ¤ß·ë²Ìɽ¼¨²èÌÌ

  • main.c
        1    #include <avr/io.h>
        2    #include <inttypes.h>
        3    
        4    #include "adc.h"
        5    #include "usart.h"
        6    #include "util.h"
        7    
        8    
        9    #define INDEX_TO_INSERT_X  9
       10    #define INDEX_TO_INSERT_Y  14
       11    #define INDEX_TO_INSERT_Z  19
       12    
       13    
       14    static uint16_t get_data(char ch);
       15    static void fill(char *buf, int index, int data);
       16    
       17    
       18    int
       19    main(void)
       20    {
       21            char buf[32] = "(X,Y,Z)=(    ,    ,    )\r\n";
       22    
       23            uint16_t x;
       24            uint16_t y;
       25            uint16_t z;
       26    
       27            pullup();
       28            /* PA1-3 ¥×¥ë¥¢¥Ã¥×̵¸ú */
       29            PORTA &= ~(_BV(PINA1) | _BV(PINA2) | _BV(PINA3));
       30    
       31            /* (8MHz/64) = 125KHz */
       32            adc_init(ADC_CK_64, ADC_NO_INT);
       33            usart_init(USART_NO_INT);
       34    
       35            while (1){
       36                    x = get_data(PINA3);
       37                    y = get_data(PINA2);
       38                    z = get_data(PINA1);
       39    
       40                    fill(buf, INDEX_TO_INSERT_X, x);
       41                    fill(buf, INDEX_TO_INSERT_Y, y);
       42                    fill(buf, INDEX_TO_INSERT_Z, z);
       43    
       44                    usart_tx_string(buf);
       45                    delay_500ms();
       46            }
       47    
       48            return 0; /* ·Ù¹ð¤òÈò¤±¤ë¤¿¤á */
       49    }
       50    
       51    
       52    static uint16_t
       53    get_data(char ch)
       54    {
       55            adc_set_ch(ch);
       56            adc_start();
       57            adc_wait();
       58            return adc_get();
       59    }
       60    
       61    
       62    static void
       63    fill(char *buf, int index, int data)
       64    {
       65            char abuf[5];
       66            char *pos = abuf;
       67            char ch;
       68    
       69            itoa(abuf, data, 10, 4, '0');
       70    
       71            while ((ch = *(pos ++))) {
       72                    buf[index ++] = ch;
       73            }
       74    }
       75    
       76    /* End of main.c */
    
    
    • 18 ¡Á 49 ¹ÔÌÜ (main())

      • pullup() (pullup.h¡¢Á´ÆþÎϥݡ¼¥È¤ÎÆâÉô¥×¥ë¥¢¥Ã¥×¤òÍ­¸ú²½)
      • PINA1 - PINA3 ¥Ô¥ó¤ÏÆþÎϤȤ·¤Æ»ÈÍѤ¹¤ë¤Î¤Ç¡¢¥×¥ë¥¢¥Ã¥×¤ò̵¸ú²½
      • adc_init() (adc.h¡¢A/D ÊÑ´¹´ï½é´ü²½)
      • usart_init() (usart.h¡¢USART ½é´ü²½)

      ¤ò¹Ô¤Ã¤¿¸å¡¢while ¥ë¡¼¥×¤ËÆþ¤ê¤Þ¤¹¡£¥ë¡¼¥×Æâ¤Ç¤Ï¤Þ¤º

      x = get_data(PINA3);
      y = get_data(PINA2);
      z = get_data(PINA1);
      
      

      ¤ò¼Â¹Ô¤·¤Æ¡¢²Ã®ÅÙ¥»¥ó¥µ¤Î X/Y/Z ½ÐÎϤΠA/D ÊÑ´¹·ë²Ì¤ò¼èÆÀ¤·¤Þ¤¹¡£ ¤½¤Î¸å¡¢¸å½Ò¤Î fill() ¤Ë¤è¤Ã¤Æ USART Á÷¿®ÍѤÎʸ»úÎó¤òºîÀ®¤·¤Þ¤¹¡£

      Á÷¿®ÍѤÎʸ»úÎó¤òºîÀ®¤·¤¿¤é¡¢usart_tx_string() ¤Ë¤è¤Ã¤Æ USART Á÷¿®¥Ð¥Ã¥Õ¥¡¤Ëʸ»úÎó¤òÀßÄꤷ¡¢500ms ÂÔ¤Ã¤Æ while() ¥ë¡¼¥×¤Ë¤è¤ë¼¡¤Î A/D ÊÑ´¹¤ò¹Ô¤¤¤Þ¤¹¡£

    • 52 ¡Á 59 ¹ÔÌÜ (get_data())

      °Ê²¼¤Î½èÍý¤ò¤Þ¤È¤á¤Æ¹Ô¤¦¤¿¤á¤Î´Ø¿ô¤Ç¤¹¡£

      • »ØÄꤵ¤ì¤¿¥Á¥ã¥Í¥ë¤ò adc_set_ch() ¤Ç¥¢¥Ê¥í¥°ÊÑ´¹´ï¤ËÀܳ
      • adc_start() ¤Ç A/D ÊÑ´¹³«»Ï
      • adc_wait() ¤Ç A/D ÊÑ´¹½ªÎ»ÂÔ¤Á
      • adc_get() ¤Ç A/D ÊÑ´¹·ë²Ì¤òÊÖ¤¹

    • 62 ¡Á 74 ¹ÔÌÜ (fill())

      Îã¤Ë¤è¤Ã¤Æʸ»úÎó²Ã¹©ÍѤμ«ºî´Ø¿ô¤Ç¤¹¡£data ¤Ç»ØÄꤷ¤¿¿ôÃͤò itoa()(util.c) ¤Ç 4 ʸ»úÉý¤Î¿ô»ú¤ËÊÑ´¹¤·¡¢"(X,Y,Z)=( , , )" ¤Îʸ»úÎó¥Ð¥Ã¥Õ¥¡¤Ë ľÀÜʸ»ú¤òËä¤á¹þ¤ß¤Þ¤¹¡£

°Ê¾å¤Ç²òÀâ¤Ï½ª¤ï¤ê¤Ç¤¹¡£ËÜ¥×¥í¥°¥é¥à¤Ç¤Ï²Ã®ÅÙ¥»¥ó¥µ½ÐÎÏÃͤΠA/D ÊÑ´¹·ë²Ì¤ò¤½¤Î¤Þ¤Þɽ¼¨¤·¤Þ¤·¤¿¤¬¡¢Ãͤ«¤é²¿ÅÙ·¹¤¤¤Æ¤¤¤ë¤Î¤«¡©¤ò·×»»¤·¤Æɽ¼¨¤·¤¿¤ê¡¢¥²¡¼¥àµ¡¤Î¥³¥ó¥È¥í¡¼¥é¤ÎÍÍ¤Ë»È¤Ã¤Æ PC ¾å¤Î¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Îɽ¼¨¤òÊѤ¨¤¿¤êÅù¤¤¤í¤¤¤í¤Ê»È¤¤ÅÓ¤¬¤¢¤ë¤È»×¤¤¤Þ¤¹¡£