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.

PIC 18F448 issues

Status
Not open for further replies.

jazzyflymc

New Member
I first started a project using PIc 16F77 and it was going ok, but than I had to change to 18F448 and I keep getting this weird error:

"Error - section '.org_1' can not fit the absolute section. Section '.org_1' start=0x00000008, length=0x00000024"

It has something to do with clearing variables ADRESH and ADRESL, because if I erase the ADRESL command line and end the program, the error is gone:

.
.
.
MEMH equ 0x20
MEML equ 0x21
Temp equ 0x22


org 0x00
goto start

org 0x08

init

clrf PORTA
clrf PORTB
clrf PORTE
clrf PORTC

movlw b'00111111'
movwf TRISA ;PORTA=input
movlw b'00000000'
movwf TRISB ;PORTB=output
movlw b'00000000'
movwf TRISC ;PORTC=output
movlw b'00000111'
movwf TRISE ;PORTE=input
movlw b'00000000'
movwf ADCON1

clrf ADRESH
;clrf ADRESL

start
call init

end



N.B> I've read all the memory banks facts in the data sheet and even in the erata (with the bank 15 and access mamory), but it still doesn't make sense to me why this happens..

Any suggestions ?

Thanks !
 
You did not format your code using the code button and so the spaces are lost when viewing. Otherwise, there seems nothing wrong with your program. However, the three dots above at the start of your code is suspicious because you may have removed from view something that may be the cause of your problem.
 
I have used 18F452.

I suggest that you use the CODE directive instead of the ORG.

And also try writing the code directive before the START and write your INIT else where...

try this...
Code:
.
.
.
MEMH equ 0x20
MEML equ 0x21
Temp equ 0x22


resetV CODE 0x0000
goto start

interV CODE 0x08
nop  ;seems no use of this location....

startcode CODE
start:
call init

init:

clrf PORTA
clrf PORTB
clrf PORTE
clrf PORTC

movlw b'00111111'
movwf TRISA ;PORTA=input
movlw b'00000000'
movwf TRISB ;PORTB=output
movlw b'00000000'
movwf TRISC ;PORTC=output
movlw b'00000111'
movwf TRISE ;PORTE=input
movlw b'00000000'
movwf ADCON1

clrf ADRESH
;clrf ADRESL

END

I do not think you should not give any non-interrupt code in at the interrupt vector location. If I am wrong, excuse me... I have only ever used 18F452.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top