Microchip
直播中

黄长梅

7年用户 171经验值
私信 关注
[问答]

用mpasm编译汇编代码出现错误

你好,我是学习汇编程序的。我正在编写一个我的医生的代码。这是一个:我正在使用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)

李兆峰

2019-3-26 08:07:03
看起来你在重新编译模式,而你的语法是绝对模式的:你可以在这个论坛上搜索更多信息,以及如何改变模式。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.
举报

徐晨曦

2019-3-26 08:23:06
以上来自于百度翻译


      以下为原文

    ORG0? How about ORG 0?
举报

李兆峰

2019-3-26 08:37:54
以上来自于百度翻译


      以下为原文

   


举报

陈政竹

2019-3-26 08:49:01
从中间量程手册(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
举报

更多回帖

发帖
×
20
完善资料,
赚取积分