• slider image 514
  • slider image 516
  • slider image 517
  • slider image 518
  • slider image 519
:::


Browsing this Thread:   1 Anonymous Users






請教一個CAN的問題
#1
初級會員
初級會員


查看用戶資訊
請教各位先進,我在使用C30 Library撰寫CAN Function遭遇到一個問題。
我需要從CAN BUS上讀取兩個ID的資料,其ID分別為0x0b9 及0x0bc,並使用CAN1SetFilter function

CAN1SetFilter ( (char) 0 , CAN_FILTER_SID( 0x0b9 ) & CAN_RX_EID_DIS ,CAN_FILTER_EID( 0x00 )) ;

CAN1SetFilter ( (char) 1 , CAN_FILTER_SID( 0x0bc) & CAN_RX_EID_DIS ,CAN_FILTER_EID( 0x00 )) ;

由於,此function第一個引數為filiter no. 於是我選擇RXF0 與RXF1,而這兩個filiter都會將ID分別為0x0b9 及0x0bc的資料放進去RXB0的Buffer裡。於是我在主程式所撰寫的取出資料程式如下

if(CAN1IsRXReady(0)) //receieve from buffer0
{
CAN1ReceiveMessage( RxData,8,0 );
data1 = RxData[0] ;
data2 = RxData[1] ;
.....

C1RX0CONbits.RXFUL=0;
}
因為資料都是在RXB0,而我又有兩個ID的資料要讀出來,這樣在讀取的時候要如何做判斷現在是哪一個ID的資料??
請各位先進幫幫我解決這疑問,拜託了!!謝謝~

發表於: 2009/10/14 14:18
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... ]

教育訓練中心

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