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


Browsing this Thread:   1 Anonymous Users






Re: 24LC32 Page Write......
#8
版主
版主


查看用戶資訊
以下程式僅供參考:

//***********************************************
//*         EEPROM Acknowledge Polling          *
//*   --  The routine will polling the ACK        *
//*       response from EEPROM                   *
//*   --  ACK=0 return                             *
//*      --  ACK=1 send Restart & loop check        *
//***********************************************
void EEPROM_ACK(unsigned char ctrl)
{
    
int i;

    
IdleI2C();                         // ensure module is idle
      
StartI2C();                        // Start condition
    
I2C_Done();                        // Wait Start condition completed

    
WriteI2C(ctrl);                    // Write Control to EEPROM (WRITE)
    
I2C_Done();                        // Clear SSPIF flag

    
while (SSPCON2bits.ACKSTAT)        // test for Acknowledge from EEPROM
    
{
        for (
i=0;i<100;i++);        // Delay for next Repet-Start

          
RestartI2C();                  // initiate Repet-Start condition
        
I2C_Done();                   // Wait Repet-Start condition completed

        
WriteI2C(ctrl);                // Write Control to EEPROM (WRITE)
    
}
    
I2C_Done();                     // Clear SSPIF flag 
       
    
StopI2C();                      // send STOP condition
    
I2C_Done();                        // wait until stop condition is over 
}
//***********************************************
//*   Check I2C action that is completed        *
//***********************************************
void I2C_Done(void)
{
    while (!
PIR1bits.SSPIF);        // Completed the action when the SSPIF is Hi.
    
PIR1bits.SSPIF=0;               // Clear SSPIF
}

發表於: 2005/10/14 17:59
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 24LC32 Page Write......
#7
中級會員
中級會員


查看用戶資訊
版大~~~
針對Polling的部份~~~
我還是有些疑惑~~~
就Data Sheet上來看~~~
Polling的方式如下:
1.Send Write Command
2.Send Stop Condition
3.Send Start
4.Send Control Byte
5.Check ACK
6.Next

我想問的是
1.1,2的步驟有什麼樣的目的???
2.在第1個步驟之前要Send Start嗎???
3.Send Write Command是要下什麼樣的Command
Byte Write就可以了嗎???
4.Send Control Byte完要先Check ACK之後才能送資料???
5.是否只要有ACK的部份都要先做Polling確認???(包含Word Address之後)
以上請版大或其他高手不吝指教!~~~
謝謝~~~

發表於: 2005/10/14 17:06
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 24LC32 Page Write......
#6
版主
版主


查看用戶資訊
應該說每次寫資料到 EEPROM 之前都要檢查EEPROM是否Ready?
也就是說 Acknowledge 的 Polling 是一定要做的不可省略。

發表於: 2005/10/14 15:24
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 24LC32 Page Write......
#5
中級會員
中級會員


查看用戶資訊
果然Delay一段時間即可以寫入~~~
我想請問一下~~~
有關ACK Polling的寫法~~~
是要在第一次寫入32 Byte,Stop I2C之後~~~
第二次寫入之前做Polling嗎???
是否之要Check ACKSTAT即可???
謝謝~~~

發表於: 2005/10/14 8:54
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 24LC32 Page Write......
#4
資深會員
資深會員


查看用戶資訊
要寫入第二批的話
記得要延遲一段時間再寫入下一批
不然就偵測他是否忙碌中
否則資料會寫不進去

發表於: 2005/10/13 13:25
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 24LC32 Page Write......
#3
中級會員
中級會員


查看用戶資訊
了解了~~~
我再試試看連續Page Write的方式~~~
謝謝版大的回覆~~~

發表於: 2005/10/13 11:55
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 24LC32 Page Write......
#2
版主
版主


查看用戶資訊
24LC32A 內建的 Page Write Buffer 只有 32 Bytes, 所以page write 一次最多可以寫入 32 Bytes, Page Write 可以少但超過32Bytes 就要分次寫入。

發表於: 2005/10/13 11:47
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


24LC32 Page Write......
#1
中級會員
中級會員


查看用戶資訊
請問一下~~~
24LC32 Page Write一次只能寫入32 Byte~~~
可否一次寫入64 Byte???
謝謝~~~

發表於: 2005/10/13 11:27
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... ]

教育訓練中心

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