• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::


Browsing this Thread:   1 Anonymous Users






Re: I2C, Start condition 問題
#2
高級會員
高級會員


查看用戶資訊
參考看看:
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
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


I2C, Start condition 問題
#1
新會員
新會員


查看用戶資訊
小弟使用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
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... ]

教育訓練中心

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