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

論壇索引


Board index » All Posts (tamashi131)




PIC24FJ1024GB610 SMbus/I2C 問題
#1
新會員
新會員


[size=x-small]各位先進好
我使用MCC的I2C 去寫
程式碼如下 LA看到想寫的data 並沒有輸出 我有遺漏的部分嗎?

uint16_t Start_Address = 0x0B;
uint8_t MNFnameCom[5] = { 0xFF ,0x03 ,0xA9 , 0x00 , 0x10 };
uint8_t MNFname[16] = { 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00};


int main(void){
// initialize the device
SYSTEM_Initialize();
while (1)
{
// SMBus Write
#define SLAVE_I2C_GENERIC_RETRY_MAX 100
#define SLAVE_I2C_GENERIC_DEVICE_TIMEOUT 50
// initialize the module
I2C1_Initialize();
uint16_t timeOut;

timeOut = 0;

//I2C1_MasterWrite(MNFnameCom, sizeof(MNFnameCom) ,
Start_Address , &status);
while(status != I2C1_MESSAGE_FAIL)
{
I2C1_MasterWrite(MNFnameCom, 5 , Start_Address , &status);

while(status == I2C1_MESSAGE_PENDING);
if (status == I2C1_MESSAGE_COMPLETE) break;
if (timeOut == SLAVE_I2C_GENERIC_RETRY_MAX)
break;
else
timeOut++;
}
// SMBus Read
I2C1_MasterRead(MNFname ,sizeof(MNFname) ,Start_Address , &status);

}
}
LA訊號如附檔 address 有輸出但想寫的data都沒輸出

Attach file:



jpg  (0.00 KB)


jpg  (0.00 KB)


發表於: 2020/6/1 18:11
頂部


Re: Mplab X IDE 除錯mode & 燒錄問題
新會員
新會員



發表於: 2020/1/16 14:24
頂部



(1) 2 »



:::

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... ]

教育訓練中心

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