图片编程错误问题 [英] pic programming error problem
问题描述
这是我编写的一段代码,当我尝试在MPLab 8.63中进行构建时遇到错误151和152.我的老师和我找不到此错误的原因!谁能帮忙
this is a piece of code that I made and am getting errors 151 and 152 when I attempt to build in MPLab 8.63. My instructor and I cannot find the reason for this error! can anyone help
;**********************************************************************
; *
; Filename: MOTOR_SPEED_CONTROL.asm *
; Date: FEBRUARY, 17 2011 *
; File Version: VERSION 1 *
; *
; Author: DANIEL COMTOIS *
; Company: STUDENT *
; *
; *
;**********************************************************************
; *
; Files required: P16F84A.INC *
; *
; *
; *
;**********************************************************************
; *
; Notes: *
; *
; *
; *
; *
;**********************************************************************
list p=16F84A ; list directive to define processor
#include <p16F84a.inc> ; processor specific variable definitions
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
COUNT1 equ 0X0C ;First Counter for our dleay loops
COUNT2 equ 0X0D ;Second counter for our delay loops
; ''__CONFIG'' directive is used to embed configuration data within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
goto main
;ISR
org 0x04
comf PORTA,1
btfsc PORTA,0
goto NO
goto YES
NO
btfsc PORTB,0
goto theend
btfsc PORTB,1
goto bit2
goto twenty
YES
btfsc PORTB,0
goto theend
btfss PORTB,1
goto twenty
btfsc PORTB,2
goto eighty
goto fifty
bit2
btfsc PORTB,2
goto eighty
goto fifty
eighty
movlw 0xF4
goto timer
fifty
movlw 0x39
goto timer
twenty
movlw 0x83
goto timer
timer movwf TMR0
theend bsf INTCON,2 ;TOIF
retfie
;**********************************************************************
main
;SET UP THE PORTS
bsf STATUS,5 ;Switch to Bank 1
movlw 0XFE ;SetUP Port A pins
movwf TRISA ;to input.
movlw 0xFF ;SETUP PORT B PINS
movwf TRISB ;TO INPUT
movlw 0x07 ;Select prscaller 256
movwf OPTION_REG ;EDGE SELECT BIT
bcf STATUS,5 ;Switch back to Bank 0
bsf INTCON,7 ;ENABLE GLOBAL INTERUPT
bsf INTCON,5 ;ENABLE TIMER0 OVERFLOW
bsf INTCON,2 ;ENABLE TIMER0 OVERFLOW FLAG BIT
;Turn led on
Start
btfsc PORTB,0
goto Start
bcf PORTA,0
goto Start
;Delay Subroutine
Delay
Loop1 decfsz COUNT1,1 ;THIS SECOND LOOP KEEPS THE LED TURNED ON
goto Loop1 ;long enough to see it
decfsz COUNT2,1
goto Loop1
return
;END OF PROGRAM
END
; directive ''end of program''
构建时出错
-------------------------------------------------- --------------------
开始调试项目`J:\ MICRO_semester_2 \ LABS \ MOTOR_SPEED_CONTROL \ AGAIN \ DAMNYOU.mcp''.
语言工具版本:MPASMWIN.exe v5.39,mplink.exe v4.38,mplib.exe v4.38
定义了预处理程序符号__DEBUG.2011年4月6日星期三17:05:29
-------------------------------------------------- --------------------
清除:删除中间文件和输出文件.
干净:删除的文件"J:\ MICRO_semester_2 \ LABS \ MOTOR_SPEED_CONTROL \ AGAIN \ DAMNYOU.mcs".
清洁:完成.
执行中:"C:\ Program Files(x86)\ Microchip \ MPASM Suite \ MPASMWIN.exe"/q/p16F84A"FIRST.ASM"/l"FIRST.lst"/e"FIRST.err"/o"FIRST.o "/d__DEBUG = 1
错误[151] J:\ MICRO_SEMESTER_2 \ LABS \ MOTOR_SPEED_CONTROL \ AGAIN \ FIRST.ASM 45:操作数包含无法解析的标签或过于复杂
错误[152] J:\ MICRO_SEMESTER_2 \ LABS \ MOTOR_SPEED_CONTROL \ AGAIN \ FIRST.ASM 45:必须在适当的部分中定义可执行代码和数据
警告[205] J:\ MICRO_SEMESTER_2 \ LABS \ MOTOR_SPEED_CONTROL \ AGAIN \ FIRST.ASM 49:在第1列中找到指令.(org)
消息[302] J:\ MICRO_SEMESTER_2 \ LABS \ MOTOR_SPEED_CONTROL \ AGAIN \ FIRST.ASM 111:在操作数中注册的寄存器不在库0中.请确保库位正确.
消息[302] J:\ MICRO_SEMESTER_2 \ LABS \ MOTOR_SPEED_CONTROL \ AGAIN \ FIRST.ASM 113:在操作数中注册而不是在存储区0中.确保存储区位正确.
消息[302] J:\ MICRO_SEMESTER_2 \ LABS \ MOTOR_SPEED_CONTROL \ AGAIN \ FIRST.ASM 115:在操作数中注册,而不是存储区0.确保存储区位正确.
警告[205] J:\ MICRO_SEMESTER_2 \ LABS \ MOTOR_SPEED_CONTROL \ AGAIN \ FIRST.ASM 153:在第1列中找到指令.(END)
根据要求停止基于首次失败的构建.
-------------------------------------------------- --------------------
项目`J:\ MICRO_semester_2 \ LABS \ MOTOR_SPEED_CONTROL \ AGAIN \ DAMNYOU.mcp的调试构建失败.
语言工具版本:MPASMWIN.exe v5.39,mplink.exe v4.38,mplib.exe v4.38
定义了预处理程序符号__DEBUG.2011年4月6日星期三17:05:32
-------------------------------------------------- --------------------
BUILD FAILED
error while building
----------------------------------------------------------------------
Debug build of project `J:\MICRO_semester_2\LABS\MOTOR_SPEED_CONTROL\AGAIN\DAMNYOU.mcp'' started.
Language tool versions: MPASMWIN.exe v5.39, mplink.exe v4.38, mplib.exe v4.38
Preprocessor symbol `__DEBUG'' is defined.Wed Apr 06 17:05:29 2011
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "J:\MICRO_semester_2\LABS\MOTOR_SPEED_CONTROL\AGAIN\DAMNYOU.mcs".
Clean: Done.
Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F84A "FIRST.ASM" /l"FIRST.lst" /e"FIRST.err" /o"FIRST.o" /d__DEBUG=1
Error[151] J:\MICRO_SEMESTER_2\LABS\MOTOR_SPEED_CONTROL\AGAIN\FIRST.ASM 45 : Operand contains unresolvable labels or is too complex
Error[152] J:\MICRO_SEMESTER_2\LABS\MOTOR_SPEED_CONTROL\AGAIN\FIRST.ASM 45 : Executable code and data must be defined in an appropriate section
Warning[205] J:\MICRO_SEMESTER_2\LABS\MOTOR_SPEED_CONTROL\AGAIN\FIRST.ASM 49 : Found directive in column 1. (org)
Message[302] J:\MICRO_SEMESTER_2\LABS\MOTOR_SPEED_CONTROL\AGAIN\FIRST.ASM 111 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] J:\MICRO_SEMESTER_2\LABS\MOTOR_SPEED_CONTROL\AGAIN\FIRST.ASM 113 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] J:\MICRO_SEMESTER_2\LABS\MOTOR_SPEED_CONTROL\AGAIN\FIRST.ASM 115 : Register in operand not in bank 0. Ensure that bank bits are correct.
Warning[205] J:\MICRO_SEMESTER_2\LABS\MOTOR_SPEED_CONTROL\AGAIN\FIRST.ASM 153 : Found directive in column 1. (END)
Halting build on first failure as requested.
----------------------------------------------------------------------
Debug build of project `J:\MICRO_semester_2\LABS\MOTOR_SPEED_CONTROL\AGAIN\DAMNYOU.mcp'' failed.
Language tool versions: MPASMWIN.exe v5.39, mplink.exe v4.38, mplib.exe v4.38
Preprocessor symbol `__DEBUG'' is defined.Wed Apr 06 17:05:32 2011
----------------------------------------------------------------------
BUILD FAILED
推荐答案
免责声明:我不太了解汇编程序,因此请告诉我是否错误,我将删除此答案.
似乎编译器不喜欢"goto main".我看到"main"的标签从"main"下第一条指令的前一行开始. 本教程在标签的同一行显示说明.我不确定这是否是编译器正在执行的规则,但也许可以.
另一个想法:也许您正在使用的标签之一是保留字?
我的建议:编写一小段代码,然后慢慢添加命令,直到完全构建到问题所在的程序为止.最终,您添加的内容将导致编译器在构建过程中出错.这是您需要重点关注的事情.
Disclaimer: I don''t know assembly very well, so let me know if I''m wrong and I will delete this answer.
Seems the compiler doesn''t like the "goto main". I see the label for "main" starts on the line previous to the first instruction under "main". This tutorial shows the instructions on the same line as the label. I''m not sure if that is a rule that the compiler is enforcing, but maybe.
Another idea: maybe one of the labels you are using is a reserved word?
My recommendation: make a smaller chunk of code and slowly add commands until you build all the way up to the program in your question. Eventually, something you add will cause the compiler to error out during the build. That is the something you need to focus on.
这篇关于图片编程错误问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!