初級會員
Joined
: 2005/8/10 23:20 最後登入時間
: 2006/10/16 12:32
Group:
註冊會員
Level : 3 HP : 0 / 57 MP : 7 / 3230 EXP : 31
|
我寫程式的方法很蠢請教各位大大,希望能多傳授點經驗 我希望從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
|