• slider image 442
  • slider image 492
  • slider image 493
  • slider image 494
  • slider image 495
  • slider image 496
:::


Browsing this Thread:   1 Anonymous Users






有關使用P18F452使用I2C要丟多筆資料問題
#1
初級會員
初級會員


查看用戶資訊
我寫程式的方法很蠢請教各位大大,希望能多傳授點經驗
我希望從master送出多筆資料,每個slave PIC至少要接收到32筆資料,我定址了32個暫存器給slave,希望將master傳過來的32筆資料丟至這32個暫存器裡。
單筆資料傳輸都沒問題
我現在遇到一個大問題,slave接收資料都是在中斷接收的,我利用一個自訂的Check_Recive暫存器當作判斷,Check_Recive這存器在等待中斷之前的bit0我設1,中斷裡我設0,但我發現竟然不能L1->L2->L3->L4一筆一筆的放資料,而變成了L1,L2->L3,L4->L5,L6->........->L31,L32,我有用了Debug mode去test過的確有進去單數的L迴圈,但程式竟然不理我的 movff I2C_Data,Status_1 ,L2迴圈直接skip執行下去.....

也就是我實際要有32次中斷,但只有 16次中斷

而如果不用btfsc直接用goto $ 測試是可以有32次中斷接到正確資料
我有考慮用DB的方式收資料,各位大大可以幫我解惑嗎,進度卡了好久了>"<
或是各位大大有沒有什麼更好的方式讓多筆資料接收呢?

程式片斷:
bsf Check_Recive,0
L1 btfsc Check_Recive,0,0
bra L1
movff I2C_Data,Status_1
bsf Check_Recive,0
L2 btfsc Check_Recive,0,0
bra L2
movff I2C_Data,Status_2
bsf Check_Recive,0
L3 btfsc Check_Recive,0,0
bra L3
movff I2C_Data,Status_3
bsf Check_Recive,0

發表於: 2006/4/13 0:38
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... ]

教育訓練中心

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