Microchip
直播中

杨万富

7年用户 1498经验值
擅长:526774
私信 关注
[问答]

EEPROM的NVM不工作

嗨,我正在努力让我的旧EEPROM代码与新的NVM一起工作。也许模拟器不工作,因为我只是使用MPLABX SIM在MimultuvLB.16VBC.NVMDATL MOVWL0X70 MOVWF NVMADHRBSF NVMCON1,WRN BCF NVMCON1,NVMGRW MOVLW 0X55 MOVWF NVMCON2 MOVLW 0XAA MOVWF NVMCON2 BSF NVMCON1,WR;BCF NVMCON1,WRN BSF ITCCON,GEEBTFSC NVMCON1,WR文胸$-1CIFF NVMADRL,1MOVLB 0ReSTORIT从未突破NVMCON1,WR环路。我想也许我在NVMADRH的地址是0x70错了吗??

以上来自于百度翻译


      以下为原文

    Hi,

I'm struggling to get my old EEPROM code to work with the new NVM.  Maybe the simulator does not work as I'm only using the MPLABX sim at the moment

movlb .16
bcf INTCON,GIE
movwf NVMDATL

movlw 0x70
movwf NVMADRH
bsf NVMCON1,WREN
bcf NVMCON1,NVMREGS
movlw 0x55
movwf NVMCON2
movlw 0xAA
movwf NVMCON2
bsf NVMCON1,WR
;bcf NVMCON1,WREN
bsf INTCON,GIE
btfsc NVMCON1,WR
bra $-1
incf NVMADRL,1
movlb 0
return

It never breaks out of the NVMCON1,WR loop.  I thought maybe I have the address wrong 0x70 in NVMADRH??

回帖(8)

陈晨

2019-3-18 14:47:25
没有评论,这是什么照片。

以上来自于百度翻译


      以下为原文

    No comments and which pic is this for.
举报

王焕树

2019-3-18 15:00:11
和“胸罩1美元”是特别危险的一个未知的处理器…使用标签,他们是便宜的!

以上来自于百度翻译


      以下为原文

    and "bra $-1" is particularly risky with an unknown processor...
Use labels, they're cheap!
 
举报

h1654155275.5714

2019-3-18 15:10:38
它是PIC16F1887,但模块在所有图片上都是相同的。当你只返回一行时,我看不到使用带有胸罩指令的标签的价值。它肯定会组装相同的。它是MPLABX SIM吗?就是这个,或者我没有把它指向正确的EEADRH:L地址,或者我无意中试图给PGM写信或某事:

以上来自于百度翻译


      以下为原文

    It's a PIC16F18857 but the module is the same on all PICs.
 
I don't see the value in using a label with a bra instruction when you're only going back one line.  It will certainly assemble the same.
 
Could it be the MPLABX sim?  It's that or I haven't got it pointing at the right EEADRH:L address or I'm inadvertantly trying to write to the PGM or something :/
举报

王焕树

2019-3-18 15:28:26
当你移动到一个PIC18部分时,它会尝试跳转到一个奇怪的地址,这是永远不会发生的。我同意,它组装起来是一样的,但是对其他程序员来说是很难阅读的,并且属于“不使用魔法数”的经验法则。你会尝试写程序存储器,因为你。清除NVMGREST位。设置它访问EEPROM。

以上来自于百度翻译


      以下为原文

   
And when you move up to a PIC18 part, it will try to jump to an odd address, which is never-never land.
I agree, it assembles the same, but it's hard for other programmers to read, and falls under the "don't use Magic numbers" rule of thumb.
 

You WILL be trying to write to program memory, because you cleared the NVMREGS bit. Set it to access EEPROM.
 
举报

更多回帖

发帖
×
20
完善资料,
赚取积分