完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
这是很难重现的,我怀疑IDE中有一个像种族条件一样的错误:在PIC24H256GP310A上使用MPLABX 3.61/XC16 1.31,汇编程序抱怨——汇编源(在左边显示的行号)-行1455以前有相同的问题,它在之前和之后工作。被拒绝。我花了几个小时的比较版本发现,我只在第347行插入了另一个变量,这使得汇编程序在那里窒息。我发现可以重复移动其他变量,或者在第344行之前插入一个空白注释行就足以让第1455行重新组装起来。现在我已经编码了一些时间,空白注释行不再用于第1455行工作,但是现在拒绝了第1800行,并且在行328或移动行328之前的注释行不起作用。这把我逼疯了!-汉斯
以上来自于百度翻译 以下为原文 Well, this is difficult to reproduce, I suspect a bug like a race condition in the IDE: Using MplabX 3.61 / XC16 1.31 on a PIC24H256GP310A, the assembler complains — /S/TechDok/771/77109001.S:1800: Error: Register or constant literal expected as second operand of expression [W1+S_cmd]. /S/TechDok/771/77109001.S:1800: Error: Invalid operand syntax ('mov.b W0,[W1+S_cmd]').where the assembly source is (line numbers shown at left) — 328: S_cmd: .space K_TxL+6 ; string ; … 344: Z_ndp0: .space 2*8 ; 8 counters 345: T_tml0: .space 2*8 ; 8 timers 346: T_tmh0: .space 2*8 ; 8 timers 347: P_pxs0: .space 2*8 ; 8 pointers ; … 1455: mov W1, [W4+(T_tmh0-Z_ndp0)] ; accepted by Assembler & working — had problems before ; … 1799: mov.b W0, [W1+123] ; accepted by Assembler 1800: mov.b W0, [W1+S_cmd] ; rejected by Assembler Line 1455 had the same problems before, it was working before and then suddenly rejected. It took me hours of comparing versions to find I had only inserted another variable after line 347 which made the assembler choke there. I found reproducible that moving that other variable around, or just inserting a blank comment line before line 344 was sufficient to get line 1455 assembled again, at that point! Now I've coded some time further, that blank comment line is needed no more for line 1455 to work, but line 1800 is now rejected and comment lines before line 328 or moving line 328 around does not help this time. This drives me crazy! — Hans |
|
相关推荐
4个回答
|
|
偏移量只能是-512到+511。也许你的价值在这个范围之外。
以上来自于百度翻译 以下为原文 The offset can only be -512 to +511. It might be your value is outside this range. |
|
|
|
MOV.B[W0+X],W0512到511字节OP.SyCMD是绝对的和太大的。你需要一个结构,而不是绝对的地址。也就是说,结构,但它从来没有对我起作用。
以上来自于百度翻译 以下为原文 mov.b [w0+x],w0 -512 to 511 - byte op. S_cmd is absolute and too big. You need a struct, not absolute addresses. i.e. ;--------------------------------------------------- ;struct MotorProfile_t .equiv MPF_LI_StartRPM, 0 .equiv MPF_LI_FinalRPM, MPF_LI_StartRPM+2 .equiv MPF_LI_Distance, MPF_LI_FinalRPM+2 .equiv MPF_Cruise32, MPF_LI_Distance+2 .equiv MPF_CruiseMode, MPF_Cruise32+4 ;abs=0, rel=1, near=2, far=3, inf cw=4, inf ccw=5 .equiv MPF_LO_RPM, MPF_CruiseMode+2 .equiv MPF_LO_Distance, MPF_LO_RPM+2 .equiv MPF_sizeof, MPF_LO_Distance+2 ;--------------------------------------------------- .section profile_bss,bss Profile: .space MPF_sizeof .section test_code,code mov #Profile,w0 mov [w0+MPF_Cruise32+0],w2 mov [w0+MPF_Cruise32+2],w3 There is .struct but it never worked for me. |
|
|
|
你是对的,SY-CMD太大了,它在近RAM的开始,但是,来自8位,我忘了这个开始于0x0800…所以这一个解决了,谢谢!不管怎样,错误信息在那里是非常误导的。我被前面1455行仍然无法解释的问题误导了:偏移只有32,足够小,以前工作过,突然死亡,可以插入空白注释行来治愈。我使用.Stand指令设置变量。我认为,连续这样的定义将得到连续的地址-我不能依靠这一点吗?我想,GoTut2015:不是使用空间,而是使用了一个链。为什么?
以上来自于百度翻译 以下为原文 You're both right, S_cmd is too big — it's at the beginning of Near RAM, but, coming from 8 bits, I forgot that this starts at 0x0800… so this one is solved, thank you! Anyway, the error message is grossly misleading there. And I was mislead by the previous still unexplained problem with line 1455: the offset there is only 32, small enough, did work before, suddenly died and could be healed by inserting a blank comment line. I set up my variables using the .space directive. I thought that successive such definitions will get successive addresses — can I not rely on that?? @Gort2015: instead of .space you did use a chain of .equiv, more complicated and prone to errors, I would think. Why? |
|
|
|
不存在错误,因为该结构存在于.Inc文件中。它们是0、2、4、6、10、12、14的相对偏移量。当使用相对偏移量时,MPFX SIZEO= 16不依赖绝对地址。它们是为间接结构访问而设计的。MOV [基础+偏移],TMPALL,你会做的是创建编码问题。
以上来自于百度翻译 以下为原文 Not prone to errors since that struct lives in an .inc file. They are relative offsets from 0,2,4,6,10,12,14. MPF_sizeof=16 Don't rely on absolute addresses when using relative offsets. They are designed for indirect structure access. mov [BASE+OFFSET],tmp All you'll do is create coding problems. |
|
|
|
只有小组成员才能发言,加入小组>>
5016 浏览 9 评论
1923 浏览 8 评论
1861 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3078 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2149 浏览 5 评论
583浏览 1评论
450浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
480浏览 0评论
378浏览 0评论
IPECMD命令烧录AVR128DA48芯片,报找不到芯片错误
863浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-8-23 15:18 , Processed in 1.314390 second(s), Total 85, Slave 68 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号