Ìܼ¡
²áµî¤ÎÆüµ
»²¹Í¤Ë¤Ê¤ê¤½¤¦¤Ê¥µ¥¤¥È
http://blog.goo.ne.jp/mimipsoc/e/e7ce7d266cba4fbca015202c01370866
http://arms22.blog91.fc2.com/?tag=C328
http://arms22.blog91.fc2.com/blog-entry-261.html
¬Äê²óÏ©Îã¤ò¸«¤¿»þ¤Ï°¢Á³¤È¤·¤¿¤±¤É¡¢¤³¤ì¤ò»È¤¨¤Ð´Êñ¤Ë¤Ê¤ë¡¦¡¦¤«¤Ê
http://homepage3.nifty.com/sudamiyako/zk/hs15/hs15.htm
¢½ñ¤¤Þ¤·¤¿
PSoCÆþÌ硧¥¯¥í¥Ã¥¯¤¿¤¯¤µ¤ó
½©·î¥Ñ¥ë¥¹¤ò¤Ñ¤¯£ô£ô»²¹Í¤Ë¡¢Ì®Çï¤ò¬¤Ã¤Æ¤ß¤¿¡£
¥Õ¥©¥È¥ê¥Õ¥ì¥¯¥¿¤Ë¤ÏPRP-220¡¢¥¢¥ó¥×¤ÎÁýÉýΨ¤Ï8ÇÜ¡£
µÕ»»¤¹¤ë¤Ë¡¢Ì®ÇÈ·Á¤Ï50mVp-p¤°¤é¤¤¡©
»Ø¤ÎÅö¤Æ¤ë¾ì½ê¡¢Åö¤Æ¤ë¶¯¤µ¤¬¤¹¤´¤¤Æñ¤·¤¯¤Æ¡¢¤Ê¤ì¤Ê¤¤¤È¤¤ì¤¤¤ÊÌ®ÇÈ·Á¤¬½Ð¤Æ¤³¤Ê¤¤¡£
¥ª¥·¥í¸«¤Ê¤¬¤é¤¸¤ã¤Ê¤¤ã̵Íý¡¦¡¦
¥Þ¥¤¥³¥ó¤Ú¤Ë¤ÏÆñ¤·¤¤¤«¤Ê¤¡¡¦¡¦
¥¢¥Ê¥í¥°¥Ö¥í¥Ã¥¯¤ò»È¤Ã¤Æ¤¤¤Ê¤¤»þ¡¢
global resourece¤Î¡¢analog power¤ò¡¢All Off¤Ë¤¹¤ë¤È¡¢
¥¹¥¤¥Ã¥Á¥É¥¥ã¥Ñ¥·¥¿¤ò¤ä¥ê¥Õ¥¡¥ì¥ó¥¹ÅÅ°µ¸»¤ÎÅŸ»¤òÍî¤È¤¹¡Ê?¡Ë¤Î¤Ç¤½¤Îʬ¾ÃÈñÅÅή¤¬¸º¤ë¤é¤·¤¤¡£
Í׼¬
http://dr.matrix.jp/psoc3.html
¥Þ¥¤¥³¥ó¤Î²£¤Ë¤Ï¥Ñ¥¹¥³¥ó¤¬É¬Íסª¤Ã¤Æ¤³¤È¤ÇÌÕÌÜŪ¤Ë0.1uF¤ò¤Ä¤Ê¤¤¤Ç¤¤¤¿¤±¤É¡¢
¤½¤Î¾ÜºÙ¤ÊÍýͳ¤Ï¡¢
¤Ê¤¼0.1uF¤Ê¤Î¡©
SPIM¤Î¥¯¥í¥Ã¥¯¤Î¾å¸Â¤è¤êÂ礤ʼþÇÈ¿ô¤ÇÄÌ¿®¤·¤è¤¦¤È¤·¤¿¡¢¤Î¤Ï´Ö°ã¤¤¡Ê¤¡
¥Ç¡¼¥¿¥·¡¼¥È¤ò³Î¤«¤á¤¿¤é¡¢SPIM¥â¥¸¥å¡¼¥ë¤Î¥¯¥í¥Ã¥¯¤ÎȾʬ¤Î¼þÇÈ¿ô¤¬ÄÌ¿®¤Î¼þÇÈ¿ô¤Ë¤Ê¤ë¤è¤¦¡£
¤Ä¤Þ¤ê8MHz¤ò¥¯¥í¥Ã¥¯¤ËÆþ¤ì¤Æ¤¤¤¿¤±¤É¡¢¼ÂºÝ¤ÎÄÌ¿®Â®ÅÙ¤Ï4MHz¤Ç¾å¸Â¤Ë¼ý¤Þ¤Ã¤Æ¤¤¤¿¡£
¤È¤¤¤¦¤³¤È¤Ç¡¢´ª°ã¤¤¤·¤Æ¤¤¤¿¤±¤É¡¢·ë²Ì¤È¤·¤Æ¾å¸Â¤Ë¼ý¤Þ¤ëÃͤˤʤäƤ¤¤¿¡£
¡¦¡¦¡¦Åö»þ¤Ê¤¼µ¤¤Å¤«¤Ê¤«¤Ã¤¿¡Á¡Á
PSoC¤ÎSPIM¤Î¥¯¥í¥Ã¥¯¤Î¾å¸Â¤Ï4MHz¡£¤Ê¤Î¤Ë¡¢º£ºî¤Ã¤Æ¤¤¤ë¡Ê»È¤Ã¤Æ¤¤¤ë¡Ë¥×¥í¥°¥é¥à¤Ï¡¢8MHz¤ÇÄÌ¿®¤µ¤»¤è¤¦¤È¤·¤Æ¤¤¤¿¡£¡Ê¥ª¡¼¥Ð¥¯¥í¥Ã¥¯¡ª¡Ë
¡¦¡¦¡¦Åö»þ²¶¤Ï¤Ê¤¼µ¤ÉÕ¤«¤Ê¤«¤Ã¤¿¤ó¤À¤í¤¦¡©
¡¦¡¦¡¦¤½¤·¤Æ¡¢¤Ê¤¼Æ°¤¤¤Æ¤¿¤ó¤À¤í¤¦¡©
¡¦¡¦¡¦Â´¸¦È¯É½¤³¤ì¤Ç¤ä¤Ã¤¿¤è
¤¿¤Þ¤ËÁÇľ¤ËÆ°¤«¤Ê¤¯¤Ê¤Ã¤¿¤Î¤â¤³¤ì¤¬¸¶°ø¤Ê¤Î¤À¤í¤¦¤«¡¦¡¦¡©
¤È¤ê¤¢¤¨¤º¤·¤Ã¤«¤ê³Îǧ¤·¤Ê¤¬¤éÀ߷פò¤ä¤Ã¤Æ¤¤¤¤Þ¤¹orz
#ÄÌ¿®Â®ÅÙ¤òÍî¤È¤·¤¿¤È¤¤Ë¡¢½èÍý»þ´Ö¤¬¥Ç¥Ã¥É¥é¥¤¥ó¤òĶ¤¨¤Ê¤¤¤«¤¬Éݤ¤¡¦¡¦
6·î25Æü¤ÎÆüµ¤Ø³¤¤Þ¤¹¡£
¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥Î¡¼¥È¤ÎAN32200¤Ë¤è¤ë¤È¡¢ECO¡Ê32.768kHz)¤Ï732Çܤµ¤ì¤Æ¡¢23.986MHz¤È¤·¤ÆIMO(=Sys Clock)¤Î¼þÇÈ¿ô¤Ë¤Ê¤ë¤è¤¦¤À¡£
¤Ä¤Þ¤ê½ã¿è¤Ê24MHz¤Ç¤Ï¤Ê¤¤¡£
¤½¤Î¤³¤È¤ò¹Íθ¤¹¤ë¤È¡¢6·î3Æü¤ÎÆüµ¤Ï¹Í¤¨Êý¤¬°ã¤Ã¤Æ¤Æ¡¢Æ°ºî¼«ÂΤÏÀµ¤·¤«¤Ã¤¿¤³¤È¤Ë¤Ê¤ë¡£
23.986M/12/200=9994.167Hz
¤Ç¡¢¤â¤¦°ìÅÙ·×»»¤·¤Æ¤ß¤ë¤È¡¢23.986MHz / 11 / 218 = 10.0026kHz
¼Â¬¤Ï10.0024kHz¤À¤Ã¤¿¡£Á°²ó¤è¤ê10kHz¤Ë¶á¤¤Ãͤˤʤä¿¡£
¥¯¥í¥Ã¥¯¼þÇÈ¿ô¤«¤é¡¢¤Û¤·¤¤¥¿¥¤¥Þ¤Î¼þÇÈ¿ô¤ò·×»»¤¹¤ë¤Î¤ÏÂçÊѤʤΤǡ¢¥¹¥¯¥ê¥×¥È¤òºî¤Ã¤Æ¤ß¤Þ¤·¤¿¡£
¤¹¤´¤¤¤ä¤Ã¤Ä¤±¤Ê¤Î¤Ç¡¢»È¤¨¤Ê¤¤¤«¤â¤Ç¤¹¤¬°ì±þ¸ø³«
PSoC¤Çc¸À¸ì¤Ç³«È¯¤·¤Æ¡¢¥³¥ó¥Ñ¥¤¥ë¤·¤¿·ë²Ì¤Î¥¢¥»¥ó¥Ö¥é¥Õ¥¡¥¤¥ë¤Ë¤Ä¤¤¤Æ¡£
¥³¥ó¥Ñ¥¤¥ë¤¹¤ë¤È¿§¡¹¤Ê¥Õ¥¡¥¤¥ë¤¬½Ð¤Æ¤¯¤ë¤±¤É¤½¤Î¤Ê¤«¤Ë¡¢"main.lis"¤Ã¤Æ¤¤¤¦¤Î¤È¡¢"(¥×¥í¥¸¥§¥¯¥È̾).lst"¤Ã¤Æ¤¤¤¦¥Õ¥¡¥¤¥ë¤¬2¸Ä¤¢¤ë¡£
ξÊý¤È¤âÃæ¿È¤Ï¥¢¥»¥ó¥Ö¥é¤Ã¤Ý¤¤¤ó¤À¤±¤É¡¢¤½¤ì¤¾¤ì¤É¤¦¤¤¤¦°ÕÌ£¤Ê¤ó¤À¤í¤¦¡¦¡¦?
³ä¤ê¹þ¤ß¤Ç¥Õ¥é¥°¤ò½èÍý¤·¤¿¤¤¤Ã¤Æ¤¤¤¦¾ìÌ̤Ϥ褯¤¢¤ë¡£
//¤½¤ì¤¾¤ì¡¢flg¤ÎÃͤ¬0¤Ê¤é1¤Ë¡¢1¤Ê¤é0¤Ë¤¹¤ë½èÍý flg = ++flg % 0x02; flg = ++flg & 0x01;
¤½¤ì¤¾¤ì¥¢¥»¥ó¥Ö¥é¤Ç¸«¤Æ¤ß¤ë¤È¡¢
flg = ++flg&0x01; -------- add [_flg],1 and [_flg],1
flg = ++flg%0x02; -------- mov A,[_flg] add A,1 mov [__r0],A mov [_flg],A mov A,2 push A mov A,[__r0] push A xcall __divmodu_8X8_8 add SP,-1 pop A mov [_flg],A
¤È¡¢Á´Á³ÊѤï¤Ã¤Æ¤¤Æ¤¤¤¿¡£
¥¿¥¤¥Þ³ä¤ê¹þ¤ß¿ô¤ò¥«¥¦¥ó¥È¤¹¤ë¤È¤¤È¤«¤â(2¤Î¤Ù¤¾è¤Î»þ¤À¤±¤À¤±¤É)¸å¼Ô¤¬»È¤¨¤½¤¦¡£
AVR¥Þ¥¤¥³¥ó¤ÎC¸À¸ì¤ÎÊý¸À(?)¤Ë¡¢_BV(bit)¤Ã¤Æ¤¤¤¦¥Þ¥¯¥í¤¬¤¢¤ë¡£
¤³¤ì¤Ï¡¢
#define _BV(bit) (1 << (bit))
¤È¤¤¤¦É÷¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
¤³¤ì¡¢¼Â¤Ï¤¹¤Ã¤´¤¤ÊØÍø¡£PSoC¤Ç¤Ï¥Ç¥Õ¥©¥ë¥È¤ÇÄêµÁ¤µ¤ì¤Æ¤Ê¤¤¤Î¤Ç¡¢²¶¤Ï¼«Ê¬¤ÇÄêµÁ¤·¤Æ»È¤Ã¤Æ¤ë¡£
PRT1DR |= 0x82;
¤Ã¤Æ½ñ¤¤¤Æ¤¢¤ë¤È¤Ê¤ó¤Î¤³¤Ã¤Á¤ã¡©¤Ã¤Æº®Í𤷤Ƥ·¤Þ¤¦¡£¤À¤±¤É¡¢
PRT1DR |= _BV(7)|_BV(1);
¤Ã¤Æ½ñ¤¯¤È¡¢¤¢¤¡¡¢1¥Ó¥Ã¥ÈÌܤÈ7¥Ó¥Ã¥ÈÌܤò1¤Ë¤·¤¿¤¤¤ó¤À¤Ê¡£¤Ã¤Æ¤Ñ¤Ã¤È¸«¤Æ¤ï¤«¤ë¡£
¤Û¤«¤Ë¤â¡¢
#define LED_blue 3 ... PRT1DR |= _BV(LED_blue); PRT1DR &= ~_BV(LED_blue);
¤È¤«½ñ¤¯¤È¡¢¤¢¤¡¡¢ÀÄ¿§LED¤òÉÕ¤±¤¿¤¤/¾Ã¤·¤¿¤¤¤ó¤À¤Ê¤Ã¤Æ¤¹¤°¤ï¤«¤ë¡£
PSoC¤Ï2¿Ê¿ô¤¬»È¤¨¤ë¤±¤É¡¢Â¾¤Î¥Þ¥¤¥³¥ó¤Ç¤Ï»È¤¨¤Ê¤«¤Ã¤¿¤ê¡¢2¿Ê¿ô¤Ç¤â8¥±¥¿¤Ë¤Ê¤ë¤ÈÆɤߤˤ¯¤¤¤«¤é¡¢¤¢¤Þ¤ê»È¤Ã¤Æ¤Ê¤¤¡¦¡¦
¾¤Ë¤â¡¢AVR¤Ë¤Ï¥Ó¥Ã¥ÈÁàºî¤ò¤¹¤ë¤Î¤Ë³Ú¤Ê¥Þ¥¯¥í¤¬¤¤¤í¤¤¤í¤¢¤ë¡£
http://avrwiki.jpn.ph/wiki.cgi?page=Getting+Started+Notes+-+Ports#p9
dataseet¤Ë¤è¤ë¤È¡¢
OutputPeriod = sourceClockPeriod x (periodRegisterValue + 1)
¤È¤Ê¤Ã¤Æ¤¤¤ë¡£
º£¤¿¤È¤¨¤Ð¡¢Sysclock¤ò24MHz¡¢sourceClockPeriod(VC1¤ÎÃÍ)¤ò12¤Î¤È¤¡¢
10kHz¤¬¤Û¤·¤¤»þ¤Ï¡¢periodRegisterValue¤ò199¤Ë¤·¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
º£¤Þ¤Ç200¤òÆþ¤ì¤Æ¤¤¤¿¤±¤É¡¢¸·Ì©¤Ë¤Ï´Ö°ã¤¤¤À¤Ã¤¿¤è¤¦¤À¡¦¡¦orz
¼Â¬¤·¤Æ¤ß¤ë¤È¡¢
period | frequancy[kHz] |
200 | 9.94438 |
199 | 9.99410 |
Ìó50Hz¤º¤ì¤Æ¤¤¤ë¡£(10kHz/200= 50Hz)
PSoCÆ⢤Υ¯¥í¥Ã¥¯¤À¤±(ILO)¤À¤È¡¢ºÇÂç+/-2.5%¤º¤ì¤ëÀºÅÙ(accuracy)
¤³¤³¤Ç¡¢³°ÉÕ¤±¤Î¿å¾½¤ò»È¤¦¤È¡¢¤µ¤é¤Ë¹âÀºÅÙ(accuracy)¤Ë¤Ê¤ë¡¢¤Ï¤º¡£
¤ä¤êÊý¤ÏTechnical Reference Manual(http://www.cypress.com/?rID=3208 )¤Ë½ñ¤¤¤Æ¤¢¤ë¤±¤É¡¢
Application Note¤ÎAN2027(http://jp.cypress.com/?id=1029&rtID=5&rID=26009 )¤ÎÊý¤¬¾Ü¤·¤¤¡£
#¤È¤¤¤¦¤«ºÇ½éTRM¤À¤±¸«¤Æ¤¿¤é¥Ï¥Þ¤Ã¤¿¡¦¡¦
P1[0]¤ÈP1[1]¤Î´Ö¤Ë¿å¾½¤òÃÖ¤¡¢¤½¤ì¤¾¤ì¤Îü»Ò¤«¤é¥³¥ó¥Ç¥ó¥µ¤òÉÕ¤±¤ÆVdd¤Ë·Ò¤°¡£
Designer¤Ç¡¢¤½¤ì¤¾¤ì¤Î¥Ô¥ó¤ÎÀßÄê¤ò°Ê²¼¤Î¤è¤¦¤Ë¤¹¤ë¡£
¥°¥í¡¼¥Ð¥ë¥ê¥½¡¼¥¹¤òÊѹ¹
32k_Select | External |
PLL_Mode | Ext_Lock |
·ëÏÀ¤«¤é¸À¤¦¤È¡¢P1[1]¦¤Ë12pF¡¢P1[2]¦¤Ë100pF¤ò¤Ä¤Ê¤²¤ë(20 Pin SSOP¤Î¾ì¹ç¡Ë¡£
PLL¤ò»È¤ï¤Ê¤¤»þ¤Ï¡¢TRM¤Ë½ñ¤¤¤Æ¤¢¤ë¤è¤¦¤ËC1¤ÈC2(ð20pF)¤Ç¤¤¤¤¤ó¤À¤±¤É¡¢
¼ÂºÝ»È¤¦¤È¤¤ÏPLL¥â¡¼¥É¤Ç»È¤¦¡Ê¤é¤·¤¤¡Ë¡£
#¤³¤³¤ÏÆɤó¤Ç¤Æ¤â¤Ê¤ó¤È¤Ê¤¯¤·¤«Íý²ò¤Ç¤¤Ê¤«¤Ã¤¿¡¦¡¦
P1[0]¤ÈP1[1]¤Ï¡¢¥×¥í¥°¥é¥à¤ò½ñ¤¹þ¤à¥Ô¥ó¤Ç¤â¤¢¤ë¡£¿å¾½¤ò¤Ä¤Ê¤²¤¿¤Þ¤Þ¤Ç¤â¥×¥é¥°¥é¥à¤Ï½ñ¤¹þ¤á¤ë¡£
¤¿¤À¤·¡ª¼Â¹Ô¤µ¤»¤ë¤È¤¤ÏMiniProg¤Ï³°¤µ¤Ê¤¤¤È¤¤¤±¤Ê¤¤¡£MiniProgÍÆÎÌÉé²Ù¤¬Â礤¹¤®¤ë¡©¤Î¤«¿å¾½¤¬¤·¤Ã¤«¤êȯ¿¶¤Ç¤¤Ê¤¤¡£
10kHz¤´¤È¤Ë¥Ñ¥ë¥¹¤ò½Ð¤·¤Æ¤ß¤¿¡£¥ª¥·¥í¥¹¥³¡¼¥×¤Î¼þÇÈ¿ô¥«¥¦¥ó¥¿¤Îɽ¼¨¡£
ILO(Æâ¢) | 10.07kHz |
ECO(¿å¾½) | 9.94434kHz |
Äɵ¢ª6·î17Æü¤ÎÆüµ¤Ø
¹Í¤¨Êý¤¬°ã¤Ã¤Æ¤Æ¡¢Æ°ºî¼«ÂΤÏÀµ¤·¤¤¤Ç¤¹¡£
¤³¤³¤Î¥µ¥¤¥È¤¬¤¹¤´¤¯¤Þ¤È¤Þ¤Ã¤Æ¤Þ¤·¤¿¡£http://bluefish.orz.hm/sdoc/psoc3.html
ÀèÀ¸¤Î¥Ú¡¼¥¸¡Êhttp://akita11.jp/plan/osc/¡¡¢ª¡¡Know-hows / Tips¡Ë¤Ë½ñ¤¤¤Æ¤¢¤Ã¤¿¡£
¼ê»ý¤Á¤Î¡¢Trancend 2GB¤Ç¤Ï¤Á¤ã¤ó¤ÈÇÈ·Á¤òÊݸ¤Ç¤¤Þ¤·¤¿¡ª
¥°¥í¡¼¥Ð¥ë¥ê¥½¡¼¥¹ SysClk 24MHz CPU_Clock CycClk/1
//³ä¤ê¹þ¤ß´Ø¿ô #pragma interrupt_handler Timer8_ISR void Timer8_ISR(){ //LED¥â¥¸¥å¡¼¥ë LED_On(); LED_Off(); }
¾å¤Î¾ò·ï¤Î»þ¡¢¥¿¥¤¥Þ³ä¤ê¹þ¤ß¤Î¼þ´ü¤Î¾å¸Â¤ÏÌó46kHz¤À¤Ã¤¿¡£
¤³¤ì°Ê¾å¤Î¼þ´ü¤Ç³ä¤ê¹þ¤ß¤ò¤«¤±¤è¤¦¤È»×¤Ã¤Æ¤â¡¢46kHz¤ÇƬÂǤÁ¡£Î±°Õ¤·¤Þ¤·¤ç¤¦¡£