完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
在汇编程序中,宏中有一些奇怪的问题。当我使用宏编译器说“错误(876)语法错误”时,当宏体直接写入代码时,没有错误。这可能是因为我在宏中使用3级宏吗?那么错误的真正原因是什么呢?谁知道呢?最好的问候,幼珍。
以上来自于百度翻译 以下为原文 Hello Have some strange trouble in assembler source, in macro. When i use macros compiler says "error(876) syntax error", when write the macro body direct to code, there is no error. May be this happens cause i use 3 level of macro in macro? movfl macro freg,lit movlw lit movwf freg endm ;------------------------------------------------------------------------------ movfl16 macro freg,lit movfl freg,Low(lit) movfl freg+1,High(lit) endm ;------------------------------------------------------------------------------ movfl32 macro freg,lit movfl16 freg,(lit & 0x0000FFFF) movfl freg+2,(lit >> 0x10) & 0xFF movfl freg+3,(lit >> 0x18)& 0xFF endm ;------------------------------------------------------------------------------ _func: movfl16 ax, (0x4503114F & 0x0000FFFF) // this 3 lines works fine movfl ax+2,(0x4503114F >> 0x10) & 0xFF movfl ax+3,(0x4503114F >> 0x18)& 0xFF movfl32 bx, 0x4503114F // this macro cause an error So whats the real reason of error? Who knows? Best regards, Eugene. |
|
相关推荐
2个回答
|
|
运算符在ASPIC/ASPIC18宏中具有特殊含义。它执行与C函数中类似于π*令牌粘贴操作符的AgMutoTraceTunes。因此:MOVFL16FRG,(LAMP和AMP;0x00,FFFFF)当被调用:MOVF32 32 HASH,0x45031 14F//这个宏引起错误:MOVFL16AX,(0x45031 14F0x00)FFFF等等,其他的行中宏:如果在XC8手册中看到宏指令和ASPIC操作符表。
以上来自于百度翻译 以下为原文 The & operator has a special meaning within ASPIC/ASPIC18 macros. Its performs argument concatenation similar to the ## token pasting operator in a C function-like #define. Therefore: movfl16 freg,(lit & 0x0000FFFF) when invoked by: movfl32 _hash, 0x4503114F // this macro cause an error does: movfl16 ax, (0x4503114F0x0000FFFF) and so forth for the other lines in the macro if it ever got that far. Try: movfl32 macro freg,lit movfl16 freg,(lit and 0x0000FFFF) movfl freg+2,(lit >> 0x10) and 0xFF movfl freg+3,(lit >> 0x18)and 0xFF endmSee the macro directive and the table of ASPIC operators in the XC8 manual. |
|
|
|
谢谢。我忘了这个……我在XC8用户指南中看到关于它的注释,现在我记得他们推荐使用&&代替……感谢您记住这一点,因为我完全忘记了,并且3次重读了所有关于宏的内容,但是这个注释是之前写的,这样我就再也看不见了…
以上来自于百度翻译 以下为原文 thank you. i forgot about this...i see remark about that in the XC8 user guide, and as i now remember they recommends to use && instead...thank you for remembering about that, cause i absolutely forgot about that, and 3 times reread all about macroses, but that remark was written previously, thus i did not see it again... |
|
|
|
只有小组成员才能发言,加入小组>>
5184 浏览 9 评论
2005 浏览 8 评论
1932 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3179 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2230 浏览 5 评论
739浏览 1评论
626浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
511浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
637浏览 0评论
535浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-28 14:07 , Processed in 1.539866 second(s), Total 79, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号