[sdiy] DSPIC computed branch and include help
Richie Burnett
rburnett at richieburnett.co.uk
Mon Feb 22 18:16:48 CET 2016
Has anyone else here using Microchips DSPIC tried to implement a computed
branch using the "BRA w0" instruction ?
No matter what I do, I can't get it to work as explained in the programmers
reference guide description of the BRA instruction. It says that it should
jump to the address (PC+2) + (2*w0) (which makes sense because the program
counter would already be ready to pre-fetch the next instruction, and
instructions are aligned on 2-word boundaries,) but instead it seems to
jump to (PC+2) + w0 but ignores the LSB of w0, (otherwise it would produce
a misaligned odd program counter address!) I've checked and checked this
and I don't see what I'm doing wrong, and can't find an errata sheet that
mentions this problem. Chip being used is dsPIC33FJ128GP804.
Also can someone tell me the correct way to include additional assembly
source files *.s in MPLAB. I just put
.include "filters.s"
.include "maths.s"
.include "comms.s"
etc... at the end of main.s but this seems to have completely broken MPLAB
8.92. It assembles fine, programs fine and runs fine, but goes crazy when
hitting a breakpoint or single-stepping inside any of the included source
files. I'm used to the included file just popping open and the program
counter arrow switching between whichever source window it needs to be in as
different routines are called. I'm actually getting the program counter
arrow moving to lines in the source file that just have comments on them
before the actual code starts when it should switch to one of the included
source contents. Also FWIW the addresses in the "Disassembly Listing"
window are all garbled too! It only does this when I include additional
source files, so I must be doing something wrong!?!?
I'd like to divide the source code up into relevant sections in separate
files to make a big project easier to follow, so really want to get this
done right.
Thanks in advance for any suggestions !
-Richie,
More information about the Synth-diy
mailing list