完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好。我正在尝试定义一些单词和宏,但是我需要的名称已经被定义为微控制器的寄存器和标志。我想知道是否可以重新定义MMPASM汇编器上的“符号”或“?”定义所定义的符号或指令,如下面的例子。07CΩ7TrISA宏A,B MOVLW B MOVWF EDIM
以上来自于百度翻译 以下为原文 Hello. I am trying define some words and macros, but the names that I need are already defined for registers and flags of the microcontroller. I want to know if it is possible redefine symbols or directives defined by "equ" or "#define" on MPASM assembler, as in the example below. ; example |
|
相关推荐
19个回答
|
|
|
|
|
|
|
|
|
|
也许我没有选择最好的例子,无论如何。我知道我可以编辑文件PXXXX.NC,但这将是非常有问题的,我希望它在汇编程序中重新定义,因为无论如何我都会这么做。
以上来自于百度翻译 以下为原文 Maybe I did not choose the best example, anyway. I know that I could edit the file picxxxx.inc but that would be really problematic, I would prefer it to redefined during the assembler, because I'll do it anyway. |
|
|
|
|
|
|
|
出于任何原因,保留字是保留字。
以上来自于百度翻译 以下为原文 for any reason a reserved word is a reserved word.... |
|
|
|
我之前的“不”回答是“我不想告诉你怎么回答”。这肯定是某种自我妄想的迷惑,试图将不可维护的代码用于工作安全的目的。
以上来自于百度翻译 以下为原文 My "no" response earlier is a "I don't want to tell you how" kinda answer. This must be some sort of self-delusional obfuscation attempts to unmaintainable tainted code for job security purpose. |
|
|
|
|
|
|
|
|
|
|
|
我试图创建宏和其他与另一个指令集兼容,但我与一些词有冲突。
以上来自于百度翻译 以下为原文 I am trying to create macros and others to have compatibility with another instruction set, but I have conflict with some words. |
|
|
|
给出这样一个宏的例子。对于8位PIC器件,基本上有3组指令:PIC16、PIC16F1和PIC18。
以上来自于百度翻译 以下为原文 Give an example of such macro. There are basically 3 sets of instructions for the 8-bit PIC devices: PIC16, PIC16F1, and PIC18. |
|
|
|
我指的是一种更像AVRD的体系结构,其中RD和Z是内存寄存器。
以上来自于百度翻译 以下为原文 I was referring to an architecture more like avr where Rd and Z are memory registers |
|
|
|
其中RD和Z是内存寄存器,因此,您希望使用AVR指令助记符对PIC设备进行编码。给出一个需要重新定义MPASM符号的例子。
以上来自于百度翻译 以下为原文 where Rd and Z are memory registers So, you want to code PIC devices using AVR instruction mnemonics. Give an example where redefining an MPASM symbol is needed. |
|
|
|
如果您必须这样做,您可以使用MPLAB预构建步骤,在MPASM看到之前,用C预处理器对源进行“预处理”。如果您安装了PIC24/DSPIC或PIC32或AVR工具链,您可以调用GCC预处理器,CPP及其传统CPP选项,迫使它将文本解析为文本而不是C符号。另一种方法是通过你喜欢的文本处理语言编写的脚本来运行它。然而,如果你想在智力练习以外的任何实际用途上这样做的话,你是可以证明的!
以上来自于百度翻译 以下为原文 If you *MUST* do this, you could use a MPLAB pre-build step to preprocess with a C preprocessor to 'mangle' the source before MPASM sees it. If you have a PIC24/dsPIC or PIC32 or AVR toolchain installed you can invoke the GCC preprocessor, CPP with its -traditional-cpp option to force it to parse the file as text rather than C symbols. Alternatively run it through a script written in whatever your favourite text processing language is. However if you want to do this for any practical purpose other than the challenge of the intellectual exercise, you are certifiably bughouse nuts! |
|
|
|
在这个例子中,LD是一些PICS中的一个位寄存器,Z是一个位状态。有相同的指令,例如由汇编程序定义的POP、PASE和PULL,而其他指令则是由PICXXX.NC中的代码定义的。
以上来自于百度翻译 以下为原文 In the example: LD is a bit register in some pics and Z is a bit status. There are equal instructions, such as: pop, push and call defined by the assembler, but the others are defined by code in picxxxx.inc |
|
|
|
是的,我可以创建我自己的汇编程序,但不会很快。
以上来自于百度翻译 以下为原文 Yes, I could create my own assembler, but it will not be soon |
|
|
|
标准中包含的所有符号均为大写。宏名称是区分大小写的,宏参数是宏的局部变量。因此,这应该工作:PIC18设备只有75个指令;PIC16设备具有更少。为什么用另一个MCU指令集来编码这些设备?真令人难以置信!
以上来自于百度翻译 以下为原文 All the symbols in the standard include file are uppercase. Macro name is case sensitive and macro arguments are local to the macro. So, this should work: ld macro Rd,Z movff Z,FSR0L movff Z+1,FSR0H movff INDF0,Rd endm PIC18 devices have only 75 instructions; PIC16 devices have less. Why code these devices with instruction set from another MCU? It's mind-boggling! |
|
|
|
嗯…是的,我只能使用小写字母,即使如此,是否可以重新定义符号?
以上来自于百度翻译 以下为原文 mmm... yes, I could use only lowercase, even so, is it possible to redefine symbols? |
|
|
|
你在ASM编程多久了?徒劳。这真的是毫无意义的。你被告知你不能重新定义象PORTx这样的符号,因为它们使用。使它们成为GLULL。你仍然在问。如果你是一个程序员,你应该用设备的语言编码。你要对状态标志进行编码吗?你的CPU速度会减慢,时间会变长。你的代码大小会增加,然后你需要处理分支和跳跃。如果你可以分支+127,而你的宏是5条指令,那么你的分支只会是+25“编辑文件PICXXX.Inc”。你的代码将会崩溃。你知道WHA。斯波克会说什么?
以上来自于百度翻译 以下为原文 How long have you programmed in asm? Futile. It really is pointless. You were told that you cannot redefine symbols such as PORTx since they use .equiv to make them globl. You are still asking. If you are a programmer, you should code in the language of the device. Are you going to code the status flags? You cpu speed will slow down, timing will be out. Your code size is going to increase then you need to handle branching and jumps. If you can branch +127 and your macros are 5 instructions then your branching will only be +25 "Edit the file picxxxx.inc" Your code is going to crash big time. You know what Spock would say? |
|
|
|
我的目标不是达到更高的效率或计算能力,我只是希望它是有功能的,它只是一个爱好项目,是的:这些细节被考虑在内。
以上来自于百度翻译 以下为原文 My goal is not reach greater efficiency or computing power, I just hope it is functional, it's just a hobby project, and yes: these details are taken into account. |
|
|
|
只有小组成员才能发言,加入小组>>
5283 浏览 9 评论
2055 浏览 8 评论
1968 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3231 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2276 浏览 5 评论
820浏览 1评论
708浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
652浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
709浏览 0评论
605浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-1-11 18:57 , Processed in 1.638576 second(s), Total 113, Slave 97 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号