• slider image 442
  • slider image 477
  • slider image 479
  • slider image 480
  • slider image 481
  • slider image 482
:::


Browsing this Thread:   1 Anonymous Users






Re: 為何SSP2CON2bits.ACKEN = 1; 不會自動清除?
#3
資深會員
資深會員


查看用戶資訊
謝謝.了解.

發表於: 2020/10/22 9:52
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 為何SSP2CON2bits.ACKEN = 1; 不會自動清除?
#2
版主
版主


查看用戶資訊
I2C Master 回給 Slave 的 ACK 訊號是設定 ACKEN 位元後即可,我也都是這樣用的。但是我式檢查 SSPIF 中斷旗號來判定工作是否完成。可以參考一下貼圖,
最好是再用示波器量測一下 SCK 在設定 ACKEN = 1 時是否有產生第九個 clock 給 Slave。

void AckI2Cvoid )
{
  
ACKDT 0;           // set acknowledge bit state for ACK
  
ACKEN 1;           // initiate bus acknowledge sequence
}

void NotAckI2Cvoid )
{
  
ACKDT 1;          // set acknowledge bit for not ACK
  
ACKEN 1;          // initiate bus acknowledge sequence
}

void I2C_Done(void)
{
    while (!
SSPIF);            // Completed the action when the SSPIF is Hi.
    
SSPIF=0;                   // Clear SSPIF
}

Attach file:



jpg  擷取.JPG (36.81 KB)
16_5f8fd11b3aa24.jpg 680X282 px

發表於: 2020/10/21 14:11
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


為何SSP2CON2bits.ACKEN = 1; 不會自動清除?
#1
資深會員
資深會員


查看用戶資訊
Dear All :

if(ack) SSP2CON2bits.ACKDT = 0;
else SSP2CON2bits.ACKDT = 1;
SSP2CON2bits.ACKEN = 1;
while(SSP2CON2bits.ACKEN) CLRWDT(); //當在這!!!

但datasheet說硬體會自動清除的!

Thank u.

發表於: 2020/10/20 16:25
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... ]

教育訓練中心

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