• slider image 442
  • slider image 497
  • slider image 498
  • slider image 499
  • slider image 500
  • slider image 502
:::


Browsing this Thread:   1 Anonymous Users






Re: 請問picc設定i/o 可以1pin,1pin的設定嗎?
#4
版主
版主


查看用戶資訊
Read-modify-write 問題,參考一下: http://www.microchip.com.tw/modules/w ... lefile.php?cid=18&lid=303
加個 nop( );

GPIO0 = 1;
nop();
GPIO1 = 0;
nop();
GPIO2 = 0;
delay(20);

GPIO0 = 0;
nop();
GPIO1 = 1;
nop();
GPIO2 = 0;
delay(20);

GPIO0 = 0;
nop();
GPIO1 = 0;
nop();
GPIO2 = 1;
delay(20);

發表於: 2009/9/23 13:57
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問picc設定i/o 可以1pin,1pin的設定嗎?
#3
中級會員
中級會員


查看用戶資訊
請大家指導1下 拜託拜託

發表於: 2009/9/22 8:37
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 請問picc設定i/o 可以1pin,1pin的設定嗎?
#2
初級會員
初級會員


查看用戶資訊
感覺沒錯誤
我也想知道哪裡出問題

發表於: 2009/9/21 8:25
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


請問picc設定i/o 可以1pin,1pin的設定嗎?
#1
中級會員
中級會員


查看用戶資訊
使用12f629

程式1如下,GPIO0,GPIO1,GPIO2,接LED測試
測試結果:LED有001,010,100這樣子跑

#include "pic.h"
__CONFIG ( UNPROTECT & BORDIS & MCLREN & PWRTDIS & WDTDIS & XT );
const char test_mat[]={0x01,0x02,0x04};

void delay(int time)
{
int i;
for(;time>0;time--)
{
for(i=3000;i>0;i--)
;
}
}
void main(void)
{

TRISIO=0X00;//設為輸出
while(1)
{
GPIO = test_mat[0];
delay(20);
GPIO = test_mat[1];
delay(20);
GPIO = test_mat[2];
delay(20);
}
}


程式2如下,GPIO0,GPIO1,GPIO2,接LED測試
測試結果:LED不會照著001,010,100,跑,而是只有000,及100

#include "pic.h"
__CONFIG ( UNPROTECT & BORDIS & MCLREN & PWRTDIS & WDTDIS & XT );
const char test_mat[]={0x01,0x02,0x04};


void delay(int time)
{
int i;
for(;time>0;time--)
{
for(i=3000;i>0;i--)
;
}
}
void main(void)
{

TRISIO=0X00;//設為輸出
while(1)
{
GPIO0 = 1;
GPIO1 = 0;
GPIO2 = 0;
delay(20);
GPIO0 = 0;
GPIO1 = 1;
GPIO2 = 0;
delay(20);
GPIO0 = 0;
GPIO1 = 0;
GPIO2 = 1;
delay(20);
}
}


請問PICC設定IO,只能使用GPIO一次設定所有的IO
不能夠使用GPIO0,GPIO1,GPIO2這樣1PIN,1PIN的設定嗎?

後來在測試發現好像是設GPIO0 = 1;時,GPIO1=1其他IO都變成0
GPIO2=1時,GPIO2=1其他IO都變成0

煩惱了好久,請客位指導1下

發表於: 2009/9/20 22:50
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------