Maximum PC

It is currently Mon Apr 20, 2015 7:21 pm

All times are UTC - 8 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Blinking LED project in Assemply language for PIC18f4520
PostPosted: Tue Sep 01, 2009 2:20 pm 

Joined: Tue Sep 01, 2009 2:09 pm
Posts: 1
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,

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,

   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.
   GOTO   START      ;go to start of main code

;Start of main program
; The main program code is placed here.


   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

   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


   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

 Post subject:
PostPosted: Mon Sep 14, 2009 3:55 pm 
Team Member [Top 500]*
Team Member [Top 500]*
User avatar

Joined: Thu Jun 24, 2004 2:22 pm
Posts: 8727
Location: Cleveland, Ohio
Since your post has gone sometime without a reply I'll suggest THIS FORUM as it has a strong PIC crowd. They focus on electronics (Nuts & Volts) and have a section devoted to PIC. Hopefully that will help with your course.


Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 8 hours

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

© 2014 Future US, Inc. All rights reserved.