Searching \ for '[PIC]: 18f MPASM warning' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/languages.htm?key=asm
Search entire site for: '18f MPASM warning'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: 18f MPASM warning'
2002\06\19@112853 by uter van ooijen & floortje hanneman

picon face
I am making my first steps into 18Fxxx programming.
When asembling something like
  goto 1
I get the warning 'Destination address must be word aligned'. I see bo hints
in the 18F datasheet of such a restriction. The warning seems to happen only
when the destination is specified as a value, not when it is a label. What
is going on?

Wouter van Ooijen
--
Van Ooijen Technische Informatica: http://www.voti.nl
Jal compiler, Wisp programmer, WLoader bootloader, PICs kopen

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@114102 by Alan B. Pearce

face picon face
>I am making my first steps into 18Fxxx programming.
>When asembling something like
>   goto 1
>I get the warning 'Destination address must be word aligned'.
>I see bo hints in the 18F datasheet of such a restriction.
>The warning seems to happen only when the destination is
>specified as a value, not when it is a label. What is going on?

Exactly what it says. You will find a word aligned value is always an even
value, and a label will implicitly have this because of the way it is
assigned.

You should not have a problem with "goto 2" or "goto 0"

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@115050 by Dave Mumert

flavicon
face
Hi Wouter
Check figure 4-5 of the 18F452 data sheet.  You can address each word as
individual bytes in case you want to store data in the program memory but
the instructions words are aligned on even byte boundaries.

Dave


> I am making my first steps into 18Fxxx programming.
> When asembling something like
>    goto 1
> I get the warning 'Destination address must be word aligned'. I see bo
hints
> in the 18F datasheet of such a restriction. The warning seems to happen
only
> when the destination is specified as a value, not when it is a label. What
> is going on?
>
> Wouter van Ooijen

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@120054 by Darrel Johansen

picon face
Wouter van Ooijen wrote:
>I am making my first steps into 18Fxxx programming.
>When asembling something like
>   goto 1
>I get the warning 'Destination address must be word aligned'. I see bo
hints
>in the 18F datasheet of such a restriction. The warning seems to happen
only
>when the destination is specified as a value, not when it is a label.
What
>is going on?

If you have been using other PIC families, there are some things that you
need to understand about the PIC18 family.  First off, it's program memory
is BYTE oriented rather than WORD oriented.  This means that every 16-bit
instruction takes two bytes of program memory (double word instructions
take four bytes), so the instructions are ALWAYS aligned on even
addresses.  So GOTO 1, or GOTO <any odd address> is not a legal
instruction.  You cannot jump into the middle of an instruction and the PC
will always be even aligned.

This architecture helps the compiler quite a bit when dealing with
transferring data from program memory to file registers, and the latest
MPLAB C18 C compiler v2.00 is very efficient.

In fact if you actually look at the hex values for the instructions, there
is no way to "encode" the odd addresses.  Addresses are actually "shifted
right" by one when encoded.

The nice thing about the 18Fxxx is that there are no program memory
"pages" and data memory can be accessed as a linear 4K array using the FSR
registers.  Register banking is still required to do direct access to most
file registers, but SFRs can be addressed without banking.  No more
BANKSELs needed when changing a port from an input to an output.

Darrel Johansen

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@131735 by Olin Lathrop

face picon face
> When asembling something like
>    goto 1
> I get the warning 'Destination address must be word aligned'. I see bo
hints
> in the 18F datasheet of such a restriction. The warning seems to happen
only
> when the destination is specified as a value, not when it is a label. What
> is going on?

On the 18 family, program memory is addressed in 8-bit bytes, but
instruction opcodes are 16 bit.  Each instruction must start on an even
address, and the assembler can tell that 1 is not even.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspam_OUTspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@160215 by uter van ooijen & floortje hanneman

picon face
> Check figure 4-5 of the 18F452 data sheet.  You can address each word as
> individual bytes in case you want to store data in the program memory but
> the instructions words are aligned on even byte boundaries.

Thanks for the answers. When someone asks me why they should use PIC instead
of AVR, 8051 etc. there is always one unexpected argument from my side:
http://www.piclist.com (both for the list itself and for the PIC techref pages).

Wouter van Ooijen
--
Van Ooijen Technische Informatica: http://www.voti.nl
Jal compiler, Wisp programmer, WLoader bootloader, PICs kopen

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


2002\06\19@185541 by Harold M Hallikainen

picon face
       PIC18 instructions are 16 bits long while address refer to 8 bit
locations. So, all instructions start on even addresses. Have a look at
the absolute listing of your program.

Harold


On Wed, 19 Jun 2002 04:53:50 +0200 wouter van ooijen & floortje hanneman
<@spam@wfKILLspamspamXS4ALL.NL> writes:
{Quote hidden}

FCC Rules Online at http://hallikainen.com/FccRules
Lighting control for theatre and television at http://www.dovesystems.com

Reach broadcasters, engineers, manufacturers, compliance labs, and
attorneys.
Advertise at http://www.hallikainen.com/FccRules/ .


________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
dl.http://www.juno.com/get/web/.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...