• 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: 請問一下我用51去讀寫24LC64為啥不能寫第2 BYTE
#3
新會員
新會員


查看用戶資訊
謝謝板主指導

但是我是使用PAGE WRITE 的方式寫3 BYTE阿,讀的時候只能讀到第一BYTE 的值,其餘後面兩BYTE都讀不到 還是我需要將其ACK信號拉為LOW呢
請給我指導
謝謝

下面是我目前寫的程式!

reg1=0x05,reg2=0x00,reg3=0x01;
reg4=0xaa,reg5=0x5a,reg6=0x55;

I2CS();

I2CW(reg1);

I2CW(reg2);

I2CW(reg3);

I2CW(reg4);

I2CW(reg5);

I2CW(reg6);

I2CP();
delay1ms(),delay1ms(),delay1ms(),delay1ms();
I2CS();
reg1=0x05,reg2=0x00,reg3=0x01;
reg4=0xaa,reg5=0x5a,reg6=0x55;
I2CW(reg1);
I2CW(reg2);
I2CW(reg3);
I2CS();
reg1=0x85;
I2CR(reg1);

ACKN(1);
I2CP();

void I2CW(char va21)
{
int i;
RESTN=1;
for(i=0;i<8;i++,va21>>=1){
if(va21&1) {
DAT=1;
}else {
DAT=0;
}
delay(10);

CLK=1;
delay(5);
CLK=0;
delay(8);
}

CLK=1;
delay(5);
CLK=0;
delay(5);
}

void I2CR(char va31)
{
int i;
RESTN=1;
EA=0;
delay(1);
for(i=0;i<8;i++,va31>>=1){
if(va31&0x1) {
DAT=1;
}else {
DAT=0;
}
delay(5);
CLK=1;
delay(5);

CLK=0;
delay(5);

}

CLK=1;
delay(5);
CLK=0;
delay(50);
}
void delay(int tm)
{
while (tm--);
}

void delay1ms(void)
{
int i;
for (i=0;i<1000;i++)
{
_nop_();
}

}

void ACKN(Bool ack)
{
DAT=1;
DAT=ack;
CLK=1;
delay(5);
CLK=0;
}

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


Re: 請問一下我用51去讀寫24LC64為啥不能寫第2 BYTE
#2
版主
版主


查看用戶資訊
有可能寫下一個 Byte 之前,你沒有去 Polling ACK bit 導致下一個 Byte 無法被寫入。

80C51 access the I2c EEPROM code as below:

http://www.microchip.com/stellent/idc ... eId=1824&appnote=en011156

發表於: 2005/11/23 17:41
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


請問一下我用51去讀寫24LC64為啥不能寫第2 BYTE
#1
新會員
新會員


查看用戶資訊
請問一下
PS:下面是我用示波器量出來的波形概述

我要寫3筆資料進去時,再第一筆資料時有回傳ACK訊號拉HIGH約 5US 後拉LOW,後面兩筆資料寫完都不會拉HIGH接著
我就下STOP 信號,延遲 5 mS 後再開始並下adreess 讀取,可是只讀取到第一筆資料,後面兩筆都被拉為high信號!

請各為老手給我指導一下

發表於: 2005/11/23 12:00
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... ]

教育訓練中心

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