• 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: 讀取PORT的狀態一問
#4
高級會員
高級會員


查看用戶資訊
謝謝各位的回應~~~

發表於: 2005/5/16 12:10
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 讀取PORT的狀態一問
#3
版主
版主


查看用戶資訊
MPLAB C18 與 Hi-Tech PICC 都有提供 bit member 的功能,你可以將數個連續的位元組成一個變數直接使用,其範例如下:

#pragma udata access My_RAM_2
union
{
    
unsigned int AD_10bit;    // contant is 10-bit A/D Result
        
unsigned char AD[2];      // AD[0] is A/D Low byte, AD[1] is A/D High Byte
    
struct{
            
unsigned b0:1;
            
unsigned b1:1;
            
unsigned bn:2;  // 定義使用兩個位元為變數
            
unsigned b4:1;
            
unsigned b5:1;
            
unsigned b6:1;
            
unsigned b7:1;
        }
abc;
near AD_Result;
#pragma udata

if (AD_Result.abc.bn==0x02)
{ ....
}


發表於: 2005/5/16 8:52
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 讀取PORT的狀態一問
#2
資深會員
資深會員


查看用戶資訊
可以用程式來達成,例如:目前你用讀取單個IO的方式,你可以改用讀取整個PORT再來判斷.

發表於: 2005/5/15 21:22
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


C18 讀取PORT(2-bit以上) 的方法 一問
#1
高級會員
高級會員


查看用戶資訊
請問各位前輩:不知道有什麼方法單獨讀取PORT腳位2 個BIT的狀態而不影響其他腳位

例如:讀取PORTBbits.RB3和PORTBbits.RB4時會用
if(PORTBbits.RB3==1&&PORTBbits.RB4==1)
但有沒有方法讓程式不用做&&運算就知道RB3和RB4的狀態~~~

發表於: 2005/5/15 0:25
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... ]

教育訓練中心

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