• slider image 514
  • slider image 516
  • slider image 517
  • slider image 518
  • slider image 519
:::


Browsing this Thread:   1 Anonymous Users






Re: APP001實驗版使用I2C傳輸的問題
#4
新會員
新會員


查看用戶資訊
Hi 你好,我也是碰到一樣的問題,讀出來都是 0xFF。請問你說送兩次位址是什麼意思呢?是 Read 的時候嗎?

發表於: 2008/11/27 10:53
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: APP001實驗版使用I2C傳輸的問題
#3
中級會員
中級會員


查看用戶資訊
Hi ALL
知道原因了
因為跟EEPROM的位址跟MANUAL講的不一樣
不是A0而是AE
還有因為是新版的APP001 REV2
所以...必須送兩次位址....
以上便是測試的結果...

發表於: 2007/3/29 10:22
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: APP001實驗版使用I2C傳輸的問題
#2
中級會員
中級會員


查看用戶資訊
我利用以下的程式片段,去看示波器是不是有訊號,可以看出SDA與SCL的腳位都有再變動,但是在讀取的時候,跑出的結果是不對的。我想會有資料在跑的原因是,我沒有讓程式等待ACK,但是若要等待ACK,程式又HOLD住。不知道有沒有高手有任何IDEA。
使用的MCU是18F452,參照的檔案是W401C ANS 6-2
這個測試結果,不管是有沒有將J10 的1-2 與3-4相接,結果是一樣的。所以我在想是不是EEPROM沒有作動啊
我已經照著SPEC送了兩次位址啦,實在是想不太出來到底是哪邊出了錯誤。

switch(Key_Press)
{
case 1:
LCD_Set_Cursor(0,0);
putrsLCD(" ");
LCD_Set_Cursor(1,0);
putrsLCD(" ");
LCD_Set_Cursor(0,0);
putrsLCD(LCD_MSG3);
LCD_Set_Cursor(1,0);
putrsLCD("1");
IdleI2C(); // ensure module is idle
StartI2C(); // Start condition
//I2C_Done();// Wait Start condition completed and clear SSPIF flag
WriteI2C(0xA0); // Write Control+Write to EEPROM & Check BF flag
//I2C_Done(); // Wait Start condition completed and clear SSPIF flag
WriteI2C(0x00); // Write Control+Write to EEPROM & Check BF flag
//I2C_Done(); // Wait Start condition completed and clear SSPIF flag
WriteI2C(0x00); // Write Control+Write to EEPROM & Check BF flag
//I2C_Done(); // Wait Start condition completed and clear SSPIF flag
WriteI2C('A'); // Write Control+Write to EEPROM & Check BF flag
//I2C_Done(); // Wait Start condition completed and clear SSPIF flag
StopI2C(); // Stop condition
I2C_Done(); // Wait the Stop condition completed
break;

case 2:
LCD_Set_Cursor(0,0); // Put LCD Cursor on Line 1
putrsLCD(" ");
LCD_Set_Cursor(1,0); // Put LCD Cursor on Line 1
putrsLCD(" ");
LCD_Set_Cursor(0,0); // Put LCD Cursor on Line 1
putrsLCD(LCD_MSG3);
LCD_Set_Cursor(1,0); // Put LCD Cursor on Line 1
putrsLCD("2");
IdleI2C(); // ensure module is idle
StartI2C(); // Start condition
//I2C_Done(); // Wait Start condition completed
WriteI2C(0xA0); // Write Control to EEPROM
//while(SSPCON2bits.ACKSTAT); // test for ACK condition, if received
//I2C_Done(); // Clear SSPIF flag
WriteI2C(0x00); // Write Address to EEPROM
//while(SSPCON2bits.ACKSTAT); // test for ACK condition, if received

//I2C_Done(); // Clear SSPIF flag

//RestartI2C(); // initiate Restart condition
WriteI2C(0x00); // Write Address to EEPROM
//while(SSPCON2bits.ACKSTAT); // test for ACK condition, if received
//I2C_Done(); // Clear SSPIF flag
RestartI2C();
//I2C_Done();
WriteI2C(0xA1); // Write Control to EEPROM
//while(SSPCON2bits.ACKSTAT); // test for ACK condition, if received
//I2C_Done(); // Clear SSPIF flag
f=ReadI2C(); // Enable I2C Receiver & wait BF=1 until received data
//I2C_Done(); // Clear SSPIF flag
NotAckI2C(); // Genarate Non_Acknowledge to EEPROM

// while ( SSPCON2bits.ACKEN ); // wait until ACK sequence is over
// I2C_Done();
StopI2C(); // send STOP condition

I2C_Done(); // wait until stop condition is over
break;
}

發表於: 2007/3/28 17:29
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


APP001實驗版使用I2C傳輸的問題
#1
中級會員
中級會員


查看用戶資訊
各位大大,我試著使用W401 C18 Workshop裡面的 ANS 6-2
的I2C程式想要來玩玩I2C的模式。
可是很奇怪,好像寫不進去,所以在讀取的時候全部讀到的值都是0XFFFF,導致我LCD都變成顯示那個資料。
我已經把 JUMP 10改成 1-2,3-4啦!
還有哪邊要做更動嗎
我所使用的是PIC18F452
我還需要作哪些設定嗎
麻煩有經驗的大大請告知....

我是著使用ICD2 去抓看程式HOLD在哪邊
發現在送出CTRL的訊號時
while(SSPCON2bits.ACKSTAT); // wait until received the Acknowledge from EEPROM
這裡便被HOLD住了,我想就算是EEPROM是24LC32A的原因也不該再送出CTRL就掛掉了。
題外話,範例裡的ADDR只有送一次,但是我看了EEPROM的SPEC,他需要12BIT的ADDRESS,這是不是代表我應該要送兩次ADDR啊,但這個問題應該是要能夠成功的送資料為前提。
不知道有沒有高手可以回答啊~~~~

發表於: 2007/3/27 16:01
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... ]

教育訓練中心

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