On Wed, Feb 23, 2005 at 11:57:40AM +1100, Jim Robertson wrote: > > >> What I'm unsure of is: > >> - in the old code I had; goto $ + 5 > >> - in the new code do I have to use; bra $ + 5 > >> but I still get: "Warning 226: Destination address must be word aligned" > >> what do I do to alleviate this? The manual say's > > > >The 18F series has a byte addressed PC. But each op code is 2 bytes. > >Therefore EVERY op code MUST start on a word boundary. > > > >People will correct me if I'm wrong but to get the same functionality > >use bra $ + 0x0a > > This is correct. You must double the offset when moving from the PIC16 to > the PIC18. > This applies to negative offsets too. > > If the BRA crosses over a "CALL" or a "GOTO" then add an additional 2 as > these are four byte instructions. It's already been stated but is worth restating again. It's clear from the discussion above that the 18F instruction addressing structure is much more complicated than the 16F structure. 16F's 1 instruction, one word, one address format was simple enough to keep track of. But with bytes, alignment, variable sized instructions, and the like, the $+ technique becomes even more hazardous than it already was. It's definitely time to leave it alone if you're moving up to 18F. BAJ -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist