0
這是我第一次嘗試編譯彙編。願你能幫助我解決這個錯誤。以下是我使用的代碼,您可以在下面找到錯誤消息。如標題所述,IDE是MPLAB X IDE v2.35,我使用的是Michrochip PIC16F84A。MPLAB X IDE v2.35彙編程序代碼,無法彙編(PIC16F84A)
;******************************************************************************
; File Name : main.asm
; Version : 1.0
; Description : Test Program
; Author : Me
; Last Updated : 20 April 2015
; *******************************************************************
list p=16f84
radix hex
; Register
STATUS equ 0x03
OPTION_REG equ 0x81
PORTA equ 0x05
PORTB equ 0x06
TRISA equ 0x85
TRISB equ 0x86
; STATUS Register Bits
RP0 equ 0x05 ; 0 = Bank 0 0x00 - 0x7F, 1 = Bank 1 0x80 - 0xFF
;_________________________________________________________________
;Mainprogram
BSF STATUS,RP0 ; Change to RAM Bank 1
BSF TRISB,2 ; Set RB2 output to 1
BCF STATUS,RP0 ; Change to RAM Bank 0
BCF PORTB,2 ; Define RB2 as output
end
這是錯誤信息,我從MPLAB有:
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/xxx/MPLABXProjects/Test.X'
make -f nbproject/Makefile-default.mk dist/default/production/Test.X.production.hex
make[2]: Entering directory 'C:/Users/xxx/MPLABXProjects/Test.X'
make[2]: *** [build/default/production/main.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
"C:\Program Files (x86)\Microchip\MPLABX\mpasmx\mpasmx.exe" -q -p16f84a -l"build/default/production/main.lst" -e"build/default/production/main.err" -o"build/default/production/main.o" "main.asm"
Warning[203] C:\USERS\xxx\MPLABXPROJECTS\TEST.X\MAIN.ASM 29 : Found opcode in column 1. (BSF)
Error[152] C:\USERS\xxx\MPLABXPROJECTS\TEST.X\MAIN.ASM 29 : Executable code and data must be defined in an appropriate section
Warning[203] C:\USERS\xxx\MPLABXPROJECTS\TEST.X\MAIN.ASM 30 : Found opcode in column 1. (BSF)
Message[302] C:\USERS\xxx\MPLABXPROJECTS\TEST.X\MAIN.ASM 30 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[152] C:\USERS\xxx\MPLABXPROJECTS\TEST.X\MAIN.ASM 30 : Executable code and data must be defined in an appropriate section
Warning[203] C:\USERS\xxx\MPLABXPROJECTS\TEST.X\MAIN.ASM 31 : Found opcode in column 1. (BCF)
Error[152] C:\USERS\xxx\MPLABXPROJECTS\TEST.X\MAIN.ASM 31 : Executable code and data must be defined in an appropriate section
Warning[203] C:\USERS\xxx\MPLABXPROJECTS\TEST.X\MAIN.ASM 32 : Found opcode in column 1. (BCF)
Error[152] C:\USERS\xxx\MPLABXPROJECTS\TEST.X\MAIN.ASM 32 : Executable code and data must be defined in an appropriate section
nbproject/Makefile-default.mk:95: recipe for target 'build/default/production/main.o' failed
make[2]: Leaving directory 'C:/Users/xxx/MPLABXProjects/Test.X'
nbproject/Makefile-default.mk:78: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/xxx/MPLABXProjects/Test.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
BUILD FAILED (exit value 2, total time: 806ms)
這似乎不是你正在組裝的實際代碼。錯誤消息指的是您發佈的代碼中不存在的行。 – Michael
我更新了代碼,現在錯誤文件中的行應與源代碼中的代碼相同 – Domi
好吧,聽起來您需要在第一條指令之前聲明代碼段。查看彙編程序的手冊,瞭解完成的方式。 – Michael