Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help me with pic16f84a Linker Scripts.

Status
Not open for further replies.
My source code is :

org 0x00
goto main
org 0x04; interupt routine
main
bsf 03h, 1 ; bank1
movlw 00h ;set port A
movwf 85h ; in/out
bcf 03h, 1; bank 0

ON
movlw 02h ; send data
movwf 05h ; to portA
movlw 00h; then
movwf 05h; switch off
goto ON
end; end of program.


This code assembled with no error but if i click build all the last set of statements will be :
section ' .org_0 ' does not fit start = 0x00000004
lenght = 00000082

BUILD FAILED .

Any help on how to solve this problem is appreciated. Thanks
 
Like I said, try reading the error mesages - also posting code without using the code tags is pointless, as browsers strip out the white space making it wrong anyway.

As you've now (completely bizzarely) deleted your original post I can't even point out exact lines, but it's in plain English.

Try looking at my tutorials for how source should be formatted - each part of a line needs to be in the correct place.
 
Thanks for your reply, full details is as follow:


Source code :

;==========================================================================
;
; Register Definitions
;
;==========================================================================

W EQU H'0000'
F EQU H'0001'

;----- Register Files------------------------------------------------------

INDF EQU H'0000'
TMR0 EQU H'0001'
PCL EQU H'0002'
STATUS EQU H'0003'
FSR EQU H'0004'
PORTA EQU H'0005'
PORTB EQU H'0006'
EEDATA EQU H'0008'
EEADR EQU H'0009'
PCLATH EQU H'000A'
INTCON EQU H'000B'

OPTION_REG EQU H'0081'
TRISA EQU H'0085'
TRISB EQU H'0086'
EECON1 EQU H'0088'
EECON2 EQU H'0089'

;----- STATUS Bits --------------------------------------------------------

IRP EQU H'0007'
RP1 EQU H'0006'
RP0 EQU H'0005'
NOT_TO EQU H'0004'
NOT_PD EQU H'0003'
Z EQU H'0002'
DC EQU H'0001'
C EQU H'0000'

;----- INTCON Bits --------------------------------------------------------

GIE EQU H'0007'
EEIE EQU H'0006'
T0IE EQU H'0005'
INTE EQU H'0004'
RBIE EQU H'0003'
T0IF EQU H'0002'
INTF EQU H'0001'
RBIF EQU H'0000'

;----- OPTION_REG Bits ----------------------------------------------------

NOT_RBPU EQU H'0007'
INTEDG EQU H'0006'
T0CS EQU H'0005'
T0SE EQU H'0004'
PSA EQU H'0003'
PS2 EQU H'0002'
PS1 EQU H'0001'
PS0 EQU H'0000'

;----- EECON1 Bits --------------------------------------------------------

EEIF EQU H'0004'
WRERR EQU H'0003'
WREN EQU H'0002'
WR EQU H'0001'
RD EQU H'0000'

;==========================================================================
;
; RAM Definition
;
;==========================================================================

__MAXRAM H'CF'
__BADRAM H'07', H'50'-H'7F', H'87'

;==========================================================================
;
; Configuration Bits
;
;==========================================================================

_CP_ON EQU H'000F'
_CP_OFF EQU H'3FFF'
_PWRTE_ON EQU H'3FF7'
_PWRTE_OFF EQU H'3FFF'
_WDT_ON EQU H'3FFF'
_WDT_OFF EQU H'3FFB'
_LP_OSC EQU H'3FFC'
_XT_O EQU H'3FFD'
_HS_OSC EQU H'3FFE'
_RC_OS EQU H'3FFF'
POINTER EQU H'000D'
PC EQU H'0002'
LIST




PROCESSOR 16F84A
#include p16f84a.inc


