Hello
I have an odd problem with some dsPIC code.
I'm using MPLAB and a dsPIC Starter Kit 1. I have some C code calling an assembler routine - in fact the Microchip FFT stuff.
It doesn't work and causes the processor to hang or reset or go off on a jaunt - not sure which. I have three LEDs which the C code turns on if/when the assembler routine returns.
If I put the appropriate pops and a return instruction into the assembler part way along I can make it return and the LEDs come on.
Part way in is the instruction... clr a,[w8]+=2,w6,[w10]+=2,w4 ...a return placed before this instruction returns, but placed after it doesn't and the LEDs go off - one is already on before the asm is called.
I've looked at the op-code - 0xC32046 looks ok to me. The right registers are being pushed and popped in line with the correct calling procedure.
if I comment out the offending line, the code gets a little further but then the ... mpy w4*w6,a,[w8]-=2,w7,[w10]-=2,w5 ... instruction kills it. Likewise, if I comment this out it goes a bit further.
It's a dpPIC33FJ256GP506 and I'm using the debugger. I know I'm doing something stupid - maybe I need to set something somewhere. I've not used this before, so it's all a bit unfamiliar. Any help gratefully received.
Thanks
-- Syd