• 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: 關於pic16f18857使用ideX的mcc合成出的eeprom指令無法使用...
#4
新會員
新會員


查看用戶資訊
非常感謝您,經過測試可以編譯了,真的是幫了大忙!

發表於: 2022/12/19 8:23
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於pic16f18857使用ideX的mcc合成出的eeprom指令無法使用...
#3
新會員
新會員


查看用戶資訊
好的我會嘗試,非常感謝您的回覆

發表於: 2022/12/15 12:57
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 關於pic16f18857使用ideX的mcc合成出的eeprom指令無法使用...
#2
管理員
管理員


查看用戶資訊
xsz1183 你好,PIC16F18857 於程式中透過 File Select Registers (FSR) 來存取 EEPROM,詳細的使用方式和對應的記憶體位址可以參考Datasheet中的內容,如下圖:
縮圖

縮圖

並透過 Indirect Addressing 的方式來訪問實際的記憶體,可以參考Datasheet中的「3.5 Indirect Addressing」章節。

根據程式碼可以修改為 「uint16_t dataeeAddr = 0x7010; 」即可讀寫EERPOM中的0xF010位址的記憶體內容。

Attach file:



jpg  PIC16F18857_EEPROM_01.jpg (111.07 KB)
123092_638ecdc5eff05.jpg 463X410 px

jpg  PIC16F18857_EEPROM_02.jpg (176.50 KB)
123092_638ecdd3a3868.jpg 989X687 px

發表於: 2022/12/6 13:04

Edited by KevinLu on 2022年12月06日 13:43:11
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


關於pic16f18857使用ideX的mcc合成出的eeprom指令無法使用...
#1
新會員
新會員


查看用戶資訊
感謝大家點進來想要幫忙,小弟我是microchip的新手,公司需要長期使用該pic16f18857 mcu長期開發...
目前 接收端需要使用eeprom,來儲存發射的ID,跟目前的馬達角度...
但是我發現EEPROM不管怎麼使用都會報錯...
以下是我的程式內容
main裡面內容{
uint16_t dataeeAddr = 0xF010;
uint8_t dataeeData = 0x55;
DATAEE_WriteByte(dataeeAddr, dataeeData);
//-------------------------------------------------------------------------------------
uint16_t dataeeAddr = 0xF010;
uint8_t readData;

readData = DATAEE_ReadByte(dataeeAddr);
}


mcc合成的eeprom程式如下

void DATAEE_WriteByte(uint16_t bAdd, uint8_t bData)
{
uint8_t GIEBitValue = INTCONbits.GIE;

NVMADRH = ((bAdd >> 8) & 0xFF);
NVMADRL = (bAdd & 0xFF);
NVMDATL = bData;
NVMCON1bits.NVMREGS = 1;
NVMCON1bits.WREN = 1;
INTCONbits.GIE = 0; // Disable interrupts
NVMCON2 = 0x55;
NVMCON2 = 0xAA;
NVMCON1bits.WR = 1;
// Wait for write to complete
while (NVMCON1bits.WR)
{
}

NVMCON1bits.WREN = 0;
INTCONbits.GIE = GIEBitValue; // restore interrupt enable
}

uint8_t DATAEE_ReadByte(uint16_t bAdd)
{
NVMADRH = ((bAdd >> 8) & 0xFF);
NVMADRL = (bAdd & 0xFF);
NVMCON1bits.NVMREGS = 1;
NVMCON1bits.RD = 1;
NOP(); // NOPs may be required for latency at high frequencies
NOP();

return (NVMDATL);
}





完全照著mcc的範例搬上去結果無法使用,請問該怎麼修改呢?

發表於: 2022/12/2 17:10
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... ]

教育訓練中心

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