Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help Newbie MPLAB V8.01 Program error

Status
Not open for further replies.

SydC

Newbie level 3
Joined
Oct 3, 2007
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,348
preprocessor symbol `__debug is defined.

I upgraded to MPLAB V8.01 and deleted my first 16F626A program in the process which compiled and ran without errors in the previous version of MPLAB simulator.
I have copied and pasted my original program into MPLAB V8.01 and get the following error message:

Debug build of project `C:\Projects\16F628A Ver2 31 December 2007.mcp' started.
Preprocessor symbol `__DEBUG' is defined.
Mon Dec 31 08:44:06 2007
----------------------------------------------------------------------
Clean: Deleting intermediary and output files.
Clean: Deleted file "C:\Projects\16F628ATMPo_O".
Clean: Deleted file "C:\Projects\16F628ATMPO.lst".
Clean: Done.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F628A "16F628ATMPO.ASM" /l"16F628ATMPO.lst" /e"16F628ATMPO.err" /o"16F628ATMPo_O" /d__DEBUG=1
Message[313] C:\PROJECTS\16F628ATMPO.ASM 76 : CBLOCK constants will start with a value of 0.
Executing: "C:\Program Files\Microchip\MPASM Suite\MPLink.exe" "16f628a.lkr" "16F628ATMPo_O" /z__MPLAB_BUILD=1 /z__MPLAB_DEBUG=1 /o"16F628A Ver2 31 December 2007.cof" /M"16F628A Ver2 31 December 2007.map" /W
MPLINK 4.15, Linker
Copyright (c) 2007 Microchip Technology Inc.
Error - section 'RESET_VECTOR' can not fit the absolute section. Section 'RESET_VECTOR' start=0x00000000, length=0x00000046
Errors : 1

Link step failed.
----------------------------------------------------------------------
Debug build of project `C:\Projects\16F628A Ver2 31 December 2007.mcp' failed.
Preprocessor symbol `__DEBUG' is defined.
Mon Dec 31 08:44:07 2007
FAILED
----------------------------------------------------------------------

Can someone please tell me what I am now doing wrong?
Thanks
Syd
 

preprocessor symbol `__debug is defined

You had a linking error, your program is occupying the reset vector, whose length is usually 5 words. Did you create a project? If yes, try removing the file '16f628a.lkr' from your project.

Show us how you set up the project, or read the 'MPLAB IDE Quick Start Guide' (DS51281).

Cheers,
 

mplab link step failed

This is my code which gives the error:

list p=16F628A ; list directive to define processor
#include <p16F628A.inc> ; processor specific variable definitions

errorlevel -302 ; suppress message 302 from list file


__CONFIG _CP_OFF & _DATA_CP_OFF & _LVP_OFF & _BOREN_OFF & _MCLRE_ON & _WDT_OFF & _PWRTE_ON & _INTOSC_OSC_NOCLKOUT


; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See data sheet for additional information on configuration word settings.



;***** VARIABLE DEFINITIONS (examples)

; example of using Shared Uninitialized Data Section
; INT_VAR UDATA_SHR
; w_temp RES 1 ; variable used for context saving
; status_temp RES 1 ; variable used for context saving


;*********Reserve space to store count values starting at 0x20************
cblock ; 0x20
count1
count2
count3
endc
;********************************************************

RESET_VECTOR CODE 0x000 ; processor reset vector
goto main ; go to beginning of program

;**************************************************************************

main ; Label main

; Setup of Ports A & B

clrf PORTA
clrf PORTB

movlw 0x07 ; Place 07 into w register and Turn Off Comparators
movwf CMCON ; Enable Pins for i/o functions

; Set RP0/RP1 = 01 in Status register to select Bank 1 containing the TRISA and TRISB
; Then set the pins on PORTA and PORTB Lo = Outputs and Hi = Inputs
bcf STATUS, RP1 ; Clears RP1 = 0
bsf STATUS, RP0 ; Sets RP0 = 1 to select Bank 1

movlw b'00000000' ; Value for setting Port as Outputs (Lo)

movwf TRISB ; Set Port B all as outputs (FF = 0000 0000) (All set as outputs)
movwf TRISA ; Set Port A all as outputs (DF = 0001 0100) (Pin 4 RA5 only an Input)

; Set RP0/RP1 = 00 in Status register to select Bank 0
; Set Status Bit = 0 to select Bank 0 (RP1 =0 already set above)
bcf STATUS, RP0

Loop ; Label

; Switch Port Pins Hi = On = 1 for LED's
movlw 0xff ; ff = 11111111

movwf PORTA ; Set all Port A as Outputs Hi - (Problem DF = 1101 1111 Pin4 RA5 is only an input)
movwf PORTB ; Set all Port B as Outputs Hi -

;Waist 2msescs to ensure the pins go fully Hi and then Delay routine to keep Hi for a while
NOP ; 1 mSec delay with 4 MHz Oscillator
NOP ; 1 mSec delay
call Delay ; Increases the On time to 1 Second using delay routine
; Switch all Port pins Lo = Off = 0

clrf PORTA ; Set all Port A Outputs Lo
clrf PORTB ; Set all Port B Outputs Lo
call Delay ; Increases the Off time to 1 Second using delay routine
goto Loop ; Go back to loop label and do it again

; The 250msec Delay Subroutine (4MHz clock)
; First Store the values in the variables (Count1 = 250, Count2 = 199, Count3 = 1)

Delay movlw d'250' ; Place Decimal 250 into w register
movwf count1 ; Store 250 in count1 variable

d1 movlw 0xC7 ; Place C7 = Decimal 199 into w register
movwf count2 ; Store 199 in count2 variable

movlw 0x01 ; Place 01 = Decimal 1 into w register
movwf count3 ; Store 1 in count3 variable

Delay_0 decfsz count2, F ; Decrement count 2 (199)
; and Skip next line if count2 = 0
goto $+2 ; goto 2 lines down"goto d1"
decfsz count3, F ; Decrement count3 (1)
; and Skip the next line if count3 = 0
goto Delay_0

decfsz count1, F ; Decrement count1 (250)
; and kip if count1 = 0
goto d1 ; go back to d1
retlw 0x00 ; Return from subroutine with 0 in w register

goto main ; loop forever, remove this instruction, for test only

; initialize eeprom locations

; EE CODE 0x2100
; DE 0x00, 0x01, 0x02, 0x03


END ; directive 'end of program'



goto main ; loop forever, remove this instruction, for test only
 

link step failed mplab

- Start MPLAB IDE
- Select 'File>New' from 'File' menu
- Paste your program into the new file
- Save it with whatever filename you like, and with a '.asm' extension
- Select 'Project>Quickbuild <yourfilename>.asm' from 'Project' menu (or hit Alt-F10)

Another way is to put 'org 5' before your 'main' label.

Cheers,
 

    SydC

    Points: 2
    Helpful Answer Positive Rating
mplab initialize eeprom

As namqn wrote, put " org 0x05" just before the label "main" (let say, just "on top").
regards
 

    SydC

    Points: 2
    Helpful Answer Positive Rating
I had a same problem but solved by the way namqn told. Thanx namqn.:D
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top