完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我为PIC16F870写了一个大约10年前的项目,这是一个完美的工作。当然,我现在使用的是MPASM的最后版本,V5.72与旧的源代码。ASM文件和新的MPASM,我遇到了一个问题:我可以编译,但编程后它已经不工作了。经过几个星期的考验,我是。当我尝试从AdvWF PCL、FDT DEST1、Dest2、Dest3……在Dest1=1,Dest2=4,Dest3=6toADWWF PCL,FRTLW DEST1RESLW DEST2RESLW DEST3……时,改变表读取功能。查看程序内存,我看到“ReLLW DEST1”被正确编译为0x3401,而“DestDest1”被编译为0x001。我弄错了吗?
以上来自于百度翻译 以下为原文 I am refreshing a project written about 10 years ago for PIC16F870 and perfectly working. Of course I am now using the last version of MPASM, v5.72 With old source .asm file and new MPASM I got a problem: I was able to compile, but after programming it did not work anymore. After weeks of trials, I was going to give up while I tried to change a table read function from addwf PCL,f dt dest1, dest2, dest3... where dest1=1, dest2=4, dest3=6 to addwf PCL,f retlw dest1 retlw dest2 retlw dest3... and it worked! Looking at the program memory I saw that " retlw dest1" is correctly compiled as 0x3401, while " dt dest1" is compiled as 0x0001. Have I made any mistake? |
|
相关推荐
13个回答
|
|
这不重要,但是你是使用绝对模式还是链接模式?MPLAB的默认值为绝对值,因为MPLABX正在链接。如果您想继续使用绝对模式,则必须编辑项目属性。
以上来自于百度翻译 以下为原文 It shouldn't matter, but are you using absolute, or linking mode? The default for MPLAB was absolute, for MPLABX it is linking. You have to edit the project properties if you want to keep using absolute mode. |
|
|
|
你说得对!我把编辑属性更改为绝对值;所有的东西都编译得很好,程序运行正常。
以上来自于百度翻译 以下为原文 You right! I changed edit properties to absolute; everything is compiled well and program runs ok.Smile: |
|
|
|
隐马尔可夫模型。。。可重定位模式如何在绝对代码中扰乱DT指令?!
以上来自于百度翻译 以下为原文 Hmm... how can relocatable mode mess up the DT directive in absolute code?! |
|
|
|
是的,最奇怪的是,我从DB指令的文档中得到线索,它明确地指出它在链接或绝对模式上的行为不同。
以上来自于百度翻译 以下为原文 Yes, most odd. I got the clue from the documentation for the DB directive, which specifically says it behaves differently in linking or absolute mode. |
|
|
|
我不喜欢(同意)DB指令填充可重定位模式的34(ReTLW)值,这是DT指令所用的。
以上来自于百度翻译 以下为原文 I don't like (agree in that) the DB directive padded the values with 34 (RETLW) for relocatable mode; that is what the DT directive is used for. |
|
|
|
隐马尔可夫模型。。。可重定位模式如何在绝对代码中扰乱DT指令?汇编程序的可重定位模式有几个符号空间,绝对模式似乎只有一个。我还没有测试这个猜测,但是如果Dest1、Dest2、Dest3是引用代码空间的符号,那么MPASM将把它们当作可重定位的14位地址对象。我们需要看到一个更完整的源文件,以便确认这个猜测。
以上来自于百度翻译 以下为原文 Hmm... how can relocatable mode mess up the DT directive in absolute code?! The relocatable mode of the assembler have several name spaces for symbols, the absolute mode seems to have just one. I have not tested this guess but if dest1, dest2, dest3 are symbols that reference code space then MPASM will treat them as relocatable 14-bit address objects. We would need to see a more complete source file that builds to be able to confirm this guess. |
|
|
|
我真的不需要对此事的帮助,因为现在,绝对编译启用,一切都可以,但如果有人感兴趣,我正在上传完整的项目。
以上来自于百度翻译 以下为原文 I really dont need help on the matter anymore because now, with absolute compilation enabled, everything is ok, but in case anyone is interested I am uploading the full project. Attachment(s) dt_directive.zip (119.87 KB) - downloaded 176 times |
|
|
|
答对了!
以上来自于百度翻译 以下为原文 Bingo! mes_read da "Dnload",0 mes_upld da "Upload",0 mes_fill_z da "Fill zero",0 mes_fill_p da "Fill plus",0 mes_test da "Test",0 mes_welcome da " THERMO MASTER",0 mes_error da "ERROR",0 mes_unkn da "?? UNKNOWN ??",0 ;mes_add da "Address +/-",0 ;mes_data da "Data +/-",0 mes_running da "Running",0 mes_done da "Done ",0 ;mes_enter da "Enter",0 ;mes_right da "Right",0 ;mes_left da "Left",0 ;mes_up da "Up",0 ;mes_dwn da "Down",0 mes_date da "DATE-TIME" ;*************************** ; Find message to display ;*************************** find_mes nop clrf PCLATH andlw 0x07 ;just in case addwf PCL,f ; **** next row only works in absolute mode!!! *** 21mar2017 dt mes_read, mes_upld, mes_fill_z, mes_fill_p, mes_test, mes_error, mes_error, mes_error ; retlw mes_read ;dt mes_read ; retlw mes_upld ;dt mes_upld ; retlw mes_fill_z ;dt mes_fill_z ; retlw mes_fill_p ;dt mes_fill_p ; retlw mes_test ;dt mes_test ; retlw mes_error ;dt mes_error ; retlw mes_error ;dt mes_error ; retlw mes_error ;dt mes_error |
|
|
|
@ OP,DT线中的参数是代码空间中的符号引用,正如丹猜测的那样。这些符号是14位对象;然而,MPASM用户指南指出DT指令的每个参数“必须是8位值”。
以上来自于百度翻译 以下为原文 @OP, the arguments in your DT line are references to symbols in code space, as Dan has guessed. These symbols are 14-bit objects; however, the MPASM User's Guide states that each argument for the DT directive "must be an 8-bit value." Look up the LOW operator in said user's guide. |
|
|
|
|
|
|
|
在可重定位模式下,DT指令对它的参数符号的值进行标记,该参数符号指向程序存储器中的一个位置(34)(RTELW)。它悄无声息地变成了DW指令,没有任何警告。或者,至少,在MPASM用户指南中的文档。此外,我不能在可重定位模式下复制DB指令的行为,其中的值假定要填充34(ReTLW),如MPASM用户指南中所描述的,并且在POSTα5和第六WTF中…因此,在可重定位模式下,DT指令可以像DW指令那样运行,而DB指令假定像DT指令那样动作。我将这些特征排列在一个标签上的高操作符设置位7,该标签指向增强中档设备的程序存储器中的一个位置。任何决定这些用途的人都应该用高射炮射击!格林先生:
以上来自于百度翻译 以下为原文 Tested and confirmed. In relocatable mode, the DT directive does _not_ pad the values of its argument symbols that point to a location in program memory with 34 (RETLW). It silently becomes like the DW directive, without any warning. That has got to be fixed. Or, at the very least, document in the MPASM User's Guide. Also, I cannot reproduce the behavior of the DB directive in relocatable mode, where the values suppose to be padded with 34 (RETLW), as described in the MPASM User's Guide and here in Posts #5 and #6. WTF ... So, in relocatable mode, the DT directive can act like the DW directive and the DB directive supposes to act like the DT directive. I'd rank these features up there with the HIGH operator setting bit 7 of a label pointing to a location in program memory for the enhanced mid-range devices. Whoever decided on these usages should be shot with an anti-aircraft gun! mr green: |
|
|
|
不幸的是,我的英语知识还不足以完全说明Prase:“我将这些特征排列在一个标签的高操作员设置位7,它指向增强的中档设备的程序存储器中的一个位置”,但在我看来,我并没有对自己的问题如此愚蠢。MMPASM跟我开玩笑,没问题,一切都好,结果很好。
以上来自于百度翻译 以下为原文 Unfortunately my knowledge of english is not enough to fully anderstand the prase: "I'd rank these features up there with the HIGH operator setting bit 7 of a label pointing to a location in program memory for the enhanced mid-range devices", but it seems to me that I was not so dumb with my problem and MPASM was kidding me. No problem, All's well that ends well. |
|
|
|
我只是表达了我对Microchip所做的失望。不应该使用高运算符来选择RAM和ROM地址空间。现在,高(标签)操作员自动地为指向增强中档PIC设备中的代码空间的标签设置位7。它应该与它在其他8位PIC家族中的行为一致,但是现在它不这样。DB指令同样令人失望,如DT指令和DT指令,就像在可重定位模式下指向代码空间的标签的DW指令一样。同样,这些指令应该与它们在绝对和可重定位模式下的行为一致,但它们不是。而且,像另一个指令那样运行的指令的处理是什么,而不是做它应该做的事情。关于DT指令,标签指向代码空间。它只需截断值,发出警告,并用34(ReTLW)填充,不管它是在绝对或可重定位模式下,就像它应该“生成一系列RESLW指令”一样。
以上来自于百度翻译 以下为原文 I'm just expressing my disappointment with what Microchip have done. The HIGH operator should not have been used to select RAM and ROM address space. As it is now, the HIGH(label) operator automatically set bit 7 for a label pointing to code space in the enhanced mid-range PIC devices. It should be consistent with how it behaves in the other 8-bit PIC families, but as now it doesn't. Same disappointment with DB directive works like the DT directive and the DT directive works like the DW directive for a label pointing to code space in relocatable mode. Again, these directives should be consistent with how they behave in absolute and relocatable modes, but they aren't. And what is the deal with a directive operating like another directive, and not doing what it should do. Regarding the DT directive with label pointing to code space. It should just truncate the value, throw a warning, and pad with 34 (RETLW), regardless rather it's in absolute or relocatable mode, like it should which is to "generate a series of RETLW instructions." |
|
|
|
只有小组成员才能发言,加入小组>>
5244 浏览 9 评论
2035 浏览 8 评论
1955 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3209 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2260 浏览 5 评论
779浏览 1评论
672浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
598浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
682浏览 0评论
579浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-25 13:56 , Processed in 1.911744 second(s), Total 102, Slave 86 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号