problem building codes from nigel tutorial

Status
Not open for further replies.

folarinv

New Member
1) I copied some codes from Nigel tutorial page onto the MPLAB code editor and I tried to run it but I keep getting an error complain from the assembler:

MPLINK 3.94, Linker
Copyright (c) 2005 Microchip Technology Inc.
Error - section 'INT_VECTOR' can not fit the absolute section. Section 'INT_VECTOR' start=0x00000004, length=0x00000010
Errors : 1

BUILD FAILED: Thu Jul 12 01:33:03 2001

2) According to the MPLAB tutorial, if I double click on the error the editor should take me to the line responsible for the error but that did not happen when I tried to build these codes.


Below is the code:

;Tutorial 1.1 - Nigel Goodwin 2002
LIST p=16F628 ;tell assembler what chip we are using
include "P16F628.inc" ;include the defaults for the chip
__config 0x3D18 ;sets the configuration settings (oscillator type etc.)

org 0x0000 ;org sets the origin, 0x0000 for the 16F628,
;this is where the program starts running
movlw 0x07
movwf CMCON ;turn comparators off (make it like a 16F84)

bsf STATUS, RP0 ;select bank 1
movlw b'00000000' ;set PortB all outputs
movwf TRISB
movwf TRISA ;set PortA all outputs
bcf STATUS, RP0 ;select bank 0

Loop
movlw 0xff
movwf PORTA ;set all bits on
movwf PORTB
nop ;the nop's make up the time taken by the goto
nop ;giving a square wave output
movlw 0x00
movwf PORTA
movwf PORTB ;set all bits off
goto Loop ;go back and do it again

end
 
The code assembles fine using MPASM, the MicroChip assembler, I never use MPLAB (which simply calls MPASM to assemble anyway).

There's no interrupt vector in the program, because it doesn't use interrupts, you may have MPLAB configured incorrectly?, or be using it incorrectly?, someone who uses MPLAB should be able to advise you.
 
If you remove the linker script from the project I suspect this problem will go away...

Good luck... Regards, Mike
 
linker script and MPLAB

Mike said:
If you remove the linker script from the project I suspect this problem will go away...

Good luck... Regards, Mike

Thanks very much mike.

I removed the linker script, opened a new page on the assembler then copied nigel's codes to the page and it build successfully.

..but just for sake of knowing. what could be the function of the linker. why would microchip put it there when i dont need it
 
Trust me, it is very important. Nigel is simply not using it (due to simplicity or just a habit of using MPASM only).
 
If you're authoring 'absolute' code instead of 'relocatable' code, the Linker is not required...

Regards, Mike
 
Mike said:
If you're authoring 'absolote' code instead of 'relocatable' code, the Linker is not required...

Regards, Mike

yes, and i think thats the reason why Nigel only uses MPASM
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…