Hello everybody currently I am taking a microprocessors class in college which is part of my major, Electronics Technology. I have stumbled upon a problem when compiling my code to burn onto the chip.
I am using the MPLAB IDE suite.
When i do a build all, my source code seems to be fine except one thing I get an error that says,
Code:
Error - file './BLED2.o', section 'RESET_VECTOR', Symbol '_RESET_VECTOR_0046' is not word-aligned.
It can not be used as the target of a call or goto instruction.
Here is my source,
Code:
LIST P=18F4520, F=INHX32 ;directive to define processor and file format
#include <P18F4520.INC> ;processor specific variable definitions
;******************************************************************************
;Configuration bits
;Microchip has changed the format for defining the configuration bits, please
;see the .inc file for futher details on notation. Below are a few examples.
CONFIG OSC = INTIO67 ;Oscillator Selection:
CONFIG WDT = OFF ;turns watch dog counter off
;******************************************************************************
;Reset vector
; This code will start executing when a reset occurs.
RESET_VECTOR CODE 0x00000
GOTO START ;go to start of main code
;******************************************************************************
;Start of main program
; The main program code is placed here.
cblock
d1
d2
d3
endc
START
movlw 0x00 ;Loads literal value of hex 0 into working registry
movwf TRISB ;Defines port b as output
movlw B'00000010' ;Loaded a value of one
movwf PORTB ;Moves the value of one to port b
movlw 0x08 ;move hex 8 to wreg
movwf d1 ;cblock d1
movlw 0x2F ;move hex value 215
movwf d2 ;cblock d2
movlw 0x03 ;move hex value 3
movwf d3 ;cblock d3
call Delay_0 ;delay
movlw 0x00 ;moves literal value of hex 0 into working registry
movlw 0x08 ;move hex value 8
movwf d1 ;cblock d1
movlw 0x2F ;move hex 215
movwf d2 ;cblock d2
movlw 0x03 ;hex 3
movwf d3 ;cblock d3
call Delay_0
movwf PORTB ;moves contents of file registry to port b
goto START
Delay_0
decfsz d1, f ;decrement f if zero for d1
goto $+2 ;go up two lines
decfsz d2, f ;decrement f if zero for d2
goto $+2 ;move up 2 lines
decfsz d3, f ;decrement d3
goto Delay_0 ;go to Delay_0 line
goto $+1 ;go up one line
nop ;does nothing, wastes 1 uS
return
END ;end of program
Any help is appriciated.
What really gets at me is I had everything working and the professor looked at it burnt it to the PIC and it would light up the LED but my delay didn't delay long enough so any human could not see it blink. I verified that it was indeed blinking by hooking it up to an oscilloscope. So my professor just changed my delay statements and then bang we get this error and cannot figure it out to save our lives.
Thank you