[PIC, ASEMBLER] Kłopot z MpLab

0

Jestem początkujący w używaniu asemblera i dopiero uczę się programować PICi. Mam problem, kiedy chciałem skompilować przykład z książki Programem MpLab to wywaliło masę błędów jednego rodzaju, ale kompilacja bezpośrednio przez MpAsmWin kończy się powodzeniem, kłopot w tym, że MpLab ma debugger i emulator w którym mogę testować moje programy. Gdzie popełniłem błąd?

p1.asm

;program P1
;zapala diode podlaczona do RA1
;uklad eksperymentalny E1

	list p=16f628, r=hex
	#include p16f628.inc
	__config h'3f10'

	movlw	h'07'
	movwf	cmcon

	clrf	porta
	clrf	portb

	bsf		status, rp0
	bcf		pcon, oscf
	clrf	trisa
	clrf	trisb
	bcf		status, rp0

	bsf		porta, 1

	goto	$

	end

p1.err (wygenerowany przez MpLab)

Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 9 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 10 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 12 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 13 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 15 : Executable code and data must be defined in an appropriate section
Message[302] C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 16 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 16 : Executable code and data must be defined in an appropriate section
Message[302] C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 17 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 17 : Executable code and data must be defined in an appropriate section
Message[302] C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 18 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 18 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 19 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 21 : Executable code and data must be defined in an appropriate section
Error[150]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 23 : Labels must be defined in a code or data section when making an object file
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 23 : Executable code and data must be defined in an appropriate section

Wyjście MpLaba

----------------------------------------------------------------------
Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F628 "p1.asm" /l"p1.lst" /e"p1.err" /o"p1.o" /d__DEBUG=1 /c-
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 9 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 10 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 12 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 13 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 15 : Executable code and data must be defined in an appropriate section
Message[302] C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 16 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 16 : Executable code and data must be defined in an appropriate section
Message[302] C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 17 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 17 : Executable code and data must be defined in an appropriate section
Message[302] C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 18 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 18 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 19 : Executable code and data must be defined in an appropriate section
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 21 : Executable code and data must be defined in an appropriate section
Error[150]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 23 : Labels must be defined in a code or data section when making an object file
Error[152]   C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 23 : Executable code and data must be defined in an appropriate section
----------------------------------------------------------------------
Debug build of project `C:\Users\Hubert\Documents\mplab\testy\P1.mcp' failed.
Language tool versions: MPASMWIN.exe v5.34, mplink.exe v4.34
Preprocessor symbol `__DEBUG' is defined.
Sun Dec 06 18:51:24 2009
----------------------------------------------------------------------
BUILD FAILED


Co dokładnie oznacza błąd [152] Executable code and data must be defined in an appropriate section?

0

Poczytaj sobie Bracie,cóż to takiego jest segment kodu,segment danych i segment stosu ;-)

0

W projekcie nie może być jednocześnie innych plików asm z innymi przykładami.

0

Wprowadziłem poprawkę. Program wygląda teraz tak:

;program P1
;zapala diode podlaczona do RA1
;uklad eksperymentalny E1

        code
        list p=16f628, r=hex
        #include p16f628.inc
        __config h'3f10'

        movlw        h'07'
        movwf        cmcon

        clrf        porta
        clrf        portb

        bsf                status, rp0
        bcf                pcon, oscf
        clrf        trisa
        clrf        trisb
        bcf                status, rp0

        bsf                porta, 1

        goto        $

        end

i kompiluje się z kilkoma ostrzeżeniami:

----------------------------------------------------------------------
Debug build of project `C:\Users\Hubert\Documents\mplab\testy\P1.mcp' started.
Language tool versions: MPASMWIN.exe v5.34, mplink.exe v4.34
Preprocessor symbol `__DEBUG' is defined.
Wed Dec 09 21:10:46 2009
----------------------------------------------------------------------
Executing: "C:\Program Files (x86)\Microchip\MPASM Suite\MPASMWIN.exe" /q /p16F628 "p1.asm" /l"p1.lst" /e"p1.err" /o"p1.o" /d__DEBUG=1 /c-
Message[302] C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 17 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Message[302] C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 18 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Message[302] C:\USERS\HUBERT\DOCUMENTS\MPLAB\TESTY\P1.ASM 19 : Register in operand not in bank 0.  Ensure that bank bits are correct.
----------------------------------------------------------------------
Debug build of project `C:\Users\Hubert\Documents\mplab\testy\P1.mcp' succeeded.
Language tool versions: MPASMWIN.exe v5.34, mplink.exe v4.34
Preprocessor symbol `__DEBUG' is defined.
Wed Dec 09 21:10:47 2009
----------------------------------------------------------------------
BUILD SUCCEEDED

Niestety podczas debugowania WATCH nie wyświetla zmiany na PORTA, a po 2 sekundach program się wywala z błędem:

CORE-W0014: Halted due to PC incrementing over the Maximum PC address and wrapping back to Zero

Nie jestem pewien ale może to mieć coś wspólnego z Watchdogiem. Jestem otwarty na propozycje, a szczególnie:

  1. Jak wyłączyć watchdoga
  2. Jak podglądać zawartość PORTA w mplabie

1 użytkowników online, w tym zalogowanych: 0, gości: 1