Ìܼ¡
// Echo off. UART_SDCARD_PutString(SDcmd[SD_E0]); UART_SDCARD_PutChar(CR); while(1){ //Menu Select SW = UART_PC_cGetChar(); switch(SW){ case 49: //1 UART_SDCARD_PutString(SDcmd[SD_E0]); UART_SDCARD_PutChar(CR); Receive_func(); break;
¥¨¥³¡¼¥ª¥Õ¤Î¡ä¤¬RX¥Ð¥Ã¥Õ¥¡¤Ë»Ä¤ë
¡i¤òÁ÷¿®¸å¡¢Receive_func();¤ÇÆɤ߼è¤ë¤¬¡¢¥¨¥³¡¼¥ª¥Õ¤Î¡ä¤òÆɤ߼è¤ê½ªÎ»
·ë¶É¡¢i¤ÇÊ֤äƤ¤¿¾ðÊó¤¬Æɤ᤺¡£¡£
¢i¤Î¥³¥Þ¥ó¥É¤ÎºÇ¸å¤À¤±¡¢¡ä¤À¤±¤¬¤Þ¤¿»Ä¤ë(Rx¥Ð¥Ã¥Õ¥¡¤Ï¤ª¤½¤é¤¯1¥Ð¥¤¥È¤Ê¤Î¤Ç)
¡¢¤Î·«¤êÊÖ¤·
¤ª¤½¤é¤¯¤³¤ó¤Ê¤³¤È¤¬µ¯¤³¤Ã¤Æ¤¤¤¿¤Î¤À¤í¤¦¡£¡£(´À
½©ÅÄÀèÀ¸¤ËÊó¹ð¤·¤¿¤é¡¢
¥Ð¥Ã¥Õ¥¡¥ª¡¼¥Ð¡¼¥é¥ó¥¨¥é¡¼¤Î¥Õ¥é¥°¤ò¸«¤Æ¤ä¤ì¤Ð¤è¤«¤Ã¤¿¤Í¡¢¤È¤Î¤³¤È¡£
¤¿¤·¤«¤Ë¤½¤¦¤À¡£RxState()¤Ç¾õ¶·¤òȽÃǤ¹¤ì¤Ð¡¢¤â¤¦¾¯¤·Á᤯ÌäÂê¤ò
²ò·è¤Ç¤¤¿¤«¤â¤·¤ì¤Ê¤¤¡£
º£¸å¤Î»²¹Í¤Ë¤·¤è¤¦¡£
·ë¶É¡¢º£²ó¤Î¾ì¹ç¤Ï¡¢°Õ³°¤Ê¤È¤³¤í¤Ç¡ä¤¬Ê֤äƤ¤Æ¤¤¤¿¤Î¤Ç¡¢
µ¤¤Å¤«¤Ê¤«¤Ã¤¿¤ï¤±¤Ç¤¢¤ë¡£
¤À¤«¤é¡¢¥Ô¥ó¤òΩ¤Æ¤Æ¡¢Ä¾ÀÜÊ֤äƤ¤Æ¤¤¤ë¿®¹æ¤ò¸«¤Æ¤ä¤ì¤Ð¡¢²ò·è¤·¤½¤¦¤À¡£
¤¢¤¯¤Î¤ê¤Ã¤Á¤¬ÆÍÁ³¸Ç¤Þ¤ë¡£
¼¡¤ËºÆµ¯Æ°¤·¤Æ¤â¡¢2¥Ý¡¼¥È¤ËCP2102¤ò»È¤¨¤Ê¤¤¤Ã¤Ý¤¤¡£
UART_PC_CPutString("test3!!\r\n"); //Receive Prompt while ( !( RxState =UART_SDCARD_bReadRxStatus() & UART_SDCARD_RX_COMPLETE )){} if( RxState == UART_SDCARD_RX_COMPLETE){ //Start Receive Receive_Prompt = UART_SDCARD_cGetChar(); if(Receive_Prompt == 0x3e){ UART_PC_CPutString("Prompt >");
¤³¤Î¥×¥í¥°¥é¥à¤Î°ì¹ÔÌܤò¥³¥á¥ó¥È¥¢¥¦¥È¤¹¤ë¤È¡¢
¡É¡ä¡É¤¬¼õ¤±¼è¤ì¤Ê¤¯¤Ê¤Ã¤¿¡£¤É¤¦¤ä¤éCPutString¤·¤Æ¤¤¤ë¤È¤³¤í¤ò¥³¥á¥ó¥È¥¢¥¦¥È¤¹¤ë¤È¡¢
¥¨¥³¡¼¤òcGetChar¤Ç¼õ¿®¤·¤Æ¤·¤Þ¤¦¤è¤¦¤À¡£
¥¨¥³¡¼¤Ï¥ª¥Õ¤Ë¤·¤Æ¤ª¤¤¤¿Êý¤¬¤è¤µ¤½¤¦¤À¡£
¥×¥í¥ó¥×¥È¤Þ¤Ç¤«¡¢100¥Ð¥¤¥È¤Þ¤Ç¤òÆɤ߹þ¤ó¤À¸å¤ËCPutString¤Ç½ÐÎϤ·¤Æ¤¤¤¿¤¬¡¢
¤³¤ì¤À¤È100¥Ð¥¤¥Èʬ½ÐÎϤµ¤ì¤Æ¤·¤Þ¤¦¤Î¤Ç¡¢¤ª¤«¤·¤¯¤Ê¤ë¡£
CWrite¤Ç»ØÄê¥Ð¥¤¥Èʬ¤À¤±½ÐÎϤ·¤¿Êý¤¬¤è¤µ¤½¤¦¤À¡£
char Receive_Data[100];
UART_PC_PutString(Receive_Data);
while ( !( UART_PC_bReadRxStatus() & UART_PC_RX_COMPLETE )){} while(1){ if( (Receive_Data = UART_PC_cGetChar()) != 0x3e ){ // ">" de nainara UART_PC_PutChar(Receive_Data); }else{ break; } }
while ( !( UART_PC_bReadRxStatus() & UART_PC_RX_COMPLETE )){}
¤Ï¡¢cGetChar¤Ç¤Ï¤¤¤é¤Ê¤¤¤Ã¤Ý¤¤¡£
¤è¤¯¹Í¤¨¤Æ¤ß¤ì¤Ð¡¢cGetChar¤Ï¡¢¼õ¿®¤¹¤ë¤Þ¤ÇÂԤäƤ¯¤ì¤ë
UART_PC_IntCntl(UART_PC_ENABLE_RX_INT); // Enable RX interrupts
UART_PC_IntCntl(UART_PC_DISABLE_RX_INT);
¤òÌÀ¼¨¤·¤Æ¤ä¤ì¤Ð¡¢¼õ¿®³ä¤ê¹þ¤ß¤Îµö²Ä¡¦ÉÔµö²Ä¤ÎÀÚÂزÄǽ
¤³¤¦¤¹¤ì¤Ð¡¢Á°¤Î¼õ¿®³ä¤ê¹þ¤ß¤ÎÌäÂê¤ò²ò·è¤Ç¤¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
º£¹¹¤Ê¤¬¤é¡¢¤â¤¦°ìÅÙPSoC¤ÎUARTÄÌ¿®¤Ë¤Ä¤¤¤Æ¡¢»î¤·¤Æ¤ß¤è¤¦¤È»×¤¦¡£
¼«Ê¬¤Ø¤ÎÈ÷˺Ͽ¡£
3e¤Ç¤¢¤ë¡È¡ä¡É¤ò¼õ¿®¤¹¤ë¤Þ¤Ç¡¢·«¤êÊÖ¤·cGetChar¤Ç¼è¤ê¹þ¤à¤È¤¤¤¦¥×¥í¥°¥é¥à¡£
char Receive_Data; while((Receive_Data = UART_PC_cGetChar()) != 0x3e ){ // ">" de nainara UART_PC_PutChar(Receive_Data); }
¤·¤Ð¤é¤¯Æ°¤«¤Ê¤«¤Ã¤¿¤¬¡¢¤É¤¦¤ä¤é¸¶°ø¤Ï¡¢
UART_PC_IntCntl(UART_PC_ENABLE_RX_INT); // Enable RX interrupts
¤¬Æþ¤Ã¤Æ¤¤¤¿¤¿¤á¤é¤·¤¤¡£
Á°¤ËÀèÀ¸¤Ëʹ¤¤¤¿¤³¤È¤¢¤Ã¤¿¤Î¤Ë¡¢Ëº¤ì¤Æ¤¤¤¿¡£¡£(´À
cGetChar¼«ÂΤÏRX¤Î³ä¤ê¹þ¤ß¤ò»È¤Ã¤Æ¤¤¤Ê¤¤¤Î¤Ç¡¢¥³¥á¥ó¥È¥¢¥¦¥È¤·¤Ê¤¤¤È¤¤¤±¤Ê¤¤¤ß¤¿¤¤¡£
¤È¤¤¤¦¤³¤È¤Ï¡¢szGetParam¤È¤«¤È°ì½ï¤Ë»È¤¦»þ¤Ë¤Ï¡¢
¤½¤ÎÅÔÅÙÀÚÂؤ¬É¬ÍפʤΤ«¤Ê¡£
UARTÄÌ¿®¤Î¥µ¥ó¥×¥ë¥×¥í¥°¥é¥à¤Ï¡¢
¥³¥Þ¥ó¥É¤òÆþÎϤ·¤Æ¡¢¥³¥Þ¥ó¥É¤È¥Ñ¥é¥á¡¼¥¿¤òʬΥ¤¹¤ë¤è¤¦¤Ê¥×¥í¥°¥é¥à¡£
¤³¤ì¤òÉáÄ̤Îʸ»úÎó¤ò¼è¤ê¹þ¤à¥×¥í¥°¥é¥à¤Ë¤·¤Æ¤ª¤¤¿¤¤¡£
char *strPtr; UART_PC_CPutString("\r\nWelcome to PSoC UART test program. V1.1 \r\n"); while(1){ if(UART_PC_bCmdCheck()){ while(strPtr = UART_PC_szGetParam()) { // loop on each parameter UART_PC_CPutString(" <"); UART_PC_PutString(strPtr); // Print each parameter UART_PC_CPutString(">\r\n"); } } UART_PC_CmdReset(); // Reset command buffer }
¤³¤ì¤¬²¿¸Î¤«¤¦¤Þ¤¯Æ°¤«¤Ê¤¤¡£¡£
¤Û¤È¤ó¤É¥µ¥ó¥×¥ë¤ÈƱ¤¸¤Ê¤ó¤À¤±¤É¤Ê¡¢¡¢
¤Á¤ç¤Ã¤È¥×¥í¥°¥é¥àÊѤ¨¤¿¤é¡¢°ÕÌ£ÉÔÌÀ¤Ê¥¨¥é¡¼¤¬ÂçÎ̤˽ФƤ¤¿¡£
ñ½ã¤Ê¥ß¥¹¤À¤±¤É¡¢¤¹¤´¤¯È¯¸«¤·¤Å¤é¤¤¡£¡£
PSoC¤Î¥¨¥Ç¥£¥¿¤Ï¡¢¸«¤Å¤é¤¤¤Î¤Ç¡¢Â¾¤Î¥¨¥Ç¥£¥¿¤ÇºîÀ®¤¹¤ë¤È¤¤¤¦¤Î¤â
¤¢¤ê¤«¤â¤·¤ì¤Ê¤¤¡£
º£Ç¯¤Î¾ðÊó¶¦ÍÊýË¡¤Ï¡¢Wiki¤Ë¤¹¤ë¤³¤È¤Ë¤·¤Þ¤·¤¿¡£
MeRLWiki¤Ç»È¤¤´·¤ì¤Æ¤¤¤ë¤È¤¤¤¦¤³¤È¤â¤¢¤ë¤·¡£
¤É¤³¤Þ¤Ç¿»Æ©¤¹¤ë¤«¤Ê¡Á¡Á