Browsing this Thread:
1 Anonymous Users
|
Re: 請問有關PORT設定問題....
|
|
版主
Joined
: 2004/4/30 10:53 最後登入時間
: 2021/11/30 18:11
From CAE, Microchip
Group:
站務管理者 註冊會員
Level : 75 HP : 744 / 1861 MP : 5367 / 108971 EXP : 45
|
你只要單獨設定 RA4 為 output 就好了。
TRISAbits.TRISA4=0; //這樣就好了
底下是p18f2550.inc對TRISA的宣告: 建議看看右邊教育訓練裡的 W401 C18 workshop 這樣對你是有幫助的。
extern volatile near unsigned char TRISA; extern volatile near struct { unsigned TRISA0:1; unsigned TRISA1:1; unsigned TRISA2:1; unsigned TRISA3:1; unsigned TRISA4:1; unsigned TRISA5:1; unsigned TRISA6:1; } TRISAbits;
發表於: 2005/7/20 21:00
|
|
|
請問有關PORT設定問題....
|
|
新會員
Joined
: 2005/8/19 22:22 最後登入時間
: 2005/8/19 22:22
Group:
註冊會員
Level : 2 HP : 0 / 28 MP : 3 / 1545 EXP : 12
|
各位高手好... 小弟我有一些問題...煩請賜教..
我用的是PIC18F2550....
我把PortA的RA0~RA3,RA5用來做A/D轉換的Input 但是我需要用RA4來當一般I/O...
而要把RA4當一般I/O時(輸出Hi or Lo)...需下:
TRISA = 0; //設定PortA為輸出...
但當我執行完上述指令後...RA0~RA3,RA5就被當成一般I/O...
請問我該如何設定這些Port呢..?...煩請賜教
還有...就是一開始 #include <p18cxxx.h> 組譯後 應該會對整個Controller做設定(包含Port)... 請問是這樣嗎..?
發表於: 2005/7/20 16:47
|
|
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.