ORG 0x00
BSF _RC_OSC , 0 ; oscillator configuration
BSF _RC_OSC , 1 ; oscillator configuration
GOTO MAIN
ORG 0x04
MAIN
BSF STATUS, 5
movlw 0x80
movwf TRISB
movlw 00h
movwf TRISA
BCF STATUS, 5
CLOCK
BSF PORTB, 6
CALL ROUTINE
BCF PORTB, 6
GOTO CLOCK
ROUTINE
INCF POINTER, 1
movf POINTER, 0; move register data to W register
CALL TABLE
CALL DISPLAY
RETURN
TABLE
addwf PC
retlw 00h
retlw 08h
retlw 14h
retlw 04h
retlw 04h
retlw 3fh
retlw 00h

retlw 00h
retlw 0fh
retlw 08h
retlw 0fh
retlw 08h
retlw 0fh
retlw 00h

retlw 00h
retlw 06h
retlw 09h
retlw 06h
retlw 09h
retlw 06h
retlw 00h

retlw 00h
retlw 06h
retlw 09h
retlw 09h
retlw 09h
retlw 09h
retlw 00h

retlw 00h
retlw 06h
retlw 09h
retlw 06h
retlw 09h
retlw 06h
retlw 00h

RETURN
DISPLAY
movwf PORTA
RLF PORTA, 1
RLF PORTA, 1
RLF PORTA, 1
RLF PORTA, 1
RLF PORTA, 1
RLF PORTB, 1
RLF PORTB, 1
RLF PORTB, 1
RLF PORTB, 1
RLF PORTB, 1
RLF PORTB, 1
RETURN
END





And this is the reply i got when i click BUILD ALL :


Clean: Deleting intermediary and output files.

Clean: Done.

Executing: "C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe" /q /p16F84A "picPRO.asm" /l"picPRO.lst" /e"picPRO.err" /o"picPRo_O"

Warning[205] C:\DOCUMENTS AND SETTINGS\FOLAGBADE\DESKTOP\MYPICPROJET\PICPRO.ASM 104 : Found directive in column 1. (PROCESSOR)

Message[310] C:\PROGRAM FILES\MICROCHIP\MPASM SUITE\P16F84A.INC 114 : Superseding current maximum RAM and RAM map.

Warning[205] C:\DOCUMENTS AND SETTINGS\FOLAGBADE\DESKTOP\MYPICPROJET\PICPRO.ASM 108 : Found directive in column 1. (ORG)

Warning[203] C:\DOCUMENTS AND SETTINGS\FOLAGBADE\DESKTOP\MYPICPROJET\PICPRO.ASM 109 : Found opcode in column 1. (BSF)

Warning[219] C:\DOCUMENTS AND SETTINGS\FOLAGBADE\DESKTOP\MYPICPROJET\PICPRO.ASM 109 : Invalid RAM location specified.

Message[302] C:\DOCUMENTS AND SETTINGS\FOLAGBADE\DESKTOP\MYPICPROJET\PICPRO.ASM 109 : Register in operand not in bank 0. Ensure that bank bits are correct.

Warning[203] C:\DOCUMENTS AND SETTINGS\FOLAGBADE\DESKTOP\MYPICPROJET\PICPRO.ASM 110 : Found opcode in column 1. (BSF)

Warning[219] C:\DOCUMENTS AND SETTINGS\FOLAGBADE\DESKTOP\MYPICPROJET\PICPRO.ASM 110 : Invalid RAM location specified.

Message[302] C:\DOCUMENTS AND SETTINGS\FOLAGBADE\DESKTOP\MYPICPROJET\PICPRO.ASM 110 : Register in operand not in bank 0. Ensure that bank bits are correct.

Warning[203] C:\DOCUMENTS AND SETTINGS\FOLAGBADE\DESKTOP\MYPICPROJET\PICPRO.ASM 111 : Found opcode in column 1. (GOTO)

Warning[205] C:\DOCUMENTS AND SETTINGS\FOLAGBADE\DESKTOP\MYPICPROJET\PICPRO.ASM 112 : Found directive in column 1. (ORG)

Message[302] C:\DOCUMENTS AND SETTINGS\FOLAGBADE\DESKTOP\MYPICPROJET\PICPRO.ASM 116 : Register in operand not in bank 0. Ensure that bank bits are correct.

