Browsing this Thread:
1 Anonymous Users
Topic options
View mode
舊的在前
Re: I2C, Start condition 問題
高級會員
Joined
: 2006/11/15 20:51最後登入時間
: 2008/3/31 14:29
Group:
註冊會員
Level : 11
HP : 0 / 257
MP : 50 / 13470
EXP : 30
參考看看: Wait_IIC: banksel PIR1 btfss PIR1,SSPIF goto $-1 bcf PIR1,SSPIF return 這段應該是在等I2C MODULE IDLE,或許你可以改變程式寫法,換成去偵測下面所說的這些BIT(擷取DATASHEET P.68), Note: For bits ACKEN, RCEN, PEN, RSEN, SEN: If the I2C module is not in the IDLEmode, this bit may not be set (no spooling), and the SSPBUF may not be written (or writes to the SSPBUF are disabled). <補充>你使用這方法也可以,不過你先確認你的INTERRUPT是否有開啟,在去偵測START CONDITION產生後中斷旗標變化情形。
發表於: 2007/6/22 11:08
I2C, Start condition 問題
新會員
Joined
: 2005/9/25 22:32最後登入時間
: 2007/6/20 21:11
Group:
註冊會員
Level : 1
HP : 0 / 5
MP : 1 / 303
EXP : 21
小弟使用16F877, 用MPLAB寫組言 在使用I2C作傳輸; I2C一開始的Stat condition 時, 寫法如下 Start_IIC: banksel SSPCON2 bsf SSPCON2,SEN call Wait_IIC return 再來則會呼叫Wait_IIC, 寫法如下 Wait_IIC: banksel PIR1 btfss PIR1,SSPIF goto $-1 bcf PIR1,SSPIF return 1. 使用軟體MPLAB SIM模擬結果, 卻發生一直偵測SSPIF, 不是為"1"的狀態 2. 改為用硬體模擬MPLAB ICD2, 還是發生一樣的情況! 實在想不出為什麼, 請問各位大大, 有沒有想法可以分享一下! 謝謝
發表於: 2007/6/20 21:12
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.