完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我正在努力让我的旧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个回答
|
|
|
|
|
|
和“胸罩1美元”是特别危险的一个未知的处理器…使用标签,他们是便宜的!
以上来自于百度翻译 以下为原文 and "bra $-1" is particularly risky with an unknown processor... Use labels, they're cheap! |
|
|
|
它是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 :/ |
|
|
|
当你移动到一个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. |
|
|
|
如果你适合C代码,你将能够在ASM中进行翻译。主要的区别是你必须设置“NVMGRESs”和EEPRON.NVMCON1.NVMGLES的“新”PIC:配置选择BIT1=访问EEPROM,配置,用户ID和设备ID注册0=访问PFMD旧PICS,使用EEC。ONX有一个交换位值:ECON1.EPGD:Flash程序/数据EEPROM存储器选择BIT1=访问程序空间Flash存储器0 =访问数据EEPROM存储器具有相同的发行量通过为PIC16F18855和PIC18F26K40写入BooTaLoad并使用来自PIC16F的EEPROM和Flash写入功能1829。
以上来自于百度翻译 以下为原文 void pal_eeprom_WriteByte(uint16_t wAddress, uint8_t byData) { NVMADRH = ((wAddress >> 8) & 0xFF); NVMADRL = (wAddress & 0xFF); NVMDATL = byData; PAL_GLOBAL_INTERRUPT_DISABLE(); NVMCON1bits.NVMREGS = 1; NVMCON1bits.WREN = 1; NVMCON2 = 0x55; NVMCON2 = 0xAA; NVMCON1bits.WR = 1; PAL_GLOBAL_INTERRUPT_ENABLE(); /* Wait for write to complete */ while (NVMCON1bits.WR) { } NVMCON1bits.WREN = 0; } If you are fit in c-code you will be able to translate this in asm. The main diffrence is that you have to set "NVMREGS" with the "new" PIC's for EEPROM. NVMCON1.NVMREGS: Configuration Select bit 1 = Access EEPROM, Configuration, User ID and Device ID Registers 0 = Access PFM The old Pics, using the EECONx has a switched bit value: EECON1.EEPGD: Flash Program/Data EEPROM Memory Select bit 1 = Accesses program space Flash memory 0 = Accesses data EEPROM memory I had the same issu by writing a bootlaoder for the PIC16F18855 and PIC18F26K40 and useing the eeprom and flash writing-functions from a PIC16F1829. |
|
|
|
整个帖子只是为了重复我在后5行中所说的话吗?
以上来自于百度翻译 以下为原文 Was that whole post just to repeat what I said in the last two lines of post#5 ? |
|
|
|
是为了解释它。在NVMRG是2位宽的情况下,“设置它访问”可能是错误理解的。与旧版本的比较应该说明为什么会出现这种情况,如果只有一个寄存器名变长(BTW.是正常的,你必须通过将代码从一个8位PIC到另一个PIC来做)。
以上来自于百度翻译 以下为原文 It was to explain it. In the case that NVMREG is 2 bits wide a "set it to access" could be missunderstanding. The compare to the old version shall show why this will appear, if sameone only chang the register names (which btw. is normaly the only thing you have to do by proting code from one 8Bit PIC to an other). |
|
|
|
在PIC16F1887中,“NVMGRESs”是一个比特,这就是为什么我把它称为“NVMGREST位”,所以在我所发表的文章中没有任何歧义。
以上来自于百度翻译 以下为原文 In a PIC16F18857, "NVMREGS" is a single bit, which is why I called it "the NVMREGS bit", so there is no ambiguity at all in what I posted. |
|
|
|
只有小组成员才能发言,加入小组>>
4779 浏览 9 评论
1815 浏览 8 评论
1734 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
2941 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2043 浏览 5 评论
423浏览 1评论
1101浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
345浏览 0评论
253浏览 0评论
LAN9252使用SQI通信,进行数字复位后读BYTE_TEST异常
1751浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-3-29 19:51 , Processed in 1.094266 second(s), Total 51, Slave 45 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 深圳华秋电子有限公司
电子发烧友 (电路图) 粤公网安备 44030402000349 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号