2 qq 38423382 qq_38423382 于 2017.09.08 19:29 提问

我这个书上抄的汇编语言pic16f877代码有问题吗,为啥一直编译过不了
  list      p=16f877
  include   "p16f877.inc"
  org       0x00
  nop

Start: banksel PORTC
clrf PORTC
movlw B'01000001'
movwf ADCONO
banksel OPTION_REG
clrf TRISC
movlw B'00001110'
movwf ADCON1
banksel PORTC
Main: btfss INTCON,TOIF
goto Main
bcf INTCON,TOIF
bsf ADCONO,GO
Wait

btfss PIR1,ADIF
goto Wait
movf ADRESH,W
movwf PORTC
goto Main
end
我build之后显示这个
----------------------------------------------------------------------
Debug build of project G:\project\adc.mcp' started.
Language tool versions: MPASMWIN.exe v5.37, mplink.exe v4.37, mplib.exe v4.37
Preprocessor symbol
__DEBUG' is defined.

Fri Sep 08 19:27:24 2017

Clean: Deleting intermediary and output files.
Clean: Done.
Executing: "G:\MPLAB\MPASM Suite\MPASMWIN.exe" /q /p16F877A "adc.asm" /l"adc.lst" /e"adc.err" /d__DEBUG=1
Message[301] G:\MPLAB\MPASM SUITE\P16F877.INC 37 : MESSAGE: (Processor-header file mismatch. Verify selected processor.)
Error[121] G:\PROJECT\ADC.ASM 5 : Illegal label (Start)
Error[113] G:\PROJECT\ADC.ASM 8 : Symbol not previously defined (ADCONO)
Message[302] G:\PROJECT\ADC.ASM 10 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] G:\PROJECT\ADC.ASM 12 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[113] G:\PROJECT\ADC.ASM 14 : Symbol not previously defined (TOIF)
Error[113] G:\PROJECT\ADC.ASM 16 : Symbol not previously defined (TOIF)
Error[113] G:\PROJECT\ADC.ASM 17 : Symbol not previously defined (ADCONO)

Halting build on first failure as requested.

Debug build of project G:\project\adc.mcp' failed.
Language tool versions: MPASMWIN.exe v5.37, mplink.exe v4.37, mplib.exe v4.37
Preprocessor symbol
__DEBUG' is defined.

Fri Sep 08 19:27:25 2017

BUILD FAILED

1个回答

caozhy
caozhy   Ds   Rxr 2017.09.08 21:03
已采纳

没听说代码用抄的,你的书没有配套源代码么?

Csdn user default icon
上传中...
上传图片
插入图片