完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好,我是学习汇编程序的。我正在编写一个我的医生的代码。这是一个:我正在使用MPASM 5.72,但是我编译时有下一个错误:你知道发生了什么吗?为什么他能编译它而我不能?谢谢
以上来自于百度翻译 以下为原文 Hello, I am learning assembler. I am trying to compile a code that a doctor of my faculty made. Is this one: List p=16f877A include p16f877a.inc contador EQU 20H CONTADOR EQU 21H contador1 EQU 22H contador2 EQU 23H ORG0 goto inicio ORG 0X04 ; atendiendo la interrupcion goto interrupcion org 10h inicio bsf STATUS,RP0 ; cambiamos al banco 1 Clrf TRISB ; configuramos el puerto b como salida movlw b'00010000' movwf TRISC movlw b'11000000' movwf SSPSTAT ; seleccion del rejol movlw b'00000111' ; configuracion del timer 0 movwf OPTION_REG bcf STATUS,RP0 ;cambiamos de banco 0 bcf INTCON,T0IF movlw b'10100000' movwf INTCON movlw b'00110000' movwf SSPCON ;seleecion modo maestro y habilitacion del spi movlw .100 movwf TMR0 movlw .25 movwf CONTADOR movlw .0 movwf contador1 ;movwf SSPBUF programa goto programa interrupcion bcf PIR1,3 bcf INTCON,T0IF ; borrar la bandera decfsz CONTADOR,f goto config1 goto finalizar config1 movlw .100 movwf TMR0 retfie finalizar movlw .100 movwf TMR0 movlw .25 movwf CONTADOR movfw SSPBUF movfw contador2 addlw .1 movwf SSPBUF movwf contador2 ;loop ;btfss PIR1,3 ;goto loop retfie retfie ;regreso de la subrutina de interrupcion END I am using mpasm 5.72, but I have the next error when I compile: Error[150] C:USERSDELFINDESKTOPUNIVERSIDADSENSORESASSEMBLER_BASICSSPI_MASTER.XSPI_MASTER.ASM 13 : Labels must be defined in a code or data section when making an object file Error[151] C:USERSDELFINDESKTOPUNIVERSIDADSENSORESASSEMBLER_BASICSSPI_MASTER.XSPI_MASTER.ASM 15 : Operand contains unresolvable labels or is too complex Error[152] C:USERSDELFINDESKTOPUNIVERSIDADSENSORESASSEMBLER_BASICSSPI_MASTER.XSPI_MASTER.ASM 15 : Executable code and data must be defined in an appropriate section Do you know what's going on? Why is he able to compile it and I can't? Thanks |
|
相关推荐
14个回答
|
|
看起来你在重新编译模式,而你的语法是绝对模式的:你可以在这个论坛上搜索更多信息,以及如何改变模式。PS:移动到一个(可能的)更新版本的MPASM。
以上来自于百度翻译 以下为原文 Looks like you're compiling in Relocatable mode, while your syntax is for Absolute mode: you can search for more info on this forum - and how to change mode. PS: Move to a (possibly) newer version of MPASM, anyway. |
|
|
|
|
|
|
|
|
|
|
|
从中间量程手册(PIC16F87A)的PWM初始化的样本代码示出以下CURRF CCP1CON(在BAN0)中CRF RTM2(BON0)MOVLW 0X07FMOWWF PR2(BANG1)没有指令来寻址BANG1。在实验1中,可以改变值7f。不像代码出现。作为一个新的男孩在块,我觉得我错过了一些东西。谁能给我指出正确的方向?谢谢。
以上来自于百度翻译 以下为原文 Sample code for PWM initialization from the mid range manual (PIC16F877A) shows the following clrf ccp1con ( In bank0) clrf tmr2 ( bank0) movlw 0x07f movwf pr2 ( bank1) no instruction to address bank1. Having addressed bank 1 experimentally the value 7f can be changed. Not so as the code appears. As a very new boy on the block I feel I am missing something. Can anybody point me in the right direction. Thanks |
|
|
|
你不是第一个在微芯片例子中发现明显错误的人。你是对的,这个例子是错误的。
以上来自于百度翻译 以下为原文 You're not the first to find a glaring error in a Microchip example. You are quite correct, the example is wrong. |
|
|
|
如果要使用MPASM来组装,则可以使用pSuedoOP:如果不是在MPASM中(或者不使用PSUDODO):在MPASM中,使用PSUEDO OP BANSSEL标签是优选的(IMHO),因为汇编器负责在状态寄存器中设置适当的位。这将导致相同的代码一旦组装。
以上来自于百度翻译 以下为原文 if this is to be assembled using mpasm this psuedo op can be used: clrf ccp1con ( In bank0) clrf tmr2 ( bank0) movlw 0x07f banksel pr2 movwf pr2 ( bank1) If not in mpasm (or not using the psuedo op): clrf ccp1con ( In bank0) clrf tmr2 ( bank0) movlw 0x07f bsf STATUS,RP0 ; RP0 =1 and RP1 = 0 selects bank 1 datasheet section 2.2 bcf STATUS,RP1 ; this is not strictly needed here as the previous access was to bank 0 (RP0 and RP1 both 0 for bank 0 access) movwf pr2 ( bank1) In mpasm the use of the psuedo op banksel label is preferable (IMHO) as the assembler takes care of setting the proper bits in the status register. It will result in the same code once assembled. |
|
|
|
完全同意使用银行卡,但问题不是“我如何选择银行?”这就是“为什么代码根本不选择银行呢?”
以上来自于百度翻译 以下为原文 Fully agree with using banksel, however the question was not "how do I select the bank?", it was "why isn't the example code selecting the bank at all?" |
|
|
|
是的,这就是问题,你回答得很好。我只是认为这句话“谁能给我指出正确的方向”是乞求一个更详细的答案,这是怎么做的(也许是超越我的一部分)?.
以上来自于百度翻译 以下为原文 Yes that was the question and you answered it very well. I just thought this statement "Can anybody point me in the right direction." was begging for a more detailed answer of how it is to be done (maybe overstepping on my part?). |
|
|
|
在PIC16F87A数据表中,你找到了样例代码吗?
以上来自于百度翻译 以下为原文 Where in the PIC16F877A datasheet did you find that sample code? |
|
|
|
这是在家庭参考手册中。
以上来自于百度翻译 以下为原文 It's in the family reference manual. http://ww1.microchip.com/downloads/en/DeviceDoc/31014a.pdf Page 14-14 |
|
|
|
|
|
|
|
对不起,打扰一下。但在我看来汇编程序代码应该是“汇编”的,而不是术语汇编的。编译过程是高级语言(如ANSI C)的特权。最后,软件实用程序的名称是:汇编程序和编译器。仍然听不到汇编的代码,没有痛苦。对不起的。
以上来自于百度翻译 以下为原文 Excuse me for intrusion. But it seems to me the assembler code should be "assembled", not "compiled" by terminology. The compilation process is a prerogative of higher level languages like ANSI C. At last the name of software utilities says that: an Assembler and the Compiler. Still can't hear the "compilation" about assembler code without a pain. Sorry. |
|
|
|
我完全同意,但我放弃了很久以前试图得到正确使用的术语一致,“编码器”最终会胜出……微笑:
以上来自于百度翻译 以下为原文 I fully agree however I gave up a long time ago trying to get the correct terminology used consistently, the "coders" will win out in the end anyway......Smile: |
|
|
|
我也放弃了纠正别人的术语。汇编程序汇编,编译器编译,并且两者都可以“编译”。MPLAB既不是汇编程序也不是编译器。
以上来自于百度翻译 以下为原文 I also gave up on correcting others on that terminology. Assembler assembles, compiler compiles, and both can "build". MPLAB is neither an assembler nor a compiler. Smile: |
|
|
|
只有小组成员才能发言,加入小组>>
5158 浏览 9 评论
1997 浏览 8 评论
1926 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3168 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2222 浏览 5 评论
722浏览 1评论
605浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
492浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
619浏览 0评论
518浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-19 02:17 , Processed in 1.278818 second(s), Total 75, Slave 68 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号