Message[302] C:\DOCUMENTS AND SETTINGS\FOLAGBADE\DESKTOP\MYPICPROJET\PICPRO.ASM 118 : Register in operand not in bank 0. Ensure that bank bits are correct.

Message[305] C:\DOCUMENTS AND SETTINGS\FOLAGBADE\DESKTOP\MYPICPROJET\PICPRO.ASM 132 : Using default destination of 1 (file).

Warning[205] C:\DOCUMENTS AND SETTINGS\FOLAGBADE\DESKTOP\MYPICPROJET\PICPRO.ASM 188 : Found directive in column 1. (END)

Executing: "C:\Program Files\Microchip\MPASM Suite\MPLink.exe" "C:\Program Files\Microchip\MPASM Suite\LKR\16f84a.lkr" "C:\Documents and Settings\FOLAGBADE\Desktop\myPICprojet\picPRo_O" /o"picPRO.cof" /M"picPRO.map"

MPLINK 4.03, Linker
Copyright (c) 2006 Microchip Technology Inc.

Error - section '.org_1' can not fit the absolute section. Section '.org_1' start=0x00000004, length=0x00000082
Errors : 1

BUILD FAILED: Tue Feb 23 20:32:54 2010

What corrections do i need to make. Thanks in advance for your reply.
 
You're still not using 'code' tags, so the formatting is destroyed.

Click on 'go advanced' which then adds a button for the code tags.

Like this:
Code:
Test
                with some spaces

In particular look at errors 203 and 205, you should also NOT be redefining the mnemonics for the registers, use the INC file provided - it also looks like you're not assembling it as absolute code, as the linker shouldn't be involved (except for relocatable code).
 
hi holax,

Have' 'pruned' your listing, it now assembles and runs in simulation.

Which assembler are you using.?

Code:
;16F84A

	list      p=16F84A            ; list directive to define processor
	#include <p16F84A.inc>        ; processor specific variable definitions
	errorlevel -302, -207	
 
 ;;;; Define CONF_WORD = 0x3FF3


	__CONFIG   _CP_OFF & _WDT_ON & _PWRTE_ON & _RC_OSC
 

POINTER	equ	H'000D'
PC	equ	H'0002'


	org	0x00  
	goto	MAIN

	org	0x04
MAIN
	bsf	STATUS, 5
	movlw	0x80
	movwf	TRISB
	movlw	00h
	movwf	TRISA
	bcf	STATUS, 5
CLOCK
	bsf	PORTB, 6
	call	ROUTINE
	bcf	PORTB, 6
	goto	CLOCK
ROUTINE
	incf	POINTER, 1
	movf	POINTER,0	; move register data to W register
	call	TABLE
	call	DISPLAY
	return
TABLE
	addwf	PC,W
	retlw	00h
	retlw	08h
	retlw	14h
	retlw	04h
	retlw	04h
	retlw	3fh
	retlw	00h

	retlw	00h
	retlw	0fh
	retlw	08h
	retlw	0fh
	retlw	08h
	retlw	0fh
	retlw	00h

	retlw	00h
	retlw	06h
	retlw	09h
	retlw	06h
	retlw	09h
	retlw	06h
	retlw	00h

	retlw	00h
	retlw	06h
	retlw	09h
	retlw	09h
	retlw	09h
	retlw	09h
	retlw	00h

	retlw	00h
	retlw	06h
	retlw	09h
	retlw	06h
	retlw	09h
	retlw	06h
	retlw	00h

	return
DISPLAY
	movwf	PORTA
	rlf	PORTA, 1
	rlf	PORTA, 1
	rlf	PORTA, 1
	rlf	PORTA, 1
	rlf	PORTA, 1
	rlf	PORTB, 1
	rlf	PORTB, 1
	rlf	PORTB, 1
	rlf	PORTB, 1
	rlf	PORTB, 1
	rlf	PORTB, 1
	return
	end
 
Thanks very much for your help i think i figured out the problem, what i did was that i changed the org 0x004 after the goto instruction to org 0x005. My code now build successful.